Skip to content

Commit 24ba4de

Browse files
author
Jostar Yang
committed
Merge branch 'as4630-54pe_20210721_api2_202012br' of https://github.com/jostar-yang/sonic-buildimage into as4630-54pe_20210721_api2_202012br
2 parents 528cb79 + a42be08 commit 24ba4de

File tree

726 files changed

+33009
-7239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

726 files changed

+33009
-7239
lines changed

.azure-pipelines/azure-pipelines-UpgrateVersion.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ schedules:
1414
- 202012
1515
always: true
1616

17+
resources:
18+
repositories:
19+
- repository: buildimage
20+
type: github
21+
name: Azure/sonic-buildimage
22+
ref: master
23+
endpoint: build
24+
1725
pool: sonicbld
1826

1927
parameters:
@@ -28,6 +36,8 @@ parameters:
2836
- innovium
2937
- mellanox
3038
- nephos
39+
- centec-arm64
40+
- marvell-armhf
3141

3242
stages:
3343
- stage: Build
@@ -37,20 +47,10 @@ stages:
3747
jobs:
3848
- template: azure-pipelines-build.yml
3949
parameters:
40-
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
4150
jobFilters: ${{ parameters.jobFilters }}
51+
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
4252
preSteps:
43-
- script: |
44-
containers=$(docker container ls | grep "sonic-slave" | awk '{ print $1 }')
45-
if [ ! -z "$containers" ]; then
46-
docker container kill $containers || true
47-
sleep 5
48-
fi
49-
images=$(docker images 'sonic-slave-*' -a -q)
50-
if [ ! -z "$images" ]; then
51-
docker rmi -f $images
52-
fi
53-
displayName: 'Cleanup sonic slave'
53+
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
5454
- stage: UpgradeVersions
5555
jobs:
5656
- job: UpgradeVersions

.azure-pipelines/azure-pipelines-build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
platform_rpc: centec
6565

6666
- name: centec-arm64
67-
pool: sonicbld_8c
67+
pool: sonicbld-arm64
6868
timeoutInMinutes: 2880
6969
variables:
7070
PLATFORM_ARCH: arm64
@@ -78,7 +78,7 @@ jobs:
7878
dbg_image: yes
7979

8080
- name: marvell-armhf
81-
pool: sonicbld_8c
81+
pool: sonicbld-armhf
8282
timeoutInMinutes: 2880
8383
variables:
8484
PLATFORM_ARCH: armhf
@@ -101,13 +101,19 @@ jobs:
101101
set -ex
102102
if [ $(GROUP_NAME) == vs ]; then
103103
if [ $(dbg_image) == yes ]; then
104-
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz && mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz
104+
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz
105+
mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz
105106
fi
106107
make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
108+
if [ $(Build.Reason) != 'PullRequest' ];then
109+
gzip -kd target/sonic-vs.img.gz
110+
SONIC_RUN_CMDS="qemu-img convert target/sonic-vs.img -O vhdx -o subformat=dynamic target/sonic-vs.vhdx" make sonic-slave-run
111+
rm target/sonic-vs.img
112+
fi
107113
else
108114
if [ $(dbg_image) == yes ]; then
109-
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin && \
110-
mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin
115+
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin
116+
mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin
111117
fi
112118
if [ $(swi_image) == yes ]; then
113119
make $BUILD_OPTIONS ENABLE_IMAGE_SIGNATURE=y target/sonic-aboot-$(GROUP_NAME).swi
@@ -125,3 +131,4 @@ jobs:
125131
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
126132
fi
127133
displayName: "Build sonic image"
134+
- template: check-dirty-version.yml

.azure-pipelines/azure-pipelines-image-template.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ jobs:
2626
jobVariables: ${{ parameters.jobVariables }}
2727
preSteps:
2828
- template: cleanup.yml
29-
- ${{ parameters. preSteps }}
29+
- ${{ parameters.preSteps }}
3030
- script: |
31-
if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox)$"; then
31+
if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox|marvell-armhf)$"; then
3232
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=$(CACHE_MODE) SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/$(PLATFORM_AZP)"
3333
BUILD_OPTIONS="$(BUILD_OPTIONS) $CACHE_OPTIONS"
3434
echo "##vso[task.setvariable variable=BUILD_OPTIONS]$BUILD_OPTIONS"
3535
fi
3636
displayName: "Set cache options"
3737
- checkout: self
3838
submodules: recursive
39+
condition: eq(variables.SKIP_CHECKOUT, '')
3940
displayName: 'Checkout code'
4041
- script: |
4142
BRANCH_NAME=$(Build.SourceBranchName)

