Skip to content

Commit 20a6fc4

Browse files
committed
Making the image size check more generic as per comments.
1 parent b3416b3 commit 20a6fc4

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

.github/actions/smoke-test/build.sh

+6-10
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ echo "(*) Installing @devcontainer/cli"
88
npm install -g @devcontainers/cli
99

1010
id_label="test-container=${IMAGE}"
11-
id_image="universal-test-image"
12-
if [ $IMAGE == "universal" ]; then
13-
echo "(*) Building image - ${IMAGE}"
14-
devcontainer build --image-name ${id_image} --workspace-folder "src/${IMAGE}/"
15-
echo "(*) Starting container - ${IMAGE}"
16-
devcontainer up --id-label ${id_label} --workspace-folder "src/${IMAGE}/"
17-
else
18-
echo "(*) Building image - ${IMAGE}"
19-
devcontainer up --id-label ${id_label} --workspace-folder "src/${IMAGE}/"
20-
fi
11+
id_image="${IMAGE}-test-image"
12+
echo "(*) Building image - ${IMAGE}"
13+
devcontainer build --image-name ${id_image} --workspace-folder "src/${IMAGE}/"
14+
echo "(*) Starting container - ${IMAGE}"
15+
devcontainer up --id-label ${id_label} --workspace-folder "src/${IMAGE}/"
16+

.github/actions/smoke-test/check-image-size.sh

+2-8
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,8 @@ check_image_size() {
3636
# call install_bc
3737
install_bc
3838

39-
if [ $IMAGE == "universal" ]; then
40-
#Read the image id of the original image, not the modified image with uid and gid
41-
IMAGE_ID=$(docker images -q --filter=reference="$id_image")
42-
else
43-
CONTAINER_ID=$(docker ps -q --filter "label=test-container=$IMAGE")
44-
# Find the image ID of the container
45-
IMAGE_ID=$(docker inspect --format='{{.Image}}' "$CONTAINER_ID")
46-
fi
39+
#Read the image id of the original image, not the modified image with uid and gid
40+
IMAGE_ID=$(docker images -q --filter=reference="$id_image")
4741
# Find the size of the image
4842
IMAGE_SIZE=$(docker image inspect --format='{{.Size}}' "$IMAGE_ID")
4943
# Output the size

.github/actions/smoke-test/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -e
1010
# Run actual test
1111
echo "(*) Running test..."
1212
id_label="test-container=${IMAGE}"
13-
id_image="universal-test-image"
13+
id_image="${IMAGE}-test-image"
1414
devcontainer exec --workspace-folder $(pwd)/src/$IMAGE --id-label ${id_label} /bin/sh -c 'set -e && if [ -f "test-project/test.sh" ]; then cd test-project && if [ "$(id -u)" = "0" ]; then chmod +x test.sh; else sudo chmod +x test.sh; fi && ./test.sh; else ls -a; fi'
1515

1616
echo "(*) Docker image details..."

0 commit comments

Comments
 (0)