Skip to content

Commit eac749f

Browse files
committed
test: Run script with sudo instead of adding sudo in script
Signed-off-by: Xiaofeng Wang <[email protected]>
1 parent 3067f33 commit eac749f

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.github/workflows/integration.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ jobs:
2424
- name: Build bootc and bootc image
2525
env:
2626
TEST_OS: ${{ matrix.test_os }}
27-
run: tests/build.sh
27+
run: sudo -E TEST_OS=$TEST_OS tests/build.sh
28+
29+
- name: Grant sudo user permission to archive files
30+
run: |
31+
sudo chmod 0755 /tmp/tmp-bootc-build/id_rsa
2832
2933
- name: Archive bootc disk image - disk.raw
3034
uses: actions/upload-artifact@v4
@@ -56,7 +60,7 @@ jobs:
5660
run: |
5761
sudo apt-get update
5862
sudo apt install -y qemu-kvm qemu-system
59-
pip install --user tmt
63+
sudo pip install tmt
6064
6165
- name: Create folder to save disk image
6266
run: mkdir -p /tmp/tmp-bootc-build
@@ -76,7 +80,7 @@ jobs:
7680
- name: Run test
7781
env:
7882
TMT_PLAN_NAME: ${{ matrix.tmt_plan }}
79-
run: chmod 600 /tmp/tmp-bootc-build/id_rsa && tests/test.sh
83+
run: chmod 600 /tmp/tmp-bootc-build/id_rsa && sudo -E TMT_PLAN_NAME=$TMT_PLAN_NAME tests/test.sh
8084

8185
- name: Archive TMT logs
8286
if: always()

tests/build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ EORUN
8282
CONTAINERFILEOF
8383

8484
LOCAL_IMAGE="localhost/bootc:test"
85-
sudo podman build \
85+
podman build \
8686
--retry 5 \
8787
--retry-delay 5s \
8888
-v "$(pwd)":/code:z \
@@ -93,14 +93,14 @@ sudo podman build \
9393
SSH_KEY=${BOOTC_TEMPDIR}/id_rsa
9494
ssh-keygen -f "${SSH_KEY}" -N "" -q -t rsa-sha2-256 -b 2048
9595

96-
sudo truncate -s 10G "${BOOTC_TEMPDIR}/disk.raw"
96+
truncate -s 10G "${BOOTC_TEMPDIR}/disk.raw"
9797

9898
# For test-22-logically-bound-install
99-
sudo podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest
100-
sudo podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest
101-
sudo podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest
99+
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest
100+
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest
101+
podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest
102102

103-
sudo podman run \
103+
podman run \
104104
--rm \
105105
--privileged \
106106
--pid=host \

tests/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SSH_KEY=${BOOTC_TEMPDIR}/id_rsa
1010
ARCH=$(uname -m)
1111
case "$ARCH" in
1212
"aarch64")
13-
sudo qemu-system-aarch64 \
13+
qemu-system-aarch64 \
1414
-name bootc-vm \
1515
-enable-kvm \
1616
-machine virt \
@@ -24,7 +24,7 @@ case "$ARCH" in
2424
-daemonize
2525
;;
2626
"x86_64")
27-
sudo qemu-system-x86_64 \
27+
qemu-system-x86_64 \
2828
-name bootc-vm \
2929
-enable-kvm \
3030
-cpu host \

0 commit comments

Comments
 (0)