-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate image and dotnet tool publish to 1es pipelines #7920
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# Additional sample inputs can be found in `eng/containers/ci.yml`, but here is an example. | ||
# - name: test_proxy_linux | ||
# dockerRepo: 'engsys/testproxy-lin' | ||
# prepareScript: tools/test-proxy/docker/prepare.ps1 | ||
# excludeFromManifest: true/false | ||
# configPath: 'tools/test-proxy/docker' | ||
# stableTags: | ||
# - 'latest' | ||
|
||
# A "ManifestDeployment" is a secondary deployment that can be used to map multiple docker tags to a single platform-sensitive one. It waits until | ||
# all previous tag deployments are created, then triggers a manifest upload that bundles all tags configured in DockerDeployments. To exclude an item from the | ||
# manifest upload, set deployment config property excludeFromManifest to true. | ||
# - name: test_proxy_manifest | ||
# dockerRepo: 'engsys/testproxy' | ||
# stableTags: | ||
# - 'latest' | ||
parameters: | ||
- name: DockerDeployments | ||
type: object | ||
default: [] | ||
- name: ManifestDeployment | ||
type: object | ||
default: [] | ||
- name: ImageTag | ||
type: string | ||
- name: ContainerRegistry | ||
type: string | ||
default: 'azsdkengsys' | ||
- name: Publish | ||
type: boolean | ||
default: true | ||
|
||
stages: | ||
- stage: | ||
displayName: Build/Publish Containers | ||
variables: | ||
- template: /eng/pipelines/templates/variables/globals.yml | ||
- template: /eng/pipelines/templates/variables/image.yml | ||
jobs: | ||
- ${{ each config in parameters.DockerDeployments }}: | ||
- job: container_build_${{ config.name }} | ||
displayName: Build ${{ config.name }} Image | ||
pool: | ||
name: $(LINUXPOOL) | ||
image: $(LINUXVMIMAGE) | ||
os: linux | ||
|
||
${{ if parameters.Publish }}: | ||
templateContext: | ||
outputs: | ||
- output: containerImage | ||
displayName: Push ${{ config.name }}:${{ parameters.ImageTag }} | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) | ||
image: ${{ parameters.ContainerRegistry }}.azurecr.io/${{ config.dockerRepo }}:${{ parameters.ImageTag }} | ||
- ${{ if config.stableTags }}: | ||
- ${{ each stableTag in config.stableTags }}: | ||
- output: containerImage | ||
displayName: Push ${{ config.name }}:${{ stableTag }} | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) | ||
image: ${{ parameters.ContainerRegistry }}.azurecr.io/${{ config.dockerRepo }}:${{ stableTag }} | ||
|
||
steps: | ||
- ${{ if config.prepareScript }}: | ||
- pwsh: | | ||
./${{ config.prepareScript }} | ||
displayName: "Run prep script" | ||
- task: 1ES.BuildContainerImage@1 | ||
displayName: Build ${{ config.name }}:${{ parameters.ImageTag }} | ||
inputs: | ||
image: ${{ parameters.ContainerRegistry }}.azurecr.io/${{ config.dockerRepo }}:${{ parameters.ImageTag }} | ||
path: ${{ config.configPath }} | ||
enableNetwork: true | ||
useBuildKit: true | ||
- ${{ if config.stableTags }}: | ||
- ${{ each stableTag in config.stableTags }}: | ||
- task: 1ES.BuildContainerImage@1 | ||
displayName: Build ${{ config.name }}:${{ stableTag }} | ||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) | ||
inputs: | ||
image: ${{ parameters.ContainerRegistry }}.azurecr.io/${{ config.dockerRepo }}:${{ stableTag }} | ||
path: ${{ config.configPath }} | ||
enableNetwork: true | ||
useBuildKit: true | ||
|
||
- ${{ if and(parameters.ManifestDeployment, parameters.Publish) }}: | ||
- ${{ each deployment in parameters.ManifestDeployment }}: | ||
- job: container_build_${{ deployment.name }} | ||
displayName: Build ${{ deployment.name }} Manifest | ||
${{ if gt(length(parameters.DockerDeployments), 0) }}: | ||
dependsOn: | ||
- ${{ each config in parameters.DockerDeployments }}: | ||
- container_build_${{ config.name }} | ||
pool: | ||
name: $(LINUXPOOL) | ||
image: $(LINUXVMIMAGE) | ||
os: linux | ||
|
||
steps: | ||
- pwsh: | | ||
$configurations = '${{ convertToJson(parameters.DockerDeployments) }}' -replace '\\', '/' | ||
$assembledDependentTags = $(Build.SourcesDirectory)/eng/pipelines/templates/scripts/get-docker-manifest-input.ps1 ` | ||
-DockerDeploymentJson $configurations ` | ||
-ContainerRegistry "${{ parameters.ContainerRegistry }}" ` | ||
-ImageTag "${{ parameters.ImageTag }}" ` | ||
|
||
Write-Host "##vso[task.setvariable variable=ManifestVariable]$assembledDependentTags" | ||
displayName: Generate Manifest Variable | ||
|
||
- pwsh: | | ||
docker manifest create ${{ parameters.ContainerRegistry }}.azurecr.io/${{ deployment.dockerRepo }}:${{ parameters.ImageTag }} $(ManifestVariable) | ||
displayName: Generate Manifest | ||
|
||
- pwsh: | | ||
docker manifest push ${{ parameters.ContainerRegistry }}.azurecr.io/${{ deployment.dockerRepo }}:${{ parameters.ImageTag }} | ||
displayName: Upload Manifest | ||
|
||
- ${{ if deployment.stableTags }}: | ||
- ${{ each stableTag in deployment.stableTags }}: | ||
- pwsh: | | ||
$configurations = '${{ convertToJson(parameters.DockerDeployments) }}' -replace '\\', '/' | ||
$assembledDependentTags = $(Build.SourcesDirectory)/eng/pipelines/templates/scripts/get-docker-manifest-input.ps1 ` | ||
-DockerDeploymentJson $configurations ` | ||
-ContainerRegistry "${{ parameters.ContainerRegistry }}" ` | ||
-ImageTag "${{ stableTag }}" ` | ||
|
||
Write-Host "##vso[task.setvariable variable=ManifestVariable]$assembledDependentTags" | ||
displayName: Generate Manifest Variable | ||
|
||
- pwsh: | | ||
docker manifest create ${{ parameters.ContainerRegistry }}.azurecr.io/${{ deployment.dockerRepo }}:${{ stableTag }} $(ManifestVariable) | ||
displayName: Generate Manifest | ||
|
||
- pwsh: | | ||
docker manifest push ${{ parameters.ContainerRegistry }}.azurecr.io/${{ deployment.dockerRepo }}:${{ stableTag }} | ||
displayName: Upload Manifest |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI though test-proxy/docker is gone now 👍