diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index c84c91441806..3cff9b735b5e 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -69,6 +69,9 @@ jobs: timeoutInMinutes: 2880 variables: PLATFORM_ARCH: arm64 + stepProperties: + retryCountOnTaskFailure: 2 + - name: generic variables: @@ -83,6 +86,8 @@ jobs: timeoutInMinutes: 2880 variables: PLATFORM_ARCH: armhf + stepProperties: + retryCountOnTaskFailure: 2 - name: mellanox variables: @@ -131,5 +136,6 @@ jobs: fi make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin fi + retryCountOnTaskFailure: 0 displayName: "Build sonic image" - template: check-dirty-version.yml diff --git a/.azure-pipelines/azure-pipelines-image-template.yml b/.azure-pipelines/azure-pipelines-image-template.yml index 7f2874024740..56f98106d465 100644 --- a/.azure-pipelines/azure-pipelines-image-template.yml +++ b/.azure-pipelines/azure-pipelines-image-template.yml @@ -36,6 +36,7 @@ jobs: displayName: "Set cache options" - checkout: self submodules: recursive + retryCountOnTaskFailure: 1 condition: eq(variables.SKIP_CHECKOUT, '') displayName: 'Checkout code' - script: | @@ -46,6 +47,7 @@ jobs: sudo apt-get install -y acl sudo bash -c "echo 1 > /proc/sys/vm/compact_memory" ENABLE_DOCKER_BASE_PULL=y make PLATFORM=$(PLATFORM_AZP) PLATFORM_ARCH=$(PLATFORM_ARCH) $(BUILD_OPTIONS) configure + retryCountOnTaskFailure: 0 displayName: 'Make configure' postSteps: - script: cp target -r $(Build.ArtifactStagingDirectory)/ diff --git a/.azure-pipelines/azure-pipelines-job-groups.yml b/.azure-pipelines/azure-pipelines-job-groups.yml index 021185ccf520..5fb7eb47d04f 100644 --- a/.azure-pipelines/azure-pipelines-job-groups.yml +++ b/.azure-pipelines/azure-pipelines-job-groups.yml @@ -29,7 +29,7 @@ jobs: - ${{ if or(eq(parameters.jobFilters, ''), containsValue(parameters.jobFilters, jobGroup.name), endswith(variables['Build.DefinitionName'], format('.{0}{1}', jobGroup.name, jobGroup.extName))) }}: - job: ${{ replace(format('{0}{1}', jobGroup.name, jobGroup.extName), '-', '_') }} ${{ each pair in jobGroup }}: - ${{ if not(in(pair.key, 'job', 'name', 'extName', 'variables', 'steps', 'script', 'scriptEnv')) }}: + ${{ if not(in(pair.key, 'job', 'name', 'extName', 'variables', 'steps', 'script', 'scriptEnv', 'stepProperties')) }}: ${{ pair.key }}: ${{ pair.value }} ${{ if eq(jobGroup.timeoutInMinutes, '') }}: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} @@ -43,15 +43,20 @@ jobs: ${{ if eq(jobGroup.variables[para.key], '') }}: ${{ para.key }}: ${{ para.value }} steps: - - ${{ parameters.preSteps }} - - ${{ if ne(jobGroup.script, '') }}: - - script: | - ${{ jobGroup.script }} - env: - ${{ if ne(parameters.scriptEnv, '') }}: - ${{ parameters.scriptEnv }} - displayName: 'JobScript' - - ${{ if ne(jobGroup.steps, '') }}: - - ${{ jobGroup.steps }} - - ${{ parameters.buildSteps }} - - ${{ parameters.postSteps }} + - template: azure-pipelines-update-step-properties.yml + parameters: + ${{ if ne(jobGroup.stepProperties, '') }}: + properties: ${{ jobGroup.stepProperties }} + steps: + - ${{ parameters.preSteps }} + - ${{ if ne(jobGroup.script, '') }}: + - script: | + ${{ jobGroup.script }} + env: + ${{ if ne(parameters.scriptEnv, '') }}: + ${{ parameters.scriptEnv }} + displayName: 'JobScript' + - ${{ if ne(jobGroup.steps, '') }}: + - ${{ jobGroup.steps }} + - ${{ parameters.buildSteps }} + - ${{ parameters.postSteps }} diff --git a/.azure-pipelines/azure-pipelines-update-step-properties.yml b/.azure-pipelines/azure-pipelines-update-step-properties.yml new file mode 100644 index 000000000000..b4b33db0537e --- /dev/null +++ b/.azure-pipelines/azure-pipelines-update-step-properties.yml @@ -0,0 +1,14 @@ +parameters: +- name: 'properties' + type: object + default: {} +- name: 'steps' + type: stepList + default: [] +steps: +- ${{ each step in parameters.steps }}: + - ${{ each pair in step }}: + ${{ if ne(parameters.properties[pair.key], '') }}: + ${{ pair.key }}: ${{ parameters.properties[pair.key] }} + ${{ else }}: + ${{ pair.key }}: ${{ pair.value }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 27836a49b1ab..c962c78773d3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -72,6 +72,8 @@ stages: timeoutInMinutes: 1200 variables: PLATFORM_ARCH: armhf + stepProperties: + retryCountOnTaskFailure: 2 - stage: Test dependsOn: BuildVS