diff --git a/.azure-devops/azure-pipelines.yml b/.azure-devops/azure-pipelines.yml index 16aa52efa..368f9f6a0 100644 --- a/.azure-devops/azure-pipelines.yml +++ b/.azure-devops/azure-pipelines.yml @@ -172,39 +172,51 @@ jobs: inputs: subFolder: github-tests/Dockerfile/build-only - # Temporarily commented out: https://github.com/devcontainers/ci/issues/198 - # - job: test_platform_with_runcmd - # displayName: Test with platform and runCmd - # steps: - # - script: | - # docker login -u $ACR_USERNAME -p $ACR_TOKEN $(ACR_NAME).azurecr.io - # displayName: 'Log in to Azure Container Registry' - # env: - # ACR_NAME: $(ACR_NAME) - # ACR_TOKEN: $(ACR_TOKEN) - # ACR_USERNAME: $(ACR_USERNAME) - - # - script: | - # printenv | sort - # env: - # IMAGE_TAG: $(IMAGE_TAG) - - # - script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - # displayName: Set up QEMU - - # - script: docker buildx create --use - # displayName: Set up docker buildx - - # - task: DevcontainersCi@0 - # inputs: - # imageName: '$(ACR_NAME).azurecr.io/devcontainers-ci/azdo-devcontainer-build-run/test/platform-with-runcmd' - # subFolder: github-tests/Dockerfile/platform-with-runcmd - # platform: linux/amd64,linux/arm64 - # runCmd: echo $HOSTNAME && [[ $HOSTNAME == "my-host" ]] - - # - script: | - # echo "'runCmdOutput' value: $runCmdOutput" - # if [["$runCmdOutput" = *my-host*]]; then - # echo "'runCmdOutput' output of test_simple job doesn't contain expected value 'my-host'" - # exit 1 - # fi \ No newline at end of file + - job: test_platform_with_runcmd + displayName: Test with platform and runCmd + steps: + - script: | + docker login -u $ACR_USERNAME -p $ACR_TOKEN $(ACR_NAME).azurecr.io + displayName: 'Log in to Azure Container Registry' + env: + ACR_NAME: $(ACR_NAME) + ACR_TOKEN: $(ACR_TOKEN) + ACR_USERNAME: $(ACR_USERNAME) + + - script: | + printenv | sort + env: + IMAGE_TAG: $(IMAGE_TAG) + + - script: | + sudo apt purge buildah golang-github-containers-common podman skopeo + sudo apt autoremove --purge + REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable" + source /etc/os-release + sudo sh -c "echo 'deb ${REPO_URL}/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" + sudo wget -qnv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key + sudo apt-key add Release.key + sudo apt-get update + sudo apt-get install skopeo + displayName: Update skopeo + + + - script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + displayName: Set up QEMU + + - script: docker buildx create --use + displayName: Set up docker buildx + + - task: DevcontainersCi@0 + inputs: + imageName: '$(ACR_NAME).azurecr.io/devcontainers-ci/azdo-devcontainer-build-run/test/platform-with-runcmd' + subFolder: github-tests/Dockerfile/platform-with-runcmd + platform: linux/amd64,linux/arm64 + runCmd: echo $HOSTNAME && [[ $HOSTNAME == "my-host" ]] + + - script: | + echo "'runCmdOutput' value: $runCmdOutput" + if [["$runCmdOutput" = *my-host*]]; then + echo "'runCmdOutput' output of test_simple job doesn't contain expected value 'my-host'" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/ci_common.yml b/.github/workflows/ci_common.yml index fa3a570c1..d860e9252 100644 --- a/.github/workflows/ci_common.yml +++ b/.github/workflows/ci_common.yml @@ -921,6 +921,20 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + # This can be omitted once runner images have a version of Skopeo > 1.4.1 + # See https://github.com/containers/skopeo/issues/1874 (and https://github.com/devcontainers/ci/issues/191#issuecomment-1416384710) + - name: Update skopeo + run: | + sudo apt purge buildah golang-github-containers-common podman skopeo + sudo apt autoremove --purge + REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable" + source /etc/os-release + sudo sh -c "echo 'deb ${REPO_URL}/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" + sudo wget -qnv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key + sudo apt-key add Release.key + sudo apt-get update + sudo apt-get install skopeo + - name: Login to GitHub Container Registry uses: docker/login-action@v2 if: ${{ needs.build.outputs.image_push_option == 'filter' }} @@ -946,8 +960,7 @@ jobs: imageName: ghcr.io/devcontainers/ci/tests/platform-with-runcmd platform: linux/amd64,linux/arm64 runCmd: echo $HOSTNAME && [[ $HOSTNAME == "my-host" ]] - push: never # Temporarily suppress push: https://github.com/devcontainers/ci/issues/198 - # push: ${{ needs.build.outputs.image_push_option }} + push: ${{ needs.build.outputs.image_push_option }} eventFilterForPush: | push pull_request diff --git a/github-tests/Dockerfile/platform-with-runcmd/.devcontainer/Dockerfile b/github-tests/Dockerfile/platform-with-runcmd/.devcontainer/Dockerfile index e3de188fd..0d1a2fd14 100644 --- a/github-tests/Dockerfile/platform-with-runcmd/.devcontainer/Dockerfile +++ b/github-tests/Dockerfile/platform-with-runcmd/.devcontainer/Dockerfile @@ -10,6 +10,16 @@ ENV DEBIAN_FRONTEND=noninteractive # Set env for tracking that we're running in a devcontainer ENV DEVCONTAINER=true +USER root + +# Configure apt, install packages and general tools +RUN sudo apt-get update \ + && sudo apt-get -y install --no-install-recommends apt-utils dialog nano bash-completion sudo bsdmainutils \ + # + # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed + && sudo apt-get -y install git iproute2 procps lsb-release figlet build-essential + + # This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" # property in devcontainer.json to use it. On Linux, the container user's GID/UIDs # will be updated to match your local UID/GID (when using the dockerFile property). @@ -23,12 +33,6 @@ RUN \ mkdir -p ~/.local/bin \ && echo "export PATH=\$PATH:~/.local/bin" >> ~/.bashrc -# Configure apt, install packages and general tools -RUN sudo apt-get update \ - && sudo apt-get -y install --no-install-recommends apt-utils dialog nano bash-completion sudo bsdmainutils \ - # - # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed - && sudo apt-get -y install git iproute2 procps lsb-release figlet build-essential # Save command line history RUN echo "export HISTFILE=/home/$USERNAME/commandhistory/.bash_history" >> "/home/$USERNAME/.bashrc" \