Skip to content

Commit 60c139c

Browse files
committed
gha: use sudo -E in some places to prevent dropping env-vars
Using `-E` preserves environment variables, except for PATH, so PATH has to be manually set to match the current environment. I removed env-vars that were redundant (such as `GOPATH=$GOPATH`), which should be handled by `-E`. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit c1d1edb) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent e0d4529 commit 60c139c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
GO111MODULE: off
9999
working-directory: src/github.com/containerd/containerd
100100
run: |
101-
sudo env PATH=$PATH GOPATH=$GOPATH script/setup/install-protobuf
101+
sudo -E PATH=$PATH script/setup/install-protobuf
102102
sudo chmod +x /usr/local/bin/protoc
103103
sudo chmod og+rx /usr/local/include/google /usr/local/include/google/protobuf /usr/local/include/google/protobuf/compiler
104104
sudo chmod -R og+r /usr/local/include/google/protobuf/
@@ -317,7 +317,7 @@ jobs:
317317
CGO_ENABLED: 1
318318
run: |
319319
make binaries
320-
sudo make install
320+
sudo -E PATH=$PATH make install
321321
working-directory: src/github.com/containerd/containerd
322322

323323
- name: Tests
@@ -326,7 +326,7 @@ jobs:
326326
SKIPTESTS: github.com/containerd/containerd/snapshots/devmapper
327327
run: |
328328
make test
329-
sudo -E PATH=$PATH GOPATH=$GOPATH GOPROXY=$GOPROXY make root-test
329+
sudo -E PATH=$PATH make root-test
330330
working-directory: src/github.com/containerd/containerd
331331

332332
- name: Integration 1
@@ -335,7 +335,7 @@ jobs:
335335
TEST_RUNTIME: ${{ matrix.runtime }}
336336
RUNC_FLAVOR: ${{ matrix.runc }}
337337
run: |
338-
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR make integration EXTRA_TESTFLAGS=-no-criu TESTFLAGS_RACE=-race
338+
sudo -E PATH=$PATH make integration EXTRA_TESTFLAGS=-no-criu TESTFLAGS_RACE=-race
339339
working-directory: src/github.com/containerd/containerd
340340

341341
# Run the integration suite a second time. See discussion in github.com/containerd/containerd/pull/1759
@@ -345,7 +345,7 @@ jobs:
345345
TEST_RUNTIME: ${{ matrix.runtime }}
346346
RUNC_FLAVOR: ${{ matrix.runc }}
347347
run: |
348-
sudo GOPATH=$GOPATH GOPROXY=$GOPROXY TEST_RUNTIME=$TEST_RUNTIME RUNC_FLAVOR=$RUNC_FLAVOR TESTFLAGS_PARALLEL=1 make integration EXTRA_TESTFLAGS=-no-criu
348+
sudo -E PATH=$PATH TESTFLAGS_PARALLEL=1 make integration EXTRA_TESTFLAGS=-no-criu
349349
working-directory: src/github.com/containerd/containerd
350350

351351
- name: CRI test
@@ -359,13 +359,13 @@ jobs:
359359
runtime_type = "${TEST_RUNTIME}"
360360
EOF
361361
sudo ls /etc/cni/net.d
362-
sudo PATH=$PATH BDIR=$BDIR /usr/local/bin/containerd -a ${BDIR}/c.sock --config ${BDIR}/config.toml --root ${BDIR}/root --state ${BDIR}/state --log-level debug &> ${BDIR}/containerd-cri.log &
363-
sudo PATH=$PATH BDIR=$BDIR /usr/local/bin/ctr -a ${BDIR}/c.sock version
364-
sudo PATH=$PATH BDIR=$BDIR GOPATH=$GOPATH critest --runtime-endpoint=unix:///${BDIR}/c.sock --parallel=8
362+
sudo -E PATH=$PATH /usr/local/bin/containerd -a ${BDIR}/c.sock --config ${BDIR}/config.toml --root ${BDIR}/root --state ${BDIR}/state --log-level debug &> ${BDIR}/containerd-cri.log &
363+
sudo -E PATH=$PATH /usr/local/bin/ctr -a ${BDIR}/c.sock version
364+
sudo -E PATH=$PATH critest --runtime-endpoint=unix:///${BDIR}/c.sock --parallel=8
365365
TEST_RC=$?
366366
test $TEST_RC -ne 0 && cat ${BDIR}/containerd-cri.log
367367
sudo pkill containerd
368-
sudo BDIR=$BDIR rm -rf ${BDIR}
368+
sudo -E rm -rf ${BDIR}
369369
test $TEST_RC -eq 0 || /bin/false
370370
371371
cgroup2:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
sudo install -m 644 containerd.service ${DESTDIR}/etc/systemd/system
143143
echo "CONTAINERD_VERSION: '${RELEASE_VER#v}'" | sudo tee ${DESTDIR}/opt/containerd/cluster/version
144144
145-
sudo PATH=$PATH script/setup/install-seccomp
145+
sudo -E PATH=$PATH script/setup/install-seccomp
146146
USESUDO=true script/setup/install-runc
147147
script/setup/install-cni
148148
script/setup/install-critools

0 commit comments

Comments
 (0)