From 14921e39d1ec077d7c2ce9f8eb3853e6f6c68afc Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Tue, 8 Mar 2022 10:15:52 +0800 Subject: [PATCH] [Build][Ci]: Support to use the cisco sai packages built by azp (#10102) Why I did it Support to use the cisco sai packages built by azp --- .../official-build-cisco-8000.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.azure-pipelines/official-build-cisco-8000.yml b/.azure-pipelines/official-build-cisco-8000.yml index aeec64a848..61b6b03171 100644 --- a/.azure-pipelines/official-build-cisco-8000.yml +++ b/.azure-pipelines/official-build-cisco-8000.yml @@ -22,6 +22,11 @@ resources: name: Cisco-8000-sonic/platform-cisco-8000 endpoint: cisco-connection +variables: +- group: SONIC-AKV-STROAGE-1 +- name: StorageSASKey + value: $(sonicstorage-SasToken) + stages: - stage: Build pool: sonic @@ -29,6 +34,7 @@ stages: CACHE_MODE: wcache SKIP_CHECKOUT: true TERM: '' + PACKAGE_URL: "https://sonicstorage.blob.core.windows.net/packages" jobs: - template: azure-pipelines-build.yml @@ -60,5 +66,29 @@ stages: make PLATFORM=cisco-8000 platform/cisco-8000 tar xfz $(System.ArtifactsDirectory)/artifactory-*.tar.gz -C platform/cisco-8000 displayName: 'Setup cisco artifacts' + - script: | + set -ex + filename=$(find platform/cisco-8000/artifactory/sonic -name cisco-* -type f | head -n 1) + if [ -z "$filename" ]; then + echo "Cisco sai package not found" 1>&2 + exit 1 + fi + cd $(dirname $filename) + echo "PWD=$(pwd)" + ls -l *.deb + while read -r package; do + # Cisco version format: -sai--- + # The may contain several values in one build, the part is skipped when publishing to storage + # See https://github.com/Cisco-8000-sonic/sdk/blob/master/azure-pipelines.yml + # The $PACKAGE_URL is only accessible for AZP + version=$(echo $package | awk -F_ '{print $(NF-1)}' | cut -d- -f1,2,4,5) + package_url="$PACKAGE_URL/sai/ciscosai/master/$version/$package" + echo "Override package $package from $package_url" + wget "$package_url$StorageSASKey" -O "$package" + done < <(ls *.deb) + env: + StorageSASKey: $(StorageSASKey) + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: "Override cisco sai packages" jobGroups: - name: cisco-8000