.azure-pipelines/build-commonlib.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pr: none
2+
trigger: none
3+
schedules:
4+
- cron: "0 0 * * *"
5+
displayName: Daily build
6+
branches:
7+
include:
8+
- master
9+
- 202???
10+
resources:
11+
repositories:
12+
- repository: buildimage
13+
type: github
14+
name: Azure/sonic-buildimage
15+
ref: master
16+
endpoint: build
17+
18+
jobs:
19+
- template: .azure-pipelines/template-commonlib.yml@buildimage
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
steps:
2+
- script: |
3+
. functions.sh
4+
SONIC_VERSION=$(sonic_get_version)
5+
echo "SONIC_VERSION=$SONIC_VERSION"
6+
if [[ "$SONIC_VERSION" == *dirty* ]]; then
7+
# Print the detail dirty info
8+
git status --untracked-files=no -s --ignore-submodules
9+
10+
# Exit with error, if it is a PR build
11+
if [ "$(Build.Reason)" == "PullRequest" ]; then
12+
echo "Build failed for the dirty version: $SONIC_VERSION" 1>&2
13+
exit 1
14+
fi
15+
fi
16+
displayName: "Check the dirty version"
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Starter pipeline
2+
# Start with a minimal pipeline that you can customize to build and deploy your code.
3+
# Add steps that build, run tests, deploy, and more:
4+
# https://aka.ms/yaml
5+
# Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64
6+
resources:
7+
repositories:
8+
- repository: buildimage
9+
type: github
10+
name: Azure/sonic-buildimage
11+
ref: master
12+
endpoint: build
13+
14+
parameters:
15+
- name: arch
16+
type: string
17+
values:
18+
- amd64
19+
- armhf
20+
- arm64
21+
- name: dist
22+
type: string
23+
values:
24+
- bullseye
25+
- buster
26+
- stretch
27+
- jessie
28+
- name: registry_url
29+
type: string
30+
default: sonicdev-microsoft.azurecr.io
31+
- name: registry_conn
32+
type: string
33+
default: sonicdev
34+
- name: pool
35+
type: string
36+
default: sonicbld
37+
values:
38+
- sonicbld
39+
- sonicbld-arm64
40+
- sonicbld-armhf
41+
42+
jobs:
43+
- job: Build_${{ parameters.dist }}_${{ parameters.arch }}
44+
timeoutInMinutes: 360
45+
pool: ${{ parameters.pool }}
46+
steps:
47+
- template: cleanup.yml
48+
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
49+
- checkout: self
50+
clean: true
51+
submodules: recursive
52+
- bash: |
53+
set -ex
54+
55+
SLAVE_DIR=sonic-slave-${{ parameters.dist }}
56+
if [ x${{ parameters.pool }} == x"sonicbld" ]; then
57+
if [ x${{ parameters.arch }} == x"amd64" ]; then
58+
SLAVE_BASE_IMAGE=${SLAVE_DIR}
59+
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}
60+
elif [ x${{ parameters.pool }} == x"sonicbld" ]; then
61+
SLAVE_BASE_IMAGE=${SLAVE_DIR}-march-${{ parameters.arch }}
62+
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-march-${{ parameters.arch }}
63+
fi
64+
elif [[ x${{ parameters.pool }} == x"sonicbld-armhf" && x${{ parameters.arch }} == x"armhf" ]]; then
65+
SLAVE_BASE_IMAGE=${SLAVE_DIR}
66+
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-armhf
67+
elif [[ x${{ parameters.pool }} == x"sonicbld-arm64" && x${{ parameters.arch }} == x"arm64" ]]; then
68+
SLAVE_BASE_IMAGE=${SLAVE_DIR}
69+
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-arm64
70+
else
71+
echo "do not support build ${{ parameters.arch }} on ${{ parameters.pool }}"
72+
exit 1
73+
fi
74+
75+
if [ x"$(Build.SourceBranchName)" == x"202012" ]; then
76+
BUILD_OPTIONS = 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
77+
fi
78+
79+
tmpfile=$(mktemp)
80+
81+
echo ${{ parameters.arch }} > .arch
82+
83+
DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} $(BUILD_OPTIONS) make -f Makefile.work sonic-slave-build | tee $tmpfile
84+
SLAVE_BASE_TAG=$(grep "^Checking sonic-slave-base image:" $tmpfile | awk -F ':' '{print $3}')
85+
SLAVE_TAG=$(grep "^Checking sonic-slave image:" $tmpfile | awk -F ':' '{print $3}')
86+
87+
mkdir -p target
88+
89+
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:latest
90+
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:$SLAVE_BASE_TAG
91+
set +x
92+
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_IMAGE]$SLAVE_BASE_IMAGE_UPLOAD"
93+
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_TAG]$SLAVE_BASE_TAG"
94+
env:
95+
REGISTRY_SERVER: ${{ parameters.registry_url }}
96+
displayName: Build sonic-slave-${{ parameters.dist }}-${{ parameters.arch }}
97+
98+
- task: Docker@2
99+
displayName: Upload image
100+
inputs:
101+
containerRegistry: ${{ parameters.registry_conn }}
102+
repository: $(VARIABLE_SLAVE_BASE_IMAGE)
103+
command: push
104+
tags: |
105+
$(VARIABLE_SLAVE_BASE_TAG)
106+
latest

.azure-pipelines/docker-sonic-slave.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pr:
2121
- sonic-slave-jessie
2222
- sonic-slave-stretch
2323
- sonic-slave-buster
24+
- src/sonic-build-hooks
2425

2526
parameters:
2627
- name: 'arches'
@@ -43,9 +44,9 @@ parameters:
4344
default: sonicdev
4445

