From 280082acffda6860c044bd3272cccc9f0cb67a48 Mon Sep 17 00:00:00 2001 From: Sachin Holla Date: Fri, 11 Aug 2023 16:16:11 +0530 Subject: [PATCH] Azp: install sonic yangs during pipline build * Download & install sonic_yang_models.whl before telemetry build. Translib will start using these sonic yangs during build * Download source code and artifacts for the build branch only * Use pipeline 142 for downloading sonic-buildimage.vs artifacts, which runs on all branches --- azure-pipelines.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5cdae841..e2b7151d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,16 +17,25 @@ pr: - 202??? - 201??? +variables: + - name: BUILD_BRANCH + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: $(System.PullRequest.TargetBranch) + ${{ else }}: + value: $(Build.SourceBranchName) + resources: repositories: - repository: sonic-mgmt-common type: github name: sonic-net/sonic-mgmt-common endpoint: sonic-net + ref: refs/heads/$(BUILD_BRANCH) - repository: sonic-swss-common type: github name: sonic-net/sonic-swss-common endpoint: sonic-net + ref: refs/heads/$(BUILD_BRANCH) stages: - stage: Build @@ -66,25 +75,16 @@ stages: inputs: source: specific project: build - pipeline: 1 + pipeline: 142 artifact: sonic-buildimage.vs runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' patterns: | target/debs/bullseye/libyang*.deb target/debs/bullseye/libnl*.deb + target/python-wheels/bullseye/sonic_yang_models*.whl displayName: "Download bullseye debs" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 127 - artifact: sonic-mgmt-common - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic-mgmt-common" - - script: | # PYTEST sudo pip3 install -U pytest @@ -101,6 +101,10 @@ stages: sudo dpkg -i ../target/debs/bullseye/libyang*1.0.73*.deb displayName: "Install dependency" + - script: | + sudo pip3 install ../target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl + displayName: "Install sonic yangs" + - script: | # LIBSWSSCOMMON sudo apt-get -y purge libnl-3-dev libnl-route-3-dev @@ -126,7 +130,7 @@ stages: pipeline: Azure.sonic-swss-common artifact: sonic-swss-common runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' + runBranch: 'refs/heads/$(BUILD_BRANCH)' displayName: "Download sonic-swss-common" - script: |