diff options
author | 2019-09-20 22:20:28 -0700 | |
---|---|---|
committer | 2019-09-20 22:20:28 -0700 | |
commit | 9aada1907c364438f466f447962df48b06824c14 (patch) | |
tree | e53cb3f117d7c06fa34bb8655eaa168f86f9be46 | |
parent | Revert "CI: use script instead of Docker task to push images" (diff) |
Revert "CI: ditch Docker v2 tasks"
This reverts commit 25fb9bebf815f305e8cd569c5bbe79425b44597d.
-rw-r--r-- | azure-pipelines.yml | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4f60a7e..f09dc99 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,32 +15,35 @@ jobs: scriptPath: scripts/check_dockerfiles.sh # Without a login the following Docker build tasks won't add image tags. - - task: Docker@1 + - task: Docker@2 displayName: 'Log into Docker Hub' inputs: command: login - containerregistrytype: 'Container Registry' - dockerRegistryEndpoint: 'DockerHub' + containerRegistry: DockerHubV2 # The venv image depends on this image. Build it if it can't be pulled # from Docker Hub, which will be the case if the base Dockerfile has had # changes. - - script: | - docker build \ - -f docker/base.Dockerfile \ - -t pythondiscord/snekbox-base:latest \ - . + - task: Docker@2 displayName: 'Build Base Image' condition: and(succeeded(), ne(variables['check.BASE_PULL'], True)) + inputs: + command: build + repository: pythondiscord/snekbox-base + tags: latest + Dockerfile: docker/base.Dockerfile + buildContext: . # The dev image is never pushed and therefore is always built. - - script: | - docker build \ - -f docker/venv.Dockerfile \ - -t pythondiscord/snekbox-venv:dev \ - --build-arg DEV=1 \ - . + - task: Docker@2 displayName: 'Build Development Image' + inputs: + command: build + repository: pythondiscord/snekbox-venv + tags: dev + Dockerfile: docker/venv.Dockerfile + buildContext: . + arguments: --build-arg DEV=1 # The linter and all tests run inside this container. - script: | @@ -124,21 +127,16 @@ jobs: BASE_PULL: $[ coalesce(dependencies.test.outputs['check.BASE_PULL'], False) ] steps: - - task: Docker@1 + - task: Docker@2 displayName: 'Log into Docker Hub' inputs: command: login - containerregistrytype: 'Container Registry' - dockerRegistryEndpoint: 'DockerHub' + containerRegistry: DockerHubV2 # Because this is the base image for the venv image, if the venv needs to # be built, this base image must also be present. Build it if it has # changed or can't be pulled from Docker Hub. - - script: | - docker build \ - -f docker/base.Dockerfile \ - -t pythondiscord/snekbox-base:latest \ - . + - task: Docker@2 displayName: 'Build Base Image' condition: > and( @@ -149,13 +147,15 @@ jobs: eq(variables.VENV_CHANGED, True) ) ) + inputs: + command: build + repository: pythondiscord/snekbox-base + tags: latest + Dockerfile: docker/base.Dockerfile + buildContext: . # Also build this image if base has changed - even if this image hasn't. - - script: | - docker build \ - -f docker/venv.Dockerfile \ - -t pythondiscord/snekbox-venv:latest \ - . + - task: Docker@2 displayName: 'Build Virtual Environment Image' condition: > and( @@ -165,15 +165,23 @@ jobs: eq(variables.VENV_CHANGED, True) ) ) + inputs: + command: build + repository: pythondiscord/snekbox-venv + tags: latest + Dockerfile: docker/venv.Dockerfile + buildContext: . # Always build this image unless it's for a pull request. - - script: | - docker build \ - -f docker/Dockerfile \ - -t pythondiscord/snekbox:latest \ - . + - task: Docker@2 displayName: 'Build Final Image' condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + inputs: + command: build + repository: pythondiscord/snekbox + tags: latest + Dockerfile: docker/Dockerfile + buildContext: . # Push images only after they've all successfully been built. # These have the same conditions as the build tasks. However, for safety, |