4546
variables:
46-
- ${{ if and(startsWith(variables['Build.SourceBranchName'], '202'), eq(length(variables['Build.SourceBranchName']), 6)) }}:
47+
- ${{ if eq(variables['Build.SourceBranchName'], '202012') }}:
4748
- name: BUILD_OPTIONS
48-
value: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web'
49+
value: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
4950

5051
stages:
5152
- stage: Build
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Starter pipeline
2+
# Start with a minimal pipeline that you can customize to build and deploy your code.
3+
# Add steps that build, run tests, deploy, and more:
4+
# https://aka.ms/yaml
5+
6+
schedules:
7+
- cron: "0 8 * * *"
8+
displayName: Daily midnight build
9+
branches:
10+
include:
11+
- master
12+
- 202012
13+
always: true
14+
15+
trigger: none
16+
pr: none
17+
18+
resources:
19+
repositories:
20+
- repository: cisco-8000
21+
type: github
22+
name: Cisco-8000-sonic/platform-cisco-8000
23+
endpoint: cisco-connection
24+
25+
variables:
26+
- group: SONIC-AKV-STROAGE-1
27+
- name: StorageSASKey
28+
value: $(sonicstorage-SasToken)
29+
30+
stages:
31+
- stage: Build
32+
pool: sonic
33+
variables:
34+
CACHE_MODE: wcache
35+
SKIP_CHECKOUT: true
36+
TERM: ''
37+
PACKAGE_URL: "https://sonicstorage.blob.core.windows.net/packages"
38+
39+
jobs:
40+
- template: azure-pipelines-build.yml
41+
parameters:
42+
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
43+
preSteps:
44+
- checkout: self
45+
submodules: recursive
46+
path: s
47+
displayName: 'Checkout code'
48+
- checkout: cisco-8000
49+
submodules: recursive
50+
path: s/platform/cisco-8000
51+
displayName: 'Checkout cisco-8000'
52+
- script: |
53+
cisco_ref=$(cat platform/checkout/cisco-8000.ini | grep '^ref=' | cut -d= -f2)
54+
echo "The cisco 8000 release version is $cisco_ref"
55+
echo "##vso[task.setvariable variable=cisco.ref]$cisco_ref"
56+
displayName: 'Export cisco release version'
57+
- task: DownloadGitHubRelease@0
58+
inputs:
59+
connection: cisco-connection
60+
userRepository: Cisco-8000-sonic/platform-cisco-8000
61+
defaultVersionType: specificTag
62+
version: $(cisco.ref)
63+
itemPattern: 'artifactory-*.tar.gz'
64+
downloadPath: '$(System.ArtifactsDirectory)'
65+
- script: |
66+
make PLATFORM=cisco-8000 platform/cisco-8000
67+
tar xfz $(System.ArtifactsDirectory)/artifactory-*.tar.gz -C platform/cisco-8000
68+
displayName: 'Setup cisco artifacts'
69+
- script: |
70+
set -ex
71+
filename=$(find platform/cisco-8000/artifactory/sonic -name cisco-* -type f | head -n 1)
72+
if [ -z "$filename" ]; then
73+
echo "Cisco sai package not found" 1>&2
74+
exit 1
75+
fi
76+
cd $(dirname $filename)
77+
echo "PWD=$(pwd)"
78+
ls -l *.deb
79+
while read -r package; do
80+
# Cisco version format: <VERSION>-sai-<sai-ver>-<distribution>-<COMMIT HASH>
81+
# The <sai-ver> may contain several values in one build, the part is skipped when publishing to storage
82+
# See https://github.com/Cisco-8000-sonic/sdk/blob/master/azure-pipelines.yml
83+
# The $PACKAGE_URL is only accessible for AZP
84+
version=$(echo $package | awk -F_ '{print $(NF-1)}' | cut -d- -f1,2,4,5)
85+
package_url="$PACKAGE_URL/sai/ciscosai/master/$version/$package"
86+
echo "Override package $package from $package_url"
87+
wget "$package_url$StorageSASKey" -O "$package"
88+
done < <(ls *.deb)
89+
env:
90+
StorageSASKey: $(StorageSASKey)
91+
condition: ne(variables['Build.Reason'], 'PullRequest')
92+
displayName: "Override cisco sai packages"
93+
jobGroups:
94+
- name: cisco-8000

.azure-pipelines/official-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ stages:
2121
variables:
2222
CACHE_MODE: wcache
2323
${{ if eq(variables['Build.SourceBranchName'], '202012') }}:
24-
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web'
24+
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
2525
jobs:
2626
- template: azure-pipelines-build.yml
2727
parameters:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
steps:
2+
- script: |
3+
containers=$(docker container ls -a | grep "sonic-slave" | awk '{ print $1 }')
4+
[ -n "$containers" ] && docker container rm -f $containers
5+
docker images | grep "^<none>" | awk '{print$3}' | xargs -i docker rmi {}
6+
images=$(docker images 'sonic-slave-*' -a -q)
7+
[ -n "$images" ] && docker rmi -f $images
8+
displayName: 'Cleanup sonic slave'

0 commit comments

Comments
 (0)