From 7bbb40e701be37b565ec727e74f29373fa03182d Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Tue, 31 May 2022 08:53:55 +0000 Subject: [PATCH 1/3] Add azure-pipelines extension to dev container --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 919ce73a..03627368 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -30,7 +30,8 @@ "davidanson.vscode-markdownlint", "heaths.vscode-guid", "esbenp.prettier-vscode", - "meganrogge.template-string-converter" + "meganrogge.template-string-converter", + "ms-azure-devops.azure-pipelines" ], "features": { "github-cli": "latest" From fe4f3222aa37178e2642976b4fe2af861faff5f6 Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Tue, 31 May 2022 08:54:03 +0000 Subject: [PATCH 2/3] Add run-args test to AzDO --- .azure-devops/azure-pipelines.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.azure-devops/azure-pipelines.yml b/.azure-devops/azure-pipelines.yml index 451731e3..8ca62fbc 100644 --- a/.azure-devops/azure-pipelines.yml +++ b/.azure-devops/azure-pipelines.yml @@ -26,4 +26,31 @@ jobs: runCmd: 'echo $PWD' subFolder: '.' env: '' - imageTag: $(IMAGE_TAG) \ No newline at end of file + imageTag: $(IMAGE_TAG) + sourceBranchFilterForPush: '' + + - job: test_run_args + displayName: Test run-args + 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) + + - task: DevContainerBuildRun@0 + inputs: + imageName: '$(ACR_NAME).azurecr.io/stuartleeks/azdo-devcontainer-build-run/test/run-args' + subFolder: github-tests/run-args + runCmd: echo $HOSTNAME && [[ $HOSTNAME == "my-host" ]] + env: '' + imageTag: $(IMAGE_TAG) + sourceBranchFilterForPush: '' + From 321754d406075d18cbccd4ad3e7b0c1c61ff3fde Mon Sep 17 00:00:00 2001 From: Stuart Leeks Date: Tue, 31 May 2022 09:50:55 +0000 Subject: [PATCH 3/3] Add more tests --- .azure-devops/azure-pipelines.yml | 76 +++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/.azure-devops/azure-pipelines.yml b/.azure-devops/azure-pipelines.yml index 8ca62fbc..e33c9d5a 100644 --- a/.azure-devops/azure-pipelines.yml +++ b/.azure-devops/azure-pipelines.yml @@ -54,3 +54,79 @@ jobs: imageTag: $(IMAGE_TAG) sourceBranchFilterForPush: '' + - job: test_build_args + displayName: Test build-args + 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) + + - task: DevContainerBuildRun@0 + inputs: + imageName: '$(ACR_NAME).azurecr.io/stuartleeks/azdo-devcontainer-build-run/test/build-args' + subFolder: github-tests/build-args + runCmd: echo $BUILD_ARG_TEST && [[ $BUILD_ARG_TEST == "Hello build-args!" ]] + env: '' + imageTag: $(IMAGE_TAG) + sourceBranchFilterForPush: '' + + - job: test_dockerfile_context + displayName: Test Dockerfile context + 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) + + - task: DevContainerBuildRun@0 + inputs: + imageName: '$(ACR_NAME).azurecr.io/stuartleeks/azdo-devcontainer-build-run/test/dockerfile-context' + subFolder: github-tests/dockerfile-context + runCmd: /tmp/dummy.sh + env: '' + imageTag: $(IMAGE_TAG) + sourceBranchFilterForPush: '' + + - job: test_feature_docker_from_docker + displayName: Test docker-from-docker using feature + 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) + + - task: DevContainerBuildRun@0 + inputs: + imageName: '$(ACR_NAME).azurecr.io/stuartleeks/azdo-devcontainer-build-run/test/feature-docker-from-docker' + subFolder: github-tests/feature-docker-from-docker + runCmd: make docker-build + env: '' + imageTag: $(IMAGE_TAG) + sourceBranchFilterForPush: '' + +