Skip to content

Commit 39c4775

Browse files
authored
Merge branch 'sonic-net:master' into ssd_util_plugin
2 parents 6d10b83 + bb2e768 commit 39c4775

1,331 files changed

Lines changed: 61970 additions & 10863 deletions

File tree

Some content is hidden

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

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ jobs:
121121
mv target/docker-sonic-vs.gz target/docker-sonic-vs-asan.gz
122122
fi
123123
make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
124+
make $BUILD_OPTIONS target/docker-ptf-sai.gz
124125
if [ $(Build.Reason) != 'PullRequest' ];then
125126
gzip -kd target/sonic-vs.img.gz
126127
SONIC_RUN_CMDS="qemu-img convert target/sonic-vs.img -O vhdx -o subformat=dynamic target/sonic-vs.vhdx" make sonic-slave-run
@@ -138,7 +139,21 @@ jobs:
138139
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).raw
139140
fi
140141
if [ $(docker_syncd_rpc_image) == yes ]; then
142+
# workaround for issue in rules/sairedis.dep, git ls-files will list un-exist files for cache
141143
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-rpc.gz
144+
pushd ./src/sonic-sairedis/SAI
145+
git stash
146+
popd
147+
if [ $(GROUP_NAME) == broadcom ]; then
148+
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-dnx-rpc.gz
149+
pushd ./src/sonic-sairedis/SAI
150+
git stash
151+
popd
152+
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-saiserverv2-brcm.gz
153+
pushd ./src/sonic-sairedis/SAI
154+
git stash
155+
popd
156+
fi
142157
fi
143158
if [ $(syncd_rpc_image) == yes ]; then
144159
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/sonic-$(GROUP_NAME).bin

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ jobs:
3636
displayName: "Set cache options"
3737
- checkout: self
3838
submodules: recursive
39-
condition: eq(variables.SKIP_CHECKOUT, '')
39+
fetchDepth: 0
40+
condition: and(succeeded(), eq(variables.SKIP_CHECKOUT, ''))
4041
displayName: 'Checkout code'
4142
- script: |
4243
BRANCH_NAME=$(Build.SourceBranchName)

.azure-pipelines/azure-pipelines-repd-build-variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variables:
22
${{ if eq(variables['Build.Reason'],'PullRequest') }}:
3-
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=$([ "$(System.PullRequest.TargetBranch)" != "master" ] && echo deb,py2,py3,web,git,docker)'
3+
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=$([[ "$(System.PullRequest.TargetBranch)" =~ ^20[2-9][0-9]{3}$ ]] && echo deb,py2,py3,web,git,docker)'
44
${{ elseif ne(variables['Build.SourceBranchName'],'master') }}:
55
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
66
${{ else }}:

.azure-pipelines/build-template.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
fi
9393
9494
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
95+
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-ptf-sai.gz
9596
else
9697
if [ ${{ parameters.dbg_image }} == true ]; then
9798
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) INSTALL_DEBUG_TOOLS=y target/sonic-${{ parameters.platform }}.bin && \
@@ -105,6 +106,16 @@ jobs:
105106
fi
106107
if [ ${{ parameters.sync_rpc_image }} == true ]; then
107108
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y target/docker-syncd-${{ parameters.platform_short }}-rpc.gz
109+
# workaround for issue in rules/sairedis.dep, git ls-files will list un-exist files for cache
110+
pushd ./src/sonic-sairedis/SAI
111+
git stash
112+
popd
113+
if [ ${{ parameters.platform }} == broadcom ]; then
114+
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-saiserverv2-brcm.gz
115+
pushd ./src/sonic-sairedis/SAI
116+
git stash
117+
popd
118+
fi
108119
fi
109120
110121
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/sonic-${{ parameters.platform }}.bin

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

Lines changed: 0 additions & 52 deletions
This file was deleted.

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

Lines changed: 0 additions & 52 deletions
This file was deleted.

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

