Skip to content

Commit ad6aebd

Browse files
committed
Catch errors in tests of the kitchen sink image
While looking into pulumi/templates#929 I noticed that the kitchen sink job was not failing https://github.com/pulumi/pulumi-docker-containers/actions/runs/15796277766/job/44529555986#step:16:1064 To fix this we now run the `docker run … | sed` bit in a subshell so we get a single pid to wait for. We also grab the exit code from each test run and make sure we fail the job if either is non-zero. Also fixes the image name for the `nonroot` variant.
1 parent b421304 commit ad6aebd

1 file changed

Lines changed: 21 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ jobs:
163163
run: |
164164
set -exo pipefail
165165
chmod o+r $GOOGLE_APPLICATION_CREDENTIALS
166-
docker run \
166+
# Run root test in background
167+
(docker run \
167168
-e RUN_CONTAINER_TESTS=true \
168169
-e IMAGE_VARIANT=pulumi \
169170
-e PULUMI_ACCESS_TOKEN=${PULUMI_ACCESS_TOKEN} \
@@ -183,8 +184,11 @@ jobs:
183184
--volume /tmp:/src \
184185
--entrypoint /src/pulumi-test-containers \
185186
${{ env.DOCKER_ORG }}/pulumi:${{ env.PULUMI_VERSION }}-${{ matrix.arch }} \
186-
-test.parallel=8 -test.timeout=1h -test.v | sed 's/.*/[root] &/' &
187-
docker run \
187+
-test.parallel=8 -test.timeout=1h -test.v | sed 's/.*/[root] &/') &
188+
ROOT_PID=$!
189+
190+
# Run nonroot test in background
191+
(docker run \
188192
-e RUN_CONTAINER_TESTS=true \
189193
-e IMAGE_VARIANT=pulumi-nonroot \
190194
-e PULUMI_ACCESS_TOKEN=${PULUMI_ACCESS_TOKEN} \
@@ -203,9 +207,20 @@ jobs:
203207
--mount type=bind,source=$GOOGLE_APPLICATION_CREDENTIALS,target=/src/creds.json \
204208
--volume /tmp:/src \
205209
--entrypoint /src/pulumi-test-containers \
206-
${{ env.DOCKER_ORG }}/pulumi:${{ env.PULUMI_VERSION }}-${{ matrix.arch }}-nonroot \
207-
-test.parallel=8 -test.timeout=1h -test.v | sed 's/.*/[nonroot] &/' &
208-
wait
210+
${{ env.DOCKER_ORG }}/pulumi:${{ env.PULUMI_VERSION }}-nonroot-${{ matrix.arch }} \
211+
-test.parallel=8 -test.timeout=1h -test.v | sed 's/.*/[nonroot] &/') &
212+
NONROOT_PID=$!
213+
214+
# Wait for both processes and check their exit codes
215+
wait $ROOT_PID
216+
ROOT_EXIT=$?
217+
wait $NONROOT_PID
218+
NONROOT_EXIT=$?
219+
220+
if [ $ROOT_EXIT -ne 0 ] || [ $NONROOT_EXIT -ne 0 ]; then
221+
echo "Tests failed: root exit code $ROOT_EXIT, nonroot exit code $NONROOT_EXIT"
222+
exit 1
223+
fi
209224
210225
provider-build-environment:
211226
name: Provider Build Environment image

0 commit comments

Comments
 (0)