From 507c6ff43181900a3e9672e30f7c4bbe1b16875e Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Wed, 12 Aug 2020 15:59:44 -0700 Subject: [PATCH] empty string? --- .azure-pipelines/release.yml | 3 ++- .../templates/jobs/packaging-jobs.yml | 11 ++++++--- .../templates/stages/deploy-stage.yml | 24 +++---------------- .../stages/test-and-package-stage.yml | 7 ++++++ 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/release.yml index b00d4be78..4e22de326 100644 --- a/.azure-pipelines/release.yml +++ b/.azure-pipelines/release.yml @@ -8,9 +8,10 @@ pr: none stages: - template: templates/stages/test-and-package-stage.yml + parameters: + dockerTag: ${{variables['Build.SourceBranchName']}} - template: templates/stages/changelog-stage.yml - template: templates/stages/deploy-stage.yml parameters: snapReleaseChannel: beta - dockerTag: ${{variables['Build.SourceBranchName']}} - template: templates/stages/notify-failure-stage.yml diff --git a/.azure-pipelines/templates/jobs/packaging-jobs.yml b/.azure-pipelines/templates/jobs/packaging-jobs.yml index 7e1baf341..799888c59 100644 --- a/.azure-pipelines/templates/jobs/packaging-jobs.yml +++ b/.azure-pipelines/templates/jobs/packaging-jobs.yml @@ -1,12 +1,17 @@ +parameters: +- name: dockerTag + type: string + jobs: + # If this job name is changed, the value of builtDockerTag in the deploy + # stage needs to be updated. - job: docker_build pool: vmImage: ubuntu-18.04 steps: - bash: | - docker images - tools/docker/build.sh nightly - docker images + tools/docker/build.sh ${{ parameters.dockerTag }} + echo "##vso[task.setvariable variable=builtDockerTag;isOutput=true]${{ parameters.dockerTag }}" displayName: Build the Docker images - job: installer_build pool: diff --git a/.azure-pipelines/templates/stages/deploy-stage.yml b/.azure-pipelines/templates/stages/deploy-stage.yml index 8fc1ff4c6..1a65a1c3b 100644 --- a/.azure-pipelines/templates/stages/deploy-stage.yml +++ b/.azure-pipelines/templates/stages/deploy-stage.yml @@ -5,9 +5,6 @@ parameters: values: - edge - beta -- name: dockerTag - type: string - default: nightly stages: - stage: Deploy @@ -65,23 +62,8 @@ stages: - job: publish_docker pool: vmImage: ubuntu-18.04 + variables: + builtDockerTag: $[ stageDependencies.TestAndPackage.docker_build.outputs['foo.bar'] ] steps: - - task: Docker@2 - inputs: - command: login - # The credentials used here are for the shared certbotbot account - # on Docker Hub. The credentials are stored in a service account - # which was created by following the instructions at - # https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#sep-docreg. - # The name given to this service account must match the value - # given to containerRegistry below. "Grant access to all - # pipelines" should also be checked. To revoke these - # credentials, we can change the password on the certbotbot - # Docker Hub account or remove the account from the - # Certbot organization on Docker Hub. - containerRegistry: docker-hub - displayName: Login to Docker Hub - - bash: tools/docker/build.sh ${{ parameters.dockerTag }} - displayName: Build the Docker images - - bash: tools/docker/deploy.sh ${{ parameters.dockerTag }} + - bash: echo $(builtDockerTag) displayName: Deploy the Docker images diff --git a/.azure-pipelines/templates/stages/test-and-package-stage.yml b/.azure-pipelines/templates/stages/test-and-package-stage.yml index 26010644d..f5749efb6 100644 --- a/.azure-pipelines/templates/stages/test-and-package-stage.yml +++ b/.azure-pipelines/templates/stages/test-and-package-stage.yml @@ -1,4 +1,11 @@ +parameters: +- name: dockerTag + type: string + default: nightly + stages: + # If this stage name is changed, the value of builtDockerTag in the deploy + # stage needs to be updated. - stage: TestAndPackage jobs: - template: ../jobs/standard-tests-jobs.yml