Skip to content

Commit

Permalink
[ci] Use correct branch when downloading artifact. (sonic-net#2292)
Browse files Browse the repository at this point in the history
  • Loading branch information
liushilongbuaa authored May 26, 2022
1 parent 2f13244 commit d7b5ff7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .azure-pipelines/build-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
7 changes: 7 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d7b5ff7

Please sign in to comment.