[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
This commit is contained in:
xumia 2022-03-08 10:15:52 +08:00 committed by xumia
parent f94ce408c6
commit d75c569ef0

View File

@ -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: <VERSION>-sai-<sai-ver>-<distribution>-<COMMIT HASH>
# The <sai-ver> 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