-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/devcontainers/images into s…
…amruddhikhandale/cleanup
- Loading branch information
Showing
22 changed files
with
28 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,15 @@ | ||
#/bin/bash | ||
DEFINITION="$1" | ||
IMAGE="$2" | ||
USERNAME="$3" | ||
|
||
export DOCKER_BUILDKIT=1 | ||
set -e | ||
|
||
# List docker images | ||
echo "(*) Listing docker images..." | ||
docker images | ||
|
||
|
||
# Update UID/GID for user in container - Actions uses different UID/GID than container | ||
# which causes bind mounts to be read only and cause certain write tests to fail | ||
# The dev container CLI handles this automatically but we're not using it. | ||
local_uid=$(id -u) | ||
local_gid=$(id -g) | ||
|
||
echo "(*) Updating container user UID/GID..." | ||
echo -e "FROM ${IMAGE}\n \ | ||
RUN export sudo_cmd="" \ | ||
&& if [ "$(id -u)" != "0" ]; then export sudo_cmd=sudo; fi \ | ||
&& \${sudo_cmd} groupmod -g ${local_gid} ${USERNAME} \ | ||
&& \${sudo_cmd} usermod -u ${local_uid} -g ${local_gid} ${USERNAME}" > uid.Dockerfile | ||
cat uid.Dockerfile | ||
docker build -t ${IMAGE}-uid -f uid.Dockerfile . | ||
|
||
# Start container | ||
echo "(*) Starting container..." | ||
container_name="vscdc-test-container-$DEFINITION" | ||
docker run -d --name ${container_name} --rm --init --privileged -v "$(pwd)/src/${DEFINITION}:/workspace" ${IMAGE}-uid /bin/sh -c 'while sleep 1000; do :; done' | ||
|
||
# Run actual test | ||
echo "(*) Running test..." | ||
docker exec -u "${USERNAME}" ${container_name} /bin/sh -c '\ | ||
set -e \ | ||
&& cd /workspace \ | ||
&& 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' | ||
cd build | ||
chmod +x devcontainers-cli-0.3.0-1.tgz | ||
|
||
npx --yes devcontainers-cli-0.3.0-1.tgz exec --workspace-folder $(pwd)/../src/$DEFINITION /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' | ||
|
||
# Clean up | ||
docker rm -f ${container_name} | ||
docker stop $(docker container ls -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,49 +62,10 @@ jobs: | |
--stub-registry ${{ secrets.STUB_REGISTRY }} \ | ||
--stub-registry-path ${{ secrets.STUB_REGISTRY_BASE_PATH }} | ||
package: | ||
name: Package | ||
if: "!contains(github.event.head_commit.message, 'Automated update') && !contains(github.event.head_commit.message, 'CI ignore')" | ||
needs: [build-and-push] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Package | ||
id: package | ||
run: | | ||
set -e | ||
yarn install | ||
GIT_BRANCH=$(echo "${{ github.ref }}" | grep -oP 'refs/(heads|tags)/\K(.+)') | ||
if [ "$GIT_BRANCH" == "" ]; then | ||
GIT_BRANCH=main | ||
fi | ||
build/vscdc pack --prep-and-package-only \ | ||
--release $GIT_BRANCH \ | ||
--github-repo ${{ github.repository }} \ | ||
--registry ${{ secrets.REGISTRY }} \ | ||
--registry-path ${{ secrets.REGISTRY_BASE_PATH }} \ | ||
--stub-registry ${{ secrets.STUB_REGISTRY }} \ | ||
--stub-registry-path ${{ secrets.STUB_REGISTRY_BASE_PATH }} | ||
# Set an output with the resulting package name for upload | ||
PKG_PREFIX=$(node -p "require('./package.json').name") | ||
PKG_NAME=$PKG_PREFIX-${{ github.sha }}.tgz | ||
mv ./$PKG_PREFIX-*.tgz ./$PKG_NAME | ||
echo "::set-output name=package_name::$PKG_NAME" | ||
- name: Upload package | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ steps.package.outputs.package_name }} | ||
path: ./${{ steps.package.outputs.package_name }} | ||
|
||
image-info: | ||
name: Trigger info extraction | ||
if: "!contains(github.event.head_commit.message, 'Automated update') && !contains(github.event.head_commit.message, 'CI ignore')" | ||
needs: [package] | ||
needs: [build-and-push] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger image info file generation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Release Containers | ||
name: Build and push images | ||
|
||
on: | ||
push: | ||
|
@@ -61,61 +61,9 @@ jobs: | |
--stub-registry ${{ secrets.STUB_REGISTRY }} \ | ||
--stub-registry-path ${{ secrets.STUB_REGISTRY_BASE_PATH }} | ||
package: | ||
name: Package and release | ||
needs: [build-and-push] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get tag name | ||
id: get_tag_name | ||
run: echo "::set-output name=tag::$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')" | ||
|
||
- name: Package | ||
id: package | ||
run: | | ||
set -e | ||
yarn install | ||
build/vscdc pack --prep-and-package-only \ | ||
--release ${{ steps.get_tag_name.outputs.tag }} \ | ||
--github-repo ${{ github.repository }} \ | ||
--registry ${{ secrets.REGISTRY }} \ | ||
--registry-path ${{ secrets.REGISTRY_BASE_PATH }} \ | ||
--stub-registry ${{ secrets.STUB_REGISTRY }} \ | ||
--stub-registry-path ${{ secrets.STUB_REGISTRY_BASE_PATH }} | ||
# Set an output with the resulting package name for upload | ||
PKG_PREFIX=$(node -p "require('./package.json').name") | ||
echo "::set-output name=package_name::$(ls $PKG_PREFIX-*.tgz)" | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.get_tag_name.outputs.tag }} | ||
release_name: ${{ steps.get_tag_name.outputs.tag }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload package as release asset | ||
id: upload_release_asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./${{ steps.package.outputs.package_name }} | ||
asset_name: ${{ steps.package.outputs.package_name }} | ||
asset_content_type: application/gzip | ||
|
||
image-info: | ||
name: Trigger info extraction | ||
needs: [package] | ||
needs: [build-and-push] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get tag name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters