|
| 1 | +trigger: |
| 2 | + batch: true |
| 3 | + branches: |
| 4 | + include: |
| 5 | + - main |
| 6 | + - stable-* |
| 7 | + tags: |
| 8 | + include: |
| 9 | + - '*' |
| 10 | + |
| 11 | +pr: |
| 12 | + branches: |
| 13 | + include: |
| 14 | + - main |
| 15 | + - stable-* |
| 16 | + |
| 17 | +pool: |
| 18 | + vmImage: 'ubuntu-20.04' |
| 19 | + |
| 20 | +variables: |
| 21 | + container_name: "quay.io/ansible/$(System.TeamProject)" |
| 22 | + scratchpad_tag: "quay.io/ansible/scratchpad:$(System.TeamProject)-$(Build.SourceBranchName)-$(Build.BuildId)" |
| 23 | + python_version: '3.10' |
| 24 | + containmint_version: '0.2.0' |
| 25 | + ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: |
| 26 | + push_or_no_login: --push |
| 27 | + ${{ else }}: |
| 28 | + push_or_no_login: --no-login |
| 29 | + |
| 30 | +stages: |
| 31 | + - stage: Build |
| 32 | + dependsOn: [] |
| 33 | + jobs: |
| 34 | + - job: Arch |
| 35 | + steps: |
| 36 | + - task: UsePythonVersion@0 |
| 37 | + inputs: |
| 38 | + versionSpec: '$(python_version)' |
| 39 | + displayName: Use Python |
| 40 | + - script: pip install containmint==$(containmint_version) --disable-pip-version-check --user |
| 41 | + displayName: Install containmint |
| 42 | + - script: > |
| 43 | + containmint build |
| 44 | + --tag "$(scratchpad_tag)-$(System.JobName)" |
| 45 | + --arch "$(System.JobName)" |
| 46 | + $(push_or_no_login) |
| 47 | + displayName: Build |
| 48 | + env: |
| 49 | + CONTAINMINT_PASSWORD: $(CONTAINMINT_PASSWORD) |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + x86_64: {} |
| 53 | + aarch64: {} |
| 54 | + |
| 55 | + - stage: Deploy |
| 56 | + dependsOn: Build |
| 57 | + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) |
| 58 | + jobs: |
| 59 | + - job: Image |
| 60 | + steps: |
| 61 | + - task: UsePythonVersion@0 |
| 62 | + inputs: |
| 63 | + versionSpec: '$(python_version)' |
| 64 | + displayName: Use Python |
| 65 | + - script: pip install containmint==$(containmint_version) --disable-pip-version-check --user |
| 66 | + displayName: Install containmint |
| 67 | + - script: > |
| 68 | + containmint merge |
| 69 | + --push |
| 70 | + --tag "$(container_name):$(Build.SourceBranchName)" |
| 71 | + "$(scratchpad_tag)-x86_64" |
| 72 | + "$(scratchpad_tag)-aarch64" |
| 73 | + displayName: Merge |
| 74 | + env: |
| 75 | + CONTAINMINT_PASSWORD: $(CONTAINMINT_PASSWORD) |
0 commit comments