Skip to content

Commit b176ee4

Browse files
committed
Install sonic yangs during pipeline build
* Download & install sonic_yang_models.whl before build * Download source code and artifacts for the build branch only * Download from pipeline 142, which runs on all branches
1 parent dfac87c commit b176ee4

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

azure-pipelines.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,28 @@ trigger:
77
branches:
88
include:
99
- master
10+
- 202???
1011

1112
pr:
1213
branches:
1314
include:
1415
- master
16+
- 202???
17+
18+
variables:
19+
- name: BUILD_BRANCH
20+
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
21+
value: $(System.PullRequest.TargetBranch)
22+
${{ else }}:
23+
value: $(Build.SourceBranchName)
1524

1625
resources:
1726
repositories:
1827
- repository: sonic-mgmt-common
1928
type: github
2029
name: sonic-net/sonic-mgmt-common
2130
endpoint: sonic-net
31+
ref: refs/heads/$(BUILD_BRANCH)
2232

2333
stages:
2434
- stage: Build
@@ -42,18 +52,19 @@ stages:
4252
- checkout: sonic-mgmt-common
4353
clean: true
4454
submodules: recursive
45-
displayName: 'Checkout code'
55+
displayName: 'Checkout sonic-mgmt-common'
4656

4757
- task: DownloadPipelineArtifact@2
4858
inputs:
4959
source: specific
5060
project: build
51-
pipeline: 1
61+
pipeline: 142
5262
artifact: sonic-buildimage.vs
5363
runVersion: 'latestFromBranch'
54-
runBranch: 'refs/heads/master'
64+
runBranch: 'refs/heads/$(BUILD_BRANCH)'
5565
patterns: |
5666
target/debs/buster/libyang*.deb
67+
target/python-wheels/bullseye/sonic_yang_models*.whl
5768
displayName: "Download sonic buildimage"
5869

5970
- script: |
@@ -80,18 +91,21 @@ stages:
8091
[[ ! -f python3_requirements.txt ]] || \
8192
sudo pip3 install --no-cache-dir -r python3_requirements.txt
8293
83-
popd
94+
displayName: "Install dependency"
95+
96+
- script: |
97+
sudo pip3 install ../target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl
98+
displayName: "Install sonic yangs"
8499
100+
- script: |
101+
set -ex
85102
pushd sonic-mgmt-common
86103
87104
NO_TEST_BINS=1 dpkg-buildpackage -rfakeroot -b -us -uc -j$(nproc)
88-
89-
displayName: "Install dependency"
105+
displayName: "Build sonic-mgmt-common"
90106
91107
- script: |
92108
set -ex
93-
ls -l
94-
95109
pushd sonic-mgmt-framework
96110
97111
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc) && cp ../*.deb $(Build.ArtifactStagingDirectory)/

0 commit comments

Comments
 (0)