diff --git a/.azure-pipelines/build-docker-sonic-vs-template.yml b/.azure-pipelines/build-docker-sonic-vs-template.yml index 97e8afb39439..b0a6562d3ae6 100644 --- a/.azure-pipelines/build-docker-sonic-vs-template.yml +++ b/.azure-pipelines/build-docker-sonic-vs-template.yml @@ -39,7 +39,7 @@ jobs: pipeline: 9 artifact: ${{ parameters.swss_common_artifact_name }} runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' displayName: "Download sonic swss common deb packages" - task: DownloadPipelineArtifact@2 inputs: @@ -48,7 +48,7 @@ jobs: pipeline: 12 artifact: ${{ parameters.sairedis_artifact_name }} runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' displayName: "Download sonic sairedis deb packages" - task: DownloadPipelineArtifact@2 inputs: @@ -61,13 +61,12 @@ jobs: pipeline: 1 artifact: sonic-buildimage.vs runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' displayName: "Download sonic buildimage" - script: | echo $(Build.DefinitionName).$(Build.BuildNumber) docker load < ../target/docker-sonic-vs.gz - mkdir -p .azure-pipelines/docker-sonic-vs/debs cp -v ../*.deb .azure-pipelines/docker-sonic-vs/debs diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 632bdb3107c2..f6690731b241 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -54,7 +54,7 @@ jobs: pool: ${{ if ne(parameters.pool, 'default') }}: name: ${{ parameters.pool }} - ${{ if eq(parameters.pool, 'default') }}: + ${{ else }}: vmImage: 'ubuntu-20.04' container: @@ -82,7 +82,7 @@ jobs: pipeline: 9 artifact: ${{ parameters.swss_common_artifact_name }} runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' path: '$(Build.SourcesDirectory)/${{ parameters.swss_common_artifact_name }}' displayName: "Download sonic swss common deb packages" - task: DownloadPipelineArtifact@2 @@ -92,7 +92,7 @@ jobs: pipeline: 12 artifact: ${{ parameters.sairedis_artifact_name }} runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' path: '$(Build.SourcesDirectory)/${{ parameters.sairedis_artifact_name }}' displayName: "Download sonic sairedis deb packages" - task: DownloadPipelineArtifact@2 @@ -104,7 +104,7 @@ jobs: pipeline: ${{ parameters.buildimage_pipeline }} artifact: ${{ parameters.buildimage_artifact_name }} runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' path: '$(Build.SourcesDirectory)/${{ parameters.buildimage_artifact_name }}' displayName: "Download sonic buildimage deb packages" - script: | diff --git a/.azure-pipelines/test-docker-sonic-vs-template.yml b/.azure-pipelines/test-docker-sonic-vs-template.yml index 7b1b3c4163f2..2ba42d458b01 100644 --- a/.azure-pipelines/test-docker-sonic-vs-template.yml +++ b/.azure-pipelines/test-docker-sonic-vs-template.yml @@ -40,7 +40,7 @@ jobs: pipeline: 9 artifact: sonic-swss-common.amd64.ubuntu20_04 runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' displayName: "Download sonic swss common deb packages" - script: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9bc567b67d11..8dda0580f686 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,6 +27,13 @@ schedules: - 201??? always: true +variables: + - name: BUILD_BRANCH + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: $(System.PullRequest.TargetBranch) + ${{ else }}: + value: $(Build.SourceBranchName) + stages: - stage: Build