Lines changed: 26 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ parameters:
1010
- amd64
1111
- armhf
1212
- arm64
13+
- name: march
14+
type: string
15+
default: ''
1316
- name: dist
1417
type: string
1518
values:
@@ -32,89 +35,44 @@ parameters:
3235
- sonicbld-armhf
3336

3437
jobs:
35-
- job: Build_${{ parameters.dist }}_${{ parameters.arch }}
38+
- job: Build_${{ parameters.dist }}_${{ parameters.march }}${{ parameters.arch }}
3639
timeoutInMinutes: 360
40+
variables:
41+
- template: /.azure-pipelines/template-variables.yml@buildimage
42+
- template: /.azure-pipelines/azure-pipelines-repd-build-variables.yml@buildimage
3743
pool: ${{ parameters.pool }}
3844
steps:
3945
- template: cleanup.yml
40-
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
41-
- template: template-clean-sonic-slave.yml
42-
- ${{ else }}:
43-
- template: '/.azure-pipelines/template-clean-sonic-slave.yml@buildimage'
46+
- template: /.azure-pipelines/template-clean-sonic-slave.yml@buildimage
4447
- checkout: self
4548
clean: true
4649
submodules: recursive
50+
- task: Docker@2
51+
displayName: Login to ACR
52+
inputs:
53+
command: login
54+
containerRegistry: ${{ parameters.registry_conn }}
4755
- bash: |
4856
set -ex
57+
image_tag=$(BLDENV=${{ parameters.dist }} make -f Makefile.work showtag PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} | grep sonic-slave | tail -n 1)
58+
image_latest=$(echo $(echo $image_tag | awk -F: '{print$1}'):latest)
59+
docker rmi $image_tag || true
4960
50-
SLAVE_DIR=sonic-slave-${{ parameters.dist }}
51-
if [ x${{ parameters.pool }} == x"sonicbld" ]; then
52-
if [ x${{ parameters.arch }} == x"amd64" ]; then
53-
SLAVE_BASE_IMAGE=${SLAVE_DIR}
54-
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}
55-
elif [ x${{ parameters.pool }} == x"sonicbld" ]; then
56-
SLAVE_BASE_IMAGE=${SLAVE_DIR}-march-${{ parameters.arch }}
57-
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-march-${{ parameters.arch }}
58-
fi
59-
elif [[ x${{ parameters.pool }} == x"sonicbld-armhf" && x${{ parameters.arch }} == x"armhf" ]]; then
60-
SLAVE_BASE_IMAGE=${SLAVE_DIR}
61-
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-armhf
62-
elif [[ x${{ parameters.pool }} == x"sonicbld-arm64" && x${{ parameters.arch }} == x"arm64" ]]; then
63-
SLAVE_BASE_IMAGE=${SLAVE_DIR}
64-
SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-arm64
65-
else
66-
echo "do not support build ${{ parameters.arch }} on ${{ parameters.pool }}"
67-
exit 1
61+
if [[ "$(Build.Reason)" =~ [a-zA-Z]*CI ]] && docker pull ${{ parameters.registry_url }}/${image_tag};then
62+
exit 0
6863
fi
6964
70-
if [ x"$(Build.SourceBranchName)" == x"202012" ]; then
71-
BUILD_OPTIONS = 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker'
65+
DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} make -f Makefile.work configure PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} $args || docker image ls $image_tag
66+
if [[ "$(Build.Reason)" == "PullRequest" ]];then
67+
exit 0
7268
fi
7369
74-
tmpfile=$(mktemp)
75-
76-
echo ${{ parameters.arch }} > .arch
77-
78-
DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} $(BUILD_OPTIONS) make -f Makefile.work sonic-slave-build | tee $tmpfile
79-
SLAVE_BASE_TAG=$(grep "^Checking sonic-slave-base image:" $tmpfile | awk -F ':' '{print $3}')
80-
SLAVE_TAG=$(grep "^Checking sonic-slave image:" $tmpfile | awk -F ':' '{print $3}')
81-
82-
mkdir -p target
83-
84-
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:latest
85-
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:$SLAVE_BASE_TAG
86-
if [ "$SLAVE_BASE_IMAGE_UPLOAD" != "$SLAVE_DIR" ]; then
87-
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_DIR:latest-${{ parameters.arch }}
88-
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_DIR:$SLAVE_BASE_TAG
70+
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_tag}
71+
docker push ${REGISTRY_SERVER}/${image_tag}
72+
if [[ "${{ parameters.arch }}" == "amd64" ]];then
73+
docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest}
74+
docker push ${REGISTRY_SERVER}/${image_latest}
8975
fi
90-
set +x
91-
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_IMAGE]$SLAVE_BASE_IMAGE_UPLOAD"
92-
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_TAG]$SLAVE_BASE_TAG"
9376
env:
9477
REGISTRY_SERVER: ${{ parameters.registry_url }}
9578
displayName: Build sonic-slave-${{ parameters.dist }}-${{ parameters.arch }}
96-
97-
- task: Docker@2
98-
condition: ne(variables['Build.Reason'], 'PullRequest')
99-
displayName: Upload image
100-
inputs:
101-
containerRegistry: ${{ parameters.registry_conn }}
102-
repository: $(VARIABLE_SLAVE_BASE_IMAGE)
103-
command: push
104-
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
105-
tags: |
106-
$(VARIABLE_SLAVE_BASE_TAG)
107-
latest
108-
${{ else }}:
109-
tags: |
110-
$(VARIABLE_SLAVE_BASE_TAG)
111-
- ${{ if ne(parameters.arch, 'amd64') }}:
112-
- task: Docker@2
113-
condition: ne(variables['Build.Reason'], 'PullRequest')
114-
displayName: Upload image ${{ parameters.dist }}
115-
inputs:
116-
containerRegistry: ${{ parameters.registry_conn }}
117-
repository: "sonic-slave-${{ parameters.dist }}"
118-
command: push
119-
tags: |
120-
$(VARIABLE_SLAVE_BASE_TAG)

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

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,27 @@ resources:
1212
endpoint: sonic-net
1313

