Split snap build over three Azure jobs (one per architecture) (#8731)

Fixes #8700

Now that `snapcraft remote-build` truly uses new builds for each call, we can split the builds to have a dedicated Azure job for each target architecture. This PR does that.

* Split snap_build job  on each architecture

* Also parallelize the publish_snap jobs over each architecture
This commit is contained in:
Adrien Ferrand
2021-03-25 14:38:34 -07:00
committed by GitHub
parent fa25d8356d
commit 018efc241c
2 changed files with 24 additions and 12 deletions
@@ -116,13 +116,17 @@ jobs:
- job: snaps_build - job: snaps_build
pool: pool:
vmImage: ubuntu-18.04 vmImage: ubuntu-18.04
timeoutInMinutes: 0 strategy:
variables: matrix:
amd64:
SNAP_ARCH: amd64
# Do not run the heavy non-amd64 builds for test branches # Do not run the heavy non-amd64 builds for test branches
${{ if not(startsWith(variables['Build.SourceBranchName'], 'test-')) }}: ${{ if not(startsWith(variables['Build.SourceBranchName'], 'test-')) }}:
ARCHS: amd64 arm64 armhf armhf:
${{ if startsWith(variables['Build.SourceBranchName'], 'test-') }}: SNAP_ARCH: armhf
ARCHS: amd64 arm64:
SNAP_ARCH: arm64
timeoutInMinutes: 0
steps: steps:
- script: | - script: |
set -e set -e
@@ -144,7 +148,7 @@ jobs:
git config --global user.name "$(Build.RequestedFor)" git config --global user.name "$(Build.RequestedFor)"
mkdir -p ~/.local/share/snapcraft/provider/launchpad mkdir -p ~/.local/share/snapcraft/provider/launchpad
cp $(credentials.secureFilePath) ~/.local/share/snapcraft/provider/launchpad/credentials cp $(credentials.secureFilePath) ~/.local/share/snapcraft/provider/launchpad/credentials
python3 tools/snap/build_remote.py ALL --archs ${ARCHS} --timeout 19800 python3 tools/snap/build_remote.py ALL --archs ${SNAP_ARCH} --timeout 19800
displayName: Build snaps displayName: Build snaps
- script: | - script: |
set -e set -e
@@ -154,7 +158,7 @@ jobs:
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
inputs: inputs:
path: $(Build.ArtifactStagingDirectory) path: $(Build.ArtifactStagingDirectory)
artifact: snaps artifact: snaps_$(SNAP_ARCH)
displayName: Store snaps artifacts displayName: Store snaps artifacts
- job: snap_run - job: snap_run
dependsOn: snaps_build dependsOn: snaps_build
@@ -175,12 +179,12 @@ jobs:
displayName: Install dependencies displayName: Install dependencies
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
artifact: snaps artifact: snaps_amd64
path: $(Build.SourcesDirectory)/snap path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps displayName: Retrieve Certbot snaps
- script: | - script: |
set -e set -e
sudo snap install --dangerous --classic snap/certbot_*_amd64.snap sudo snap install --dangerous --classic snap/certbot_*.snap
displayName: Install Certbot snap displayName: Install Certbot snap
- script: | - script: |
set -e set -e
@@ -202,7 +206,7 @@ jobs:
addToPath: true addToPath: true
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
artifact: snaps artifact: snaps_amd64
path: $(Build.SourcesDirectory)/snap path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps displayName: Retrieve Certbot snaps
- script: | - script: |
@@ -37,6 +37,14 @@ stages:
vmImage: ubuntu-18.04 vmImage: ubuntu-18.04
variables: variables:
- group: certbot-common - group: certbot-common
strategy:
matrix:
amd64:
SNAP_ARCH: amd64
arm32v6:
SNAP_ARCH: armhf
arm64v8:
SNAP_ARCH: arm64
steps: steps:
- bash: | - bash: |
set -e set -e
@@ -46,7 +54,7 @@ stages:
displayName: Install dependencies displayName: Install dependencies
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
artifact: snaps artifact: snaps_$(SNAP_ARCH)
path: $(Build.SourcesDirectory)/snap path: $(Build.SourcesDirectory)/snap
displayName: Retrieve Certbot snaps displayName: Retrieve Certbot snaps
- task: DownloadSecureFile@1 - task: DownloadSecureFile@1