forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): Fix publishing of public docker images during releases of se…
…rver pipelines (microsoft#22593) ## Description The stage that publishes the public versions of docker images for the server components is currently broken ([example](https://dev.azure.com/fluidframework/internal/_build/results?buildId=273242&view=logs&s=2ff3421f-f27a-5211-cd8c-afeb9905f8f6), msft internal). The problem is that `$(containerTag)` is not getting replaced with a real value. This PR adjusts the server pipelines to address the issue. I'm pretty confident the problem started [when we started using the 1ES pipeline templates](microsoft#19382). Before that, [the build-docker-service.yml template had variables at the root of the file](https://github.com/seanimam/FluidFramework/blob/f14abf74bd4474275b0ba0553728e543c13e06f3/tools/pipelines/templates/build-docker-service.yml#L100), so all stages in that file had access to them. When we moved to 1ES pipeline templates, those variables moved to be specified in the build stage and the publish stages lost access to them, which results in the `$(containerTag)` variable that the publish stage is trying to use to not getting replaced by ADO. Changes in this PR: - Remove the `include-publish-docker-service.yml` template (and CI/PR triggers off it) which is pretty redundant, only importing another file with no special logic. - Introduces a new template `include-vars-docker.yml` that defines the variables which are relevant to pipelines that produce docker images. Almost a line-by-line copy of the variables that used to be in the build stage of `build-docker-service.yml`, with a few adjustments: - `tagNameOnReleaseImage` was removed from the list of variables and its logic is now inlined (and simplified) in the `publish_docker_official` stage of `build-docker-service.yml`. - Removed the bit that set `latestContainerTag` in the case of the `next` branch, since we don't have a `next` branch anymore. - The new template is now used in both the build stage and the `publish_docker_official` (the one that fails today). No other stages seem to need the new variables. - Fix a small typo `1 -> i`
- Loading branch information
Showing
8 changed files
with
82 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
tools/pipelines/templates/include-publish-docker-service.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (c) Microsoft Corporation and contributors. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
# common variables for pipelines that produce docker images | ||
|
||
parameters: | ||
# Name for the container image. | ||
- name: containerName | ||
type: string | ||
|
||
# Whether the docker image should be pushed to our internal Azure Container Registry. | ||
- name: shouldPushDockerImage | ||
type: boolean | ||
default: false | ||
|
||
# If the build is running for a test branch | ||
- name: testBuild | ||
type: boolean | ||
default: false | ||
|
||
variables: | ||
- name: buildContainerName | ||
${{ if eq(parameters.testBuild, true) }}: | ||
value: test/${{ parameters.containerName }} | ||
${{ else }}: | ||
value: build/${{ parameters.containerName }} | ||
- name: containerTagSuffix | ||
value: $[ format('0.0.{0}', variables['Build.BuildNumber']) ] | ||
- name: baseContainerTag | ||
value: base:$(containerTagSuffix) | ||
# If docker images will be pushed, we need a variable where they are prefixed with the container registry URL. | ||
# $(containerRegistryUrl) comes from the container-registry-info variable group and needs to be | ||
# specified as a runtime variable (variables from variable groups apparently are never available "statically" | ||
# at parse/compile time, so can't be used with template-expression syntax ( '${{ }}' )). | ||
- ${{ if eq(parameters.shouldPushDockerImage, true) }}: | ||
- name: containerTag | ||
value: $(containerRegistryUrl)/$(buildContainerName):$(containerTagSuffix) | ||
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: | ||
- name: latestContainerTag | ||
value: $(containerRegistryUrl)/$(buildContainerName):latest | ||
- ${{ else }}: | ||
# In this case we just want latestContainerTag defined so it gets replaced by ADO and Bash tasks don't | ||
# complain about "command 'latestContainerTag' not found". | ||
- name: latestContainerTag | ||
value: '' | ||
- ${{ else }}: | ||
- name: containerTag | ||
value: $(buildContainerName):$(containerTagSuffix) |