1414
schedules:
15-
- cron: "0 8 * * *"
15+
- cron: "0 0 * * 0"
16+
displayName: Weekly build
1617
branches:
1718
include:
1819
- master
19-
- 202012
20+
- 202???
2021
always: true
2122

22-
trigger: none
23-
pr:
23+
pr: none
24+
trigger:
25+
batch: true
2426
branches:
2527
include:
2628
- master
29+
- 202???
2730
paths:
2831
include:
29-
- sonic-slave-jessie
30-
- sonic-slave-stretch
31-
- sonic-slave-buster
32-
- sonic-slave-bullseye
33-
- src/sonic-build-hooks
34-
- .azure-pipelines
32+
- sonic-slave-*
33+
- files/build/versions
34+
- Makefile
35+
- Makefile.work
3536

3637
parameters:
3738
- name: 'arches'
@@ -60,15 +61,21 @@ stages:
6061
- ${{ each dist in parameters.dists }}:
6162
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
6263
- ${{ each arch in parameters.arches }}:
63-
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
64-
- template: docker-sonic-slave-template.yml
65-
parameters:
66-
pool: sonicbld
67-
arch: ${{ arch }}
68-
dist: ${{ dist }}
69-
- ${{ else }}:
70-
- template: '/.azure-pipelines/docker-sonic-slave-template.yml@buildimage'
64+
- template: .azure-pipelines/docker-sonic-slave-template.yml@buildimage
65+
parameters:
66+
pool: sonicbld
67+
arch: ${{ arch }}
68+
dist: ${{ dist }}
69+
- stage: Build_march
70+
dependsOn: []
71+
jobs:
72+
- ${{ each dist in parameters.dists }}:
73+
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
74+
- ${{ each arch in parameters.arches }}:
75+
- ${{ if ne(arch, 'amd64') }}:
76+
- template: .azure-pipelines/docker-sonic-slave-template.yml@buildimage
7177
parameters:
72-
pool: sonicbld
78+
pool: sonicbld-${{ arch }}
7379
arch: ${{ arch }}
7480
dist: ${{ dist }}
81+
march: march_

0 commit comments

Comments
 (0)