Skip to content

Commit

Permalink
Revert "[universal] - Issue universal config change for non-root defa…
Browse files Browse the repository at this point in the history
…ult code…"

This reverts commit c930750.
  • Loading branch information
Kaniska244 authored Feb 24, 2025
1 parent c930750 commit 80c0d17
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 39 deletions.
6 changes: 1 addition & 5 deletions .github/actions/smoke-test/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ export DOCKER_BUILDKIT=1
echo "(*) Installing @devcontainer/cli"
npm install -g @devcontainers/cli

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}"
id_label="test-container=${IMAGE}"
devcontainer up --id-label ${id_label} --workspace-folder "src/${IMAGE}/"

7 changes: 4 additions & 3 deletions .github/actions/smoke-test/check-image-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ install_bc() {
check_image_size() {
IMAGE="$1"
THRESHOLD_IN_GB="$2"
id_image="$3"

# call install_bc
install_bc

#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")
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")
# Find the size of the image
IMAGE_SIZE=$(docker image inspect --format='{{.Size}}' "$IMAGE_ID")
# Output the size
Expand Down
3 changes: 1 addition & 2 deletions .github/actions/smoke-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ 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..."
docker images
# Checking size of universal image

if [ $IMAGE == "universal" ]; then
check_image_size $IMAGE $THRESHOLD_IN_GB $id_image
check_image_size $IMAGE $THRESHOLD_IN_GB
fi

# Clean up
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/push-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
- name: Checkout
id: checkout
uses: actions/checkout@v3


- name: Build and push dev tags
id: build_and_push
Expand All @@ -41,7 +40,7 @@ jobs:
STUB_REGISTRY_BASE_PATH: ${{ secrets.STUB_REGISTRY_BASE_PATH }}
SECONDARY_REGISTRY_BASE_PATH: ${{ secrets.SECONDARY_REGISTRY_BASE_PATH }}
TOKEN_NAME: ${{ secrets.TOKEN_NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
set -e
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-manual-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
path: 'release'
ref: ${{ github.event.inputs.release }}

- name: Build and push
id: build_and_push
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Checkout
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v3

- name: Get tag name
run: echo "TAG=$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')" >> $GITHUB_ENV
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/smoke-universal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ jobs:
- name: Checkout
id: checkout
uses: actions/checkout@v3

- name: Smoke test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: smoke_test
uses: ./.github/actions/smoke-test
with:
Expand Down
3 changes: 1 addition & 2 deletions src/universal/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ RUN apt-get update \
# Install tools and shells not in common script
&& apt-get install -yq vim vim-doc xtail software-properties-common libsecret-1-dev \
# Install additional tools (useful for 'puppeteer' project)
# Also added three new libraries to ensure google chrome sucessful installation
&& apt-get install -y --no-install-recommends libnss3 libnspr4 libatk-bridge2.0-0 libatk1.0-0 libx11-6 libpangocairo-1.0-0 \
libx11-xcb1 libcups2 libxcomposite1 libxdamage1 libxfixes3 libpango-1.0-0 libgbm1 libgtk-3-0 fonts-liberation libvulkan1 xdg-utils \
libx11-xcb1 libcups2 libxcomposite1 libxdamage1 libxfixes3 libpango-1.0-0 libgbm1 libgtk-3-0 \
# Clean up
&& apt-get autoremove -y && apt-get clean -y \
# Move first run notice to right spot
Expand Down
8 changes: 2 additions & 6 deletions src/universal/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ghcr.io/devcontainers/features/common-utils:2": {
"username": "codespace",
"userUid": "1000",
"userGid": "1000"
"userGid": "1000"
},
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "8.0",
Expand Down Expand Up @@ -103,11 +103,7 @@
],
"remoteUser": "codespace",
"containerUser": "codespace",
// This variable is set to ensure puppeteer library gets the sandbox location by default.
// Ref:- https://github.com/devcontainers/internal/issues/249
"containerEnv": {
"CHROME_DEVEL_SANDBOX": "/usr/local/sbin/chrome-devel-sandbox"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

Expand Down
12 changes: 0 additions & 12 deletions src/universal/.devcontainer/local-features/setup-user/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,4 @@ bash -c ". /usr/local/share/nvm/nvm.sh && nvm use 18"
bash -c "npm -g install -g [email protected]"
bash -c ". /usr/local/share/nvm/nvm.sh && nvm use stable"

# Installing google chrome to use the sandbox for launching browser using puppeteer library in nodejs.
# Ref:- https://github.com/devcontainers/internal/issues/249
cd /
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb
cd /opt/google/chrome/
chown root:root chrome-sandbox
chmod 4755 chrome-sandbox
cp -p chrome-sandbox /usr/local/sbin/chrome-devel-sandbox
cd /
rm -f google-chrome-stable_current_amd64.deb

echo "Done!"
4 changes: 1 addition & 3 deletions src/universal/test-project/test.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
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
Expand Down Expand Up @@ -204,4 +202,4 @@ check "conda-install-tensorflow" bash -c "conda create --name test-env -c conda-
check "conda-install-pytorch" bash -c "conda create --name test-env -c conda-forge --yes pytorch"

# Report result
reportResults
reportResults

0 comments on commit 80c0d17

Please sign in to comment.