diff --git a/.github/actions/smoke-test/action.yaml b/.github/actions/smoke-test/action.yaml index 9ad3ec42c3..c09f7388ed 100644 --- a/.github/actions/smoke-test/action.yaml +++ b/.github/actions/smoke-test/action.yaml @@ -4,6 +4,10 @@ inputs: description: 'Definition to test' required: true default: 'debian' + image: + description: 'Image to run smoke test in' + required: true + default: 'none' user: description: 'User in container image to use for smoke test' required: true @@ -14,16 +18,18 @@ runs: steps: - name: Checkout main id: checkout_release - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: repository: 'devcontainers/images' path: '__build' ref: 'main' + - name: Build image id: build_image shell: bash run: ${{ github.action_path }}/build.sh ${{ inputs.definition }} + - name: Test image id: test_image shell: bash - run: chmod +x ${{ github.action_path }}/test.sh && ${{ github.action_path }}/test.sh ${{ inputs.definition }} ${{ inputs.user }} + run: ${{ github.action_path }}/test.sh ${{ inputs.definition }} ${{ inputs.image }} ${{ inputs.user }} diff --git a/.github/actions/smoke-test/build.sh b/.github/actions/smoke-test/build.sh index a63409ed69..fde6072b5d 100755 --- a/.github/actions/smoke-test/build.sh +++ b/.github/actions/smoke-test/build.sh @@ -4,13 +4,23 @@ DEFINITION="$1" set -e export DOCKER_BUILDKIT=1 -echo "(*) Pulling latest '@devcontainer/cli" -# npm install -g @devcontainers/cli -#Temporarily installing cli from source until https://github.com/devcontainers/cli/pull/6 is merged -cd build -chmod +x devcontainers-cli-0.3.0-1.tgz +# Symlink build scripts from main to improve security when testing PRs +if [ -d "$GITHUB_WORKSPACE/__build/build" ]; then + cp -r "$GITHUB_WORKSPACE/__build/build" "$GITHUB_WORKSPACE/" +else + echo "WARNING: Using build/vscdc from $GITHUB_REF instead of main." +fi +rm -rf node_modules +yarn install -echo "(*) Building image - ${DEFINITION}" -npx --yes devcontainers-cli-0.3.0-1.tgz up --workspace-folder ../src/${DEFINITION} -# devcontainer build --workspace-folder "src/${DEFINITION}/" --image-name vsc-${DEFINITION} +# Run test build +chmod +x build/vscdc +build/vscdc push ${DEFINITION} \ + --no-push \ + --release dev \ + --github-repo "devcontainers/images" \ + --registry "mcr.microsoft.com" \ + --registry-path "devcontainers" \ + --stub-registry "mcr.microsoft.com" \ + --stub-registry-path "devcontainers" diff --git a/.github/actions/smoke-test/test.sh b/.github/actions/smoke-test/test.sh index 0ea023a30e..6df4b4afe4 100755 --- a/.github/actions/smoke-test/test.sh +++ b/.github/actions/smoke-test/test.sh @@ -1,16 +1,52 @@ #/bin/bash DEFINITION="$1" -USERNAME="$2" +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..." -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' +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' # Clean up -docker stop $(docker container ls -q) \ No newline at end of file +docker rm -f ${container_name} \ No newline at end of file diff --git a/.github/workflows/push-and-package.yml b/.github/workflows/push-and-package.yml index afa5095e95..20c89f68d5 100644 --- a/.github/workflows/push-and-package.yml +++ b/.github/workflows/push-and-package.yml @@ -10,8 +10,8 @@ jobs: name: Build and push images strategy: matrix: - page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - page-total: [10] + page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + page-total: [11] fail-fast: false runs-on: ubuntu-latest steps: diff --git a/.github/workflows/push-dev.yml b/.github/workflows/push-dev.yml index 844e2488e2..293f282fe2 100644 --- a/.github/workflows/push-dev.yml +++ b/.github/workflows/push-dev.yml @@ -11,8 +11,8 @@ jobs: if: "!contains(github.event.head_commit.message, 'Automated update') && !contains(github.event.head_commit.message, 'CI ignore')" strategy: matrix: - page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - page-total: [10] + page: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] + page-total: [11] fail-fast: true runs-on: ubuntu-latest steps: diff --git a/.github/workflows/smoke-alpine.yaml b/.github/workflows/smoke-alpine.yaml index 1653537ee4..ea39ac6ee8 100644 --- a/.github/workflows/smoke-alpine.yaml +++ b/.github/workflows/smoke-alpine.yaml @@ -9,6 +9,8 @@ on: paths: - src/alpine/** - .github/workflows/smoke-alpine.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -24,4 +26,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: alpine + image: mcr.microsoft.com/devcontainers/base:dev-alpine user: vscode diff --git a/.github/workflows/smoke-anaconda.yaml b/.github/workflows/smoke-anaconda.yaml index 36e39adcd4..491bb5fc1a 100644 --- a/.github/workflows/smoke-anaconda.yaml +++ b/.github/workflows/smoke-anaconda.yaml @@ -9,6 +9,8 @@ on: paths: - src/anaconda/** - .github/workflows/smoke-anaconda.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -26,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: anaconda + image: mcr.microsoft.com/devcontainers/anaconda:dev-3 user: vscode diff --git a/.github/workflows/smoke-codespaces.yaml b/.github/workflows/smoke-codespaces.yaml index 0f77334a93..3c00186a94 100644 --- a/.github/workflows/smoke-codespaces.yaml +++ b/.github/workflows/smoke-codespaces.yaml @@ -2,16 +2,15 @@ name: Smoke test "codespaces" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/codespaces/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/codespaces/**' + - src/codespaces/** + - .github/codespaces/smoke-codespaces.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: codespaces + image: mcr.microsoft.com/devcontainers/universal:dev-linux user: codespace diff --git a/.github/workflows/smoke-cpp.yaml b/.github/workflows/smoke-cpp.yaml index a803f495d8..b434a6017b 100644 --- a/.github/workflows/smoke-cpp.yaml +++ b/.github/workflows/smoke-cpp.yaml @@ -2,16 +2,15 @@ name: Smoke test "cpp" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/cpp/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/cpp/**' + - src/cpp/** + - .github/workflows/smoke-cpp.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -27,4 +26,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: cpp + image: mcr.microsoft.com/devcontainers/cpp:dev-debian user: vscode diff --git a/.github/workflows/smoke-debian.yaml b/.github/workflows/smoke-debian.yaml index 1379cd1848..b69e996393 100644 --- a/.github/workflows/smoke-debian.yaml +++ b/.github/workflows/smoke-debian.yaml @@ -2,16 +2,15 @@ name: Smoke test "debian" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/debian/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/debian/**' + - src/debian/** + - .github/workflows/smoke-debian.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -27,4 +26,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: debian + image: mcr.microsoft.com/devcontainers/base:dev-debian user: vscode diff --git a/.github/workflows/smoke-dotnet.yaml b/.github/workflows/smoke-dotnet.yaml index 245959952a..9ac3a05c0d 100644 --- a/.github/workflows/smoke-dotnet.yaml +++ b/.github/workflows/smoke-dotnet.yaml @@ -2,16 +2,15 @@ name: Smoke test "dotnet" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/dotnet/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/dotnet/**' + - src/dotnet/** + - .github/workflows/smoke-dotnet.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: dotnet + image: mcr.microsoft.com/devcontainers/dotnet:dev-6.0 user: vscode diff --git a/.github/workflows/smoke-go.yaml b/.github/workflows/smoke-go.yaml index ed4988a486..b4e227c256 100644 --- a/.github/workflows/smoke-go.yaml +++ b/.github/workflows/smoke-go.yaml @@ -2,16 +2,15 @@ name: Smoke test "go" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/go/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/go/**' + - src/go/** + - .github/workflows/smoke-go.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: go + image: mcr.microsoft.com/devcontainers/go:dev-1 user: vscode diff --git a/.github/workflows/smoke-java.yaml b/.github/workflows/smoke-java.yaml index 9d45283a95..0d7af8d8a9 100644 --- a/.github/workflows/smoke-java.yaml +++ b/.github/workflows/smoke-java.yaml @@ -2,16 +2,15 @@ name: Smoke test "java" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/java/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/java/**' + - src/java/** + - .github/workflows/smoke-java.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: java + image: mcr.microsoft.com/devcontainers/java:dev-17 user: vscode diff --git a/.github/workflows/smoke-jekyll.yaml b/.github/workflows/smoke-jekyll.yaml index c57e882532..2221ccff28 100644 --- a/.github/workflows/smoke-jekyll.yaml +++ b/.github/workflows/smoke-jekyll.yaml @@ -2,16 +2,15 @@ name: Smoke test "jekyll" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/jekyll/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/jekyll/**' + - src/jekyll/** + - .github/workflows/smoke-jekyll.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -27,4 +26,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: jekyll + image: mcr.microsoft.com/devcontainers/jekyll:dev-bullseye user: vscode diff --git a/.github/workflows/smoke-miniconda.yaml b/.github/workflows/smoke-miniconda.yaml index 154237c3f6..223067e9b3 100644 --- a/.github/workflows/smoke-miniconda.yaml +++ b/.github/workflows/smoke-miniconda.yaml @@ -2,16 +2,15 @@ name: Smoke test "miniconda" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/miniconda/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/miniconda/**' + - src/miniconda/** + - .github/workflows/smoke-miniconda.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: miniconda + image: mcr.microsoft.com/devcontainers/miniconda:dev-3 user: vscode diff --git a/.github/workflows/smoke-php.yaml b/.github/workflows/smoke-php.yaml index e7aaf239da..6c07d94991 100644 --- a/.github/workflows/smoke-php.yaml +++ b/.github/workflows/smoke-php.yaml @@ -2,16 +2,15 @@ name: Smoke test "php" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/php/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/php/**' + - src/php/** + - .github/workflows/smoke-php.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: php + image: mcr.microsoft.com/devcontainers/php:dev-8 user: vscode diff --git a/.github/workflows/smoke-python.yaml b/.github/workflows/smoke-python.yaml index 4c1c866db0..f0b46b277b 100644 --- a/.github/workflows/smoke-python.yaml +++ b/.github/workflows/smoke-python.yaml @@ -2,16 +2,15 @@ name: Smoke test "python" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/python/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/python/**' + - src/python/** + - .github/workflows/smoke-python.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,5 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: python - image: python + image: mcr.microsoft.com/devcontainers/python:dev-3 user: vscode diff --git a/.github/workflows/smoke-ruby.yaml b/.github/workflows/smoke-ruby.yaml index 13ae76f3a4..ba739e916b 100644 --- a/.github/workflows/smoke-ruby.yaml +++ b/.github/workflows/smoke-ruby.yaml @@ -2,16 +2,15 @@ name: Smoke test "ruby" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/ruby/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/ruby/**' + - src/ruby/** + - .github/workflows/smoke-ruby.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: ruby + image: mcr.microsoft.com/devcontainers/ruby:dev-3 user: vscode diff --git a/.github/workflows/smoke-rust.yaml b/.github/workflows/smoke-rust.yaml index 3b7f8feb6c..2a16e299d7 100644 --- a/.github/workflows/smoke-rust.yaml +++ b/.github/workflows/smoke-rust.yaml @@ -2,16 +2,15 @@ name: Smoke test "rust" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/rust/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/rust/**' + - src/rust/** + - .github/workflows/smoke-rust.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: rust + image: mcr.microsoft.com/devcontainers/rust:dev-bullseye user: vscode diff --git a/.github/workflows/smoke-ubuntu.yaml b/.github/workflows/smoke-ubuntu.yaml index cd3eaf1eaa..731d439cbe 100644 --- a/.github/workflows/smoke-ubuntu.yaml +++ b/.github/workflows/smoke-ubuntu.yaml @@ -2,16 +2,15 @@ name: Smoke test "ubuntu" build on: workflow_dispatch: - push: - branches: [main] - paths: - - 'src/ubuntu/**' - pull_request: branches: - - main + - main + pull_request: paths: - - 'src/ubuntu/**' + - src/ubuntu/** + - .github/workflows/smoke-ubuntu.yaml + - .github/actions/** + - build/** jobs: smoke-test: name: Smoke test @@ -29,4 +28,5 @@ jobs: uses: ./.github/actions/smoke-test with: definition: ubuntu + image: mcr.microsoft.com/devcontainers/base:dev-ubuntu user: vscode diff --git a/.github/workflows/version-history.yml b/.github/workflows/version-history.yml index 9318b70431..abef8410f3 100644 --- a/.github/workflows/version-history.yml +++ b/.github/workflows/version-history.yml @@ -8,7 +8,7 @@ on: required: true default: 'main' cg: - description: 'Generate cgmanifest.json' + description: 'Generate manifest.json' required: true default: 'false' push: @@ -75,7 +75,7 @@ jobs: cp -r "$GITHUB_WORKSPACE/ref/build" "$GITHUB_WORKSPACE/release/" yarn install - # Pull images and update cgmanifest.json, but output back to ref + # Pull images and update manifest.json, but output back to ref build/vscdc info --no-build \ --markdown \ --prune \ diff --git a/build/.vscode/settings.json b/build/.vscode/settings.json index c344465b39..0b83fd6f5a 100644 --- a/build/.vscode/settings.json +++ b/build/.vscode/settings.json @@ -3,7 +3,7 @@ "cSpell.words": [ "Distro", "Dockerfiles", - "cgmanifest", + "manifest", "copyfiles", "devcontainer", "devcontainers", diff --git a/build/README.md b/build/README.md index 7b1173b4a1..ef20cb495f 100644 --- a/build/README.md +++ b/build/README.md @@ -8,7 +8,7 @@ The Node.js based build CLI (`build/vsdc`) has commands to: 1. Build and push to a repository: `build/vsdc push` 2. Build, push, and npm package assets that are modified as described above: `build/vsdc package` -3. Generate cgmanifest.json and history markdown files: `build/vsdc cg`, `build/vsdc info` +3. Generate manifest.json and history markdown files: `build/vsdc cg`, `build/vsdc info` 4. Update all script source URLs in Dockerfiles to a tag or branch: `build/vsdc update-script-sources` 5. Overwrite scripts in the `.devcontainer/library-scripts` folder with the most recent copy from the `scripts-library` folder: `build/vscdc copy-library-scripts` @@ -16,11 +16,11 @@ Run with the `--help` option to see inputs. This CLI is used in the GitHub Actions workflows in this repository. -- `push-dev.yml`: Pushes a "dev" tag for each image to be generated in this repository and fires repository dispatch to trigger cgmanifest.json generation, and attaches an npm package with the definitions to the actions run. +- `push-dev.yml`: Pushes a "dev" tag for each image to be generated in this repository and fires repository dispatch to trigger manifest.json generation, and attaches an npm package with the definitions to the actions run. - `push-and-package.yml`: Triggers when a release tag is pushed (`vX.Y.Z`). Builds and pushes a release version of the images, creates a release, and attaches an npm package with the definitions to the release. Note that this update the tag with source files that contain a SHA hash for script sources. You may need to run `git fetch --tags --force` locally after it runs. - `push-again.yml`: A manually triggered workflow that can be used to push an updated version of an image for an existing release. This should only be used in cases where the image push to the registry only partially succeeded (e.g. `linux/amd64` was pushed, but a connection error happened when pushing `linux/arm64` for the same image.) - `smoke-*.yaml` (using the `smoke-test` action in this repository) - Runs a build without pushing and executes `test-project/test.sh` (if present) inside the container to verify that there are no breaking changes to the image when the repository contents are updated. -- `version-history.yml`: Listens for workflow dispatch events to trigger cgmanifest.json and history markdown generation. +- `version-history.yml`: Listens for workflow dispatch events to trigger manifest.json and history markdown generation. ## Setting up a container to be built @@ -58,7 +58,7 @@ Once you have your build configuration setup, you can use the `vscdc` CLI to tes docker run -it --init --privileged --rm mcr.microsoft.com/devcontainers/:dev- bash ``` -3. Finally, test cgmanifest/markdown generation by running: +3. Finally, test manifest/markdown generation by running: ```bash build/vscdc cg --registry mcr.microsoft.com --registry-path devcontainers --release main @@ -381,7 +381,7 @@ Following this is a list of libraries installed in the image by its Dockerfile. #### `dependencies.apt`, `dependencies.apk` -These two properties are arrays of either strings or objects that reference apt or apk package names. Given most installed packages are there simply for visibility because they come with the distro, these are not tracked in `cgmanifest.json` by default. When something comes from a 3rd party repository, the object syntax can be used to set `"cgIgnore": false`. An `annotation` property can also be used to for a description that should appear in history markdown files. +These two properties are arrays of either strings or objects that reference apt or apk package names. Given most installed packages are there simply for visibility because they come with the distro, these are not tracked in `manifest.json` by default. When something comes from a 3rd party repository, the object syntax can be used to set `"cgIgnore": false`. An `annotation` property can also be used to for a description that should appear in history markdown files. For example: diff --git a/build/src/image-info.js b/build/src/image-info.js index e7682edb41..22d5f1ded3 100644 --- a/build/src/image-info.js +++ b/build/src/image-info.js @@ -12,19 +12,19 @@ let releaseNotesHeaderTemplate, releaseNotesVariantPartTemplate; handlebars.registerHelper('anchor', (value) => value.toLowerCase().replace(/[^\w\- ]/g, '').replace(/ /g, '-')); async function generateImageInformationFiles(repo, release, registry, registryPath, - stubRegistry, stubRegistryPath, buildFirst, pruneBetweenDefinitions, generateCgManifest, generateMarkdown, overwrite, outputPath, definitionId) { + stubRegistry, stubRegistryPath, buildFirst, pruneBetweenDefinitions, generateManifest, generateMarkdown, overwrite, outputPath, definitionId) { // Load config files await configUtils.loadConfig(); const alreadyRegistered = {}; - const cgManifest = { + const manifest = { "Registrations": [], "Version": 1 } - // cgmanifest file path and whether it exists - const cgManifestPath = path.join(outputPath, 'cgmanifest.json'); - const cgManifestExists = await asyncUtils.exists(cgManifestPath); + // manifest file path and whether it exists + const manifestPath = path.join(outputPath, 'manifest.json'); + const manifestExists = await asyncUtils.exists(manifestPath); console.log('(*) Generating image information files...'); const definitions = definitionId ? [definitionId] : configUtils.getSortedDefinitionBuildList(); @@ -39,7 +39,7 @@ async function generateImageInformationFiles(repo, release, registry, registryPa // Skip if not overwriting and all files exist if(! overwrite && (! generateMarkdown || markdownExists) && - (! generateCgManifest || cgManifestExists)) { + (! generateManifest || manifestExists)) { console.log(`(*) Skipping ${currentDefinitionId}. Not in overwrite mode and content already exists.`); return; } @@ -55,8 +55,8 @@ async function generateImageInformationFiles(repo, release, registry, registryPa } // Add component registrations if we're using them - if (generateCgManifest) { - cgManifest.Registrations = cgManifest.Registrations.concat(definitionInfo.registrations); + if (generateManifest) { + manifest.Registrations = manifest.Registrations.concat(definitionInfo.registrations); } // Prune images if setting enabled if (pruneBetweenDefinitions) { @@ -64,12 +64,12 @@ async function generateImageInformationFiles(repo, release, registry, registryPa } }); - // Write final cgmanifest.json file if needed - if(generateCgManifest && (overwrite || ! cgManifestExists)) { - console.log('(*) Writing cgmanifest.json...'); + // Write final manifest.json file if needed + if(generateManifest && (overwrite || ! manifestExists)) { + console.log('(*) Writing manifest.json...'); await asyncUtils.writeFile( - path.join(outputPath, 'cgmanifest.json'), - JSON.stringify(cgManifest, undefined, 4)); + path.join(outputPath, 'manifest.json'), + JSON.stringify(manifest, undefined, 4)); } console.log('(*) Done!'); } diff --git a/build/src/utils/image-content-extractor.js b/build/src/utils/image-content-extractor.js index 336966bf2c..97ca775b42 100644 --- a/build/src/utils/image-content-extractor.js +++ b/build/src/utils/image-content-extractor.js @@ -179,7 +179,7 @@ async function getLinuxPackageInfo(imageTagOrContainerName, packageList, linuxDi return componentList; } -// Gets a package pool URL out of a download URL - Needed for registering in cgmanifest.json +// Gets a package pool URL out of a download URL - Needed for registering in manifest.json function getPoolUrlFromPackageVersionListOutput(packageUriCommandOutput, config, package, version) { // Handle regex reserved charters in regex strings and that ":" is treaded as "1%3a" on Debian/Ubuntu const sanitizedPackage = package.replace(/\+/g, '\\+').replace(/\./g, '\\.'); @@ -429,10 +429,14 @@ async function getGemPackageInfo(imageTagOrContainerName, packageList) { const gemListOutput = await getCommandOutputFromContainer(imageTagOrContainerName, "bash -l -c 'set -e && gem list -d --local' 2>/dev/null"); return packageList.map((gem) => { const gemVersionCaptureGroup = new RegExp(`^${gem}\\s\\(([^\\),]+)`,'m').exec(gemListOutput); - const gemVersion = gemVersionCaptureGroup[1]; - return { - name: gem, - version: gemVersion + if (gemVersionCaptureGroup !== null && gemVersionCaptureGroup[1] !== null) { + const gemVersion = gemVersionCaptureGroup[1]; + return { + name: gem, + version: gemVersion + } + } else { + return {}; } }); } @@ -501,7 +505,7 @@ async function getGoPackageInfo(imageTagOrContainerName, packages) { console.log(`(*) Gathering information about go modules and packages...`); const componentList = []; - const packageInstallOutput = await getCommandOutputFromContainer(imageTagOrContainerName, "cat /usr/local/etc/devcontainers/go.log"); + const packageInstallOutput = await getCommandOutputFromContainer(imageTagOrContainerName, "cat /usr/local/etc/vscode-dev-containers/go.log"); for(let package in packages) { if (typeof package === 'string') { const versionCommand = packages[package]; diff --git a/build/vscdc b/build/vscdc index 1013610c60..8f986723fa 100755 --- a/build/vscdc +++ b/build/vscdc @@ -142,7 +142,7 @@ require('yargs') } }) }, pushCommand) - .command('cg [devcontainer]', 'generate cgmanifest.json', (yargs) => { + .command('cg [devcontainer]', 'generate manifest.json', (yargs) => { yargs .positional('devcontainer', { describe: 'limits manifest generation to single definition', @@ -186,7 +186,7 @@ require('yargs') default: false }, 'cg': { - describe: 'whether to generate cgmanifest.json', + describe: 'whether to generate manifest.json', type: 'boolean', default: true }, @@ -200,7 +200,7 @@ require('yargs') default: path.resolve(__dirname, '..', configUtils.getConfig('informationFileOutputPath', '.')) }, 'overwrite': { - describe: 'whether to overwrite cgmanifest.json or markdown files', + describe: 'whether to overwrite manifest.json or markdown files', type: 'boolean', default: true } @@ -245,7 +245,7 @@ require('yargs') default: true }, 'cg': { - describe: 'whether to generate cgmanifest.json', + describe: 'whether to generate manifest.json', type: 'boolean', default: false }, @@ -264,7 +264,7 @@ require('yargs') default: path.resolve(__dirname, '..', configUtils.getConfig('informationFileOutputPath', '.')) }, 'overwrite': { - describe: 'whether to overwrite cgmanifest.json or markdown files', + describe: 'whether to overwrite manifest.json or markdown files', type: 'boolean', default: false } diff --git a/cgmanifest.json b/manifest.json similarity index 100% rename from cgmanifest.json rename to manifest.json diff --git a/src/codespaces/local-features/jekyll/install.sh b/src/codespaces/local-features/jekyll/install.sh index 29f402472e..8e06d30e42 100644 --- a/src/codespaces/local-features/jekyll/install.sh +++ b/src/codespaces/local-features/jekyll/install.sh @@ -53,9 +53,9 @@ fi if ! jekyll --version > /dev/null ; then echo "Installing Jekyll..." if [ "${VERSION}" = "latest" ]; then - PATH="/usr/local/rvm/rubies/default/bin:${PATH}" /usr/local/rvm/rubies/default/bin/gem install jekyll + gem install jekyll else - PATH="/usr/local/rvm/rubies/default/bin:${PATH}" /usr/local/rvm/rubies/default/bin/gem install jekyll -v "${VERSION}" + gem install jekyll -v "${VERSION}" fi fi diff --git a/src/codespaces/manifest.json b/src/codespaces/manifest.json index a2d316f8e2..d90a537d74 100644 --- a/src/codespaces/manifest.json +++ b/src/codespaces/manifest.json @@ -10,7 +10,7 @@ ] }, "dependencies": { - "annotation": "This document describes the base contents of the default GitHub Codespaces dev container image. Note that this image also includes detection logic to dynamically install additional language / runtime versions based on your repository's contents. Dynamically installed content can be found in sub-folders under `/opt`.", + "annotation": "This document describes the base contents of the default GitHub Codespaces dev container image. Note that this image also includes detection logic to dynamically install additional language / runtime versions based on your repository's contents. Dynamically installed content can be found in sub-folders under `/usr/local`.", "image": "mcr.microsoft.com/oryx/build:vso-focal-20210728.1", "imageLink": "https://github.com/microsoft/oryx", "apt": [{ @@ -83,8 +83,8 @@ ], "git": { "Oh My Zsh!": "/home/codespace/.oh-my-zsh", - "nvm": "/home/codespace/.nvm", - "nvs": "/home/codespace/.nvs", + "nvm": "/usr/local/share/nvm", + "nvs": "/usr/local/nvs", "rbenv": "/usr/local/share/rbenv", "ruby-build": "/usr/local/share/ruby-build" }, @@ -106,14 +106,14 @@ }, "other": { "git": { - "path": "/usr/local" + "path": "/usr/bin" }, "Xdebug": { - "path": "/opt/php/lts" + "path": "/usr/local/php/current" }, "Composer": { "cgIgnore": true, - "path": "/opt/php-composer" + "path": "/usr/local/php/current/bin" }, "kubectl": null, "Helm": null, @@ -123,13 +123,16 @@ "GitHub CLI": null, "yarn": { "cgIgnore": true, - "path": "/opt/yarn" + "path": "/usr/bin" }, "Maven": { "cgIgnore": true, - "path": "/opt/maven" + "path": "/usr/local/sdkman/candidates/maven/current/bin" + }, + "Gradle": { + "cgIgnore": true, + "path": "/usr/local/sdkman/candidates/gradle/current/bin" }, - "Gradle": null, "Docker (Moby) CLI & Engine": { "cgIgnore": true } @@ -137,33 +140,33 @@ "languages": { "Node.js": { "cgIgnore": true, - "versionCommand": "ls /opt/nodejs | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", - "path": "/opt/nodejs/<version>" + "versionCommand": "ls /usr/local/share/nvm/versions/node | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", + "path": "/usr/local/share/nvm/versions/node/<version>" }, "Python": { "cgIgnore": true, - "versionCommand": "ls /opt/python | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", - "path": "/opt/python/<version>" + "versionCommand": "ls /usr/local/python | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", + "path": "/usr/local/python/<version>" }, "Java": { "cgIgnore": true, - "versionCommand": "ls /opt/java | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", - "path": "/opt/java/<version>" + "versionCommand": "ls /usr/local/sdkman/candidates/java | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", + "path": "/usr/local/sdkman/candidates/java/<version>" }, ".NET": { "cgIgnore": true, - "versionCommand": "ls /opt/dotnet | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", - "path": "/home/codespaces/.dotnet
/opt/dotnet" + "versionCommand": "ls /usr/local/dotnet | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", + "path": "/usr/local/dotnet" }, "Ruby": { "cgIgnore": true, - "versionCommand": "ls /opt/ruby | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", - "path": "/opt/ruby/<version>" + "versionCommand": "ls /usr/local/rvm/rubies | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", + "path": "/usr/local/rvm/rubies/<version>" }, "PHP": { "cgIgnore": true, - "versionCommand": "ls /opt/php | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", - "path": "/opt/php/<version>" + "versionCommand": "ls /usr/local/php | grep -oE '[0-9]+\\.[0-9]+\\.[0-9]+'", + "path": "/usr/local/php/<version>" }, "GCC": { "cgIgnore": true diff --git a/src/codespaces/test-project/test.sh b/src/codespaces/test-project/test.sh index fa01859ff6..6f4f5984f4 100755 --- a/src/codespaces/test-project/test.sh +++ b/src/codespaces/test-project/test.sh @@ -9,15 +9,6 @@ checkCommon # Check Oryx check "oryx" oryx --version -# Check Jekyll dynamic install -mkdir jekyll-test -cd jekyll-test -touch _config.yml -check "oryx-build-jekyll" oryx build --apptype static-sites --manifest-dir /tmp -check "jekyll" gem list jekyll -cd .. -rm -rf jekyll-test - # Check .NET check "dotnet" dotnet --list-sdks check "oryx-install-dotnet-2.1" oryx prep --skip-detection --platforms-and-versions dotnet=2.1.12 diff --git a/src/miniconda/Dockerfile b/src/miniconda/Dockerfile index 118a21975d..4868edfce4 100644 --- a/src/miniconda/Dockerfile +++ b/src/miniconda/Dockerfile @@ -11,7 +11,6 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-bullseye COPY --from=upstream /opt /opt/ # Copy library scripts to execute -# COPY .devcontainer/library-scripts/*.sh .devcontainer/add-notice.sh .devcontainer/library-scripts/*.env /tmp/library-scripts/ COPY add-notice.sh /tmp/library-scripts/ # Setup conda to mirror contents from https://github.com/ContinuumIO/docker-images/blob/master/miniconda3/debian/Dockerfile @@ -45,7 +44,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # Copy environment.yml (if found) to a temp locaition so we update the environment. Also # copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists. -# COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/ COPY environment.yml* noop.txt /tmp/conda-tmp/ RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \ && rm -rf /tmp/conda-tmp