From 34e030a805fcfae47f4eb0ec617e168d33bc95c5 Mon Sep 17 00:00:00 2001 From: Kaniska Date: Mon, 24 Feb 2025 17:23:04 +0000 Subject: [PATCH] Updating with the changes suggested for UID & GID issue for oryx-install-dotnet-2.1 resr step to succeed. Also change done in image size check part. --- .github/actions/smoke-test/build.sh | 6 +++++- .github/actions/smoke-test/check-image-size.sh | 7 +++---- .github/actions/smoke-test/test.sh | 3 ++- src/universal/test-project/test.sh | 6 ++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/actions/smoke-test/build.sh b/.github/actions/smoke-test/build.sh index ec6be58c9..451b961bf 100755 --- a/.github/actions/smoke-test/build.sh +++ b/.github/actions/smoke-test/build.sh @@ -7,6 +7,10 @@ export DOCKER_BUILDKIT=1 echo "(*) Installing @devcontainer/cli" npm install -g @devcontainers/cli -echo "(*) Building image - ${IMAGE}" id_label="test-container=${IMAGE}" +id_image="${IMAGE}-test-image" +echo "(*) Building image - ${IMAGE}" +devcontainer build --image-name ${id_image} --workspace-folder "src/${IMAGE}/" +echo "(*) Starting container - ${IMAGE}" devcontainer up --id-label ${id_label} --workspace-folder "src/${IMAGE}/" + diff --git a/.github/actions/smoke-test/check-image-size.sh b/.github/actions/smoke-test/check-image-size.sh index 7a48ff69b..65df352a6 100755 --- a/.github/actions/smoke-test/check-image-size.sh +++ b/.github/actions/smoke-test/check-image-size.sh @@ -32,13 +32,12 @@ install_bc() { check_image_size() { IMAGE="$1" THRESHOLD_IN_GB="$2" - + id_image="$3" # call install_bc install_bc - CONTAINER_ID=$(docker ps -q --filter "label=test-container=$IMAGE") - # Find the image ID of the container - IMAGE_ID=$(docker inspect --format='{{.Image}}' "$CONTAINER_ID") + #Read the image id of the original image, not the modified image with uid and gid + IMAGE_ID=$(docker images -q --filter=reference="$id_image") # Find the size of the image IMAGE_SIZE=$(docker image inspect --format='{{.Size}}' "$IMAGE_ID") # Output the size diff --git a/.github/actions/smoke-test/test.sh b/.github/actions/smoke-test/test.sh index 6a9c9a674..cac0897c2 100755 --- a/.github/actions/smoke-test/test.sh +++ b/.github/actions/smoke-test/test.sh @@ -10,6 +10,7 @@ set -e # Run actual test echo "(*) Running test..." id_label="test-container=${IMAGE}" +id_image="${IMAGE}-test-image" 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' echo "(*) Docker image details..." @@ -17,7 +18,7 @@ docker images # Checking size of universal image if [ $IMAGE == "universal" ]; then - check_image_size $IMAGE $THRESHOLD_IN_GB + check_image_size $IMAGE $THRESHOLD_IN_GB $id_image fi # Clean up diff --git a/src/universal/test-project/test.sh b/src/universal/test-project/test.sh index f71657309..3cc3d71cd 100644 --- a/src/universal/test-project/test.sh +++ b/src/universal/test-project/test.sh @@ -2,6 +2,8 @@ cd $(dirname "$0") source test-utils.sh codespace +#Changing he ownership of dotnet path to ensure oryx-install-dotnet-2.1 test doesn't fail with permission issue +sudo chown -R codespace:codespace /usr/share/dotnet # Run common tests checkCommon @@ -132,10 +134,6 @@ check "zsh" zsh --version # Check env variable check "RAILS_DEVELOPMENT_HOSTS is set correctly" echo $RAILS_DEVELOPMENT_HOSTS | grep ".githubpreview.dev,.preview.app.github.dev,.app.github.dev" -# Check that we can run a puppeteer node app. -yarn -check "run-puppeteer" node puppeteer.js - # Check Oryx check "oryx" oryx --version