Skip to content

Commit f2c05f9

Browse files
Merge pull request sonic-net#50 from oleksandrivantsiv/bluefield-merge
Merge upstream/master into bluefield branch
2 parents 4a75816 + 17c3067 commit f2c05f9

File tree

760 files changed

+103657
-8592
lines changed

Some content is hidden

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

760 files changed

+103657
-8592
lines changed

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

+17-7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ schedules:
1818
- 202006
1919
always: true
2020

21+
resources:
22+
repositories:
23+
- repository: buildimage
24+
type: github
25+
name: Azure/sonic-buildimage
26+
ref: master
27+
endpoint: build
28+
2129
pool: sonicbld
2230

2331
parameters:
@@ -30,22 +38,24 @@ parameters:
3038
- centec
3139
- centec-arm64
3240
- generic
33-
- innovium
3441
- marvell-armhf
3542
- mellanox
3643

3744
stages:
3845
- stage: Build
3946
variables:
40-
CACHE_MODE: none
41-
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS='
47+
- name: CACHE_MODE
48+
value: none
49+
- name: VERSION_CONTROL_OPTIONS
50+
value: 'SONIC_VERSION_CONTROL_COMPONENTS='
51+
- template: .azure-pipelines/template-variables.yml@buildimage
4252
jobs:
4353
- template: azure-pipelines-build.yml
4454
parameters:
4555
jobFilters: ${{ parameters.jobFilters }}
46-
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
56+
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
4757
preSteps:
48-
- template: template-clean-sonic-slave.yml
58+
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
4959
- stage: UpgradeVersions
5060
jobs:
5161
- job: UpgradeVersions
@@ -69,14 +79,14 @@ stages:
6979
default_platform=broadcom
7080
artifacts=$(find $(Pipeline.Workspace) -maxdepth 1 -type d -name 'sonic-buildimage.*' | grep -v "sonic-buildimage.${default_platform}")
7181
echo "artifacts$artifacts"
72-
cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/versions target/
82+
cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/target/versions target/
7383
make freeze FREEZE_VERSION_OPTIONS=-r
7484
find files/build/versions
7585
ordered_artifacts=$(echo "$artifacts" | grep -v -E "arm64|armhf" && echo "$artifacts" | grep -E "arm64|armhf")
7686
for artifact in $ordered_artifacts
7787
do
7888
rm -rf target/versions
79-
cp -r $artifact/versions target/
89+
cp -r $artifact/target/versions target/
8090
OPTIONS="-a -d"
8191
[[ "$artifact" == *arm64* || "$artifact" == *armhf* ]] && OPTIONS="-d"
8292
make freeze FREEZE_VERSION_OPTIONS="$OPTIONS"

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

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
swi_image: yes
5151

5252
- name: broadcom
53+
timeoutInMinutes: 1440
5354
variables:
5455
dbg_image: yes
5556
swi_image: yes
@@ -131,3 +132,4 @@ jobs:
131132
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
132133
fi
133134
displayName: "Build sonic image"
135+
- template: check-dirty-version.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
parameters:
2+
- name: connectionName
3+
type: string
4+
default: sonic-dev-connection
5+
- name: kevaultName
6+
type: string
7+
default: sonic-kv
8+
- name: certificateName
9+
type: string
10+
default: sonic-secure-boot
11+
12+
steps:
13+
- task: AzureKeyVault@2
14+
inputs:
15+
connectedServiceName: ${{ parameters.connectionName }}
16+
keyVaultName: ${{ parameters.kevaultName }}
17+
secretsFilter: ${{ parameters.certificateName }}
18+
19+
- script: |
20+
set -e
21+
TMP_FILE=$(mktemp)
22+
echo "$CERTIFICATE" | base64 -d > $TMP_FILE
23+
sudo mkdir -p /etc/certificates
24+
mkdir -p $(Build.StagingDirectory)/target
25+
# Save the public key
26+
openssl pkcs12 -in $TMP_FILE -clcerts --nokeys -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN CERTIFICATE\)/\1/" > $(SIGNING_CERT)
27+
# Save the private key
28+
openssl pkcs12 -in $TMP_FILE -nocerts -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN PRIVATE KEY\)/\1/" | sudo tee $(SIGNING_KEY) 1>/dev/null
29+
ls -lt $(SIGNING_CERT) $(SIGNING_KEY)
30+
rm $TMP_FILE
31+
env:
32+
CERTIFICATE: $(${{ parameters.certificateName }})
33+
displayName: "Save certificate"

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

+9-2
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,23 @@ jobs:
4848
ENABLE_DOCKER_BASE_PULL=y make PLATFORM=$(PLATFORM_AZP) PLATFORM_ARCH=$(PLATFORM_ARCH) $(BUILD_OPTIONS) configure
4949
displayName: 'Make configure'
5050
postSteps:
51-
- script: cp target -r $(Build.ArtifactStagingDirectory)/
51+
- script: |
52+
mkdir -p $(Build.ArtifactStagingDirectory)/target
53+
mv target/* $(Build.ArtifactStagingDirectory)/target/
5254
displayName: Copy Artifacts
5355
condition: always()
5456
- publish: $(Build.ArtifactStagingDirectory)
5557
artifact: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)'
5658
displayName: "Archive sonic image"
5759
- publish: $(Build.ArtifactStagingDirectory)
58-
condition: failed()
60+
condition: or(failed(), canceled())
5961
artifact: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)$(System.JobAttempt)'
6062
displayName: "Archive failed sonic image"
63+
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
64+
- template: trigger-publish-artifacts-build.yml
65+
parameters:
66+
artifactName: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)'
67+
publishPrefix: '$(Build.DefinitionName)/$(Build.SourceBranchName)/$(GROUP_NAME)'
6168
- ${{ parameters.postSteps }}
6269
- template: cleanup.yml
6370
jobGroups: ${{ parameters.jobGroups }}

.azure-pipelines/build-commonlib.yml

+19
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
+16
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"

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

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55
# 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
613

714
schedules:
815
- cron: "0 8 * * *"
@@ -23,6 +30,7 @@ pr:
2330
- sonic-slave-stretch
2431
- sonic-slave-buster
2532
- sonic-slave-bullseye
33+
- .azure-pipelines
2634

2735
parameters:
2836
- name: 'dists'

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

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55
# 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
613

714
schedules:
815
- cron: "0 8 * * *"
@@ -23,6 +30,7 @@ pr:
2330
- sonic-slave-stretch
2431
- sonic-slave-buster
2532
- sonic-slave-bullseye
33+
- .azure-pipelines
2634

2735
parameters:
2836
- name: 'dists'

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

+26-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55
# Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64
6-
76
parameters:
87
- name: arch
98
type: string
@@ -38,7 +37,10 @@ jobs:
3837
pool: ${{ parameters.pool }}
3938
steps:
4039
- template: cleanup.yml
41-
- template: template-clean-sonic-slave.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'
4244
- checkout: self
4345
clean: true
4446
submodules: recursive
@@ -81,6 +83,10 @@ jobs:
8183
8284
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:latest
8385
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
89+
fi
8490
set +x
8591
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_IMAGE]$SLAVE_BASE_IMAGE_UPLOAD"
8692
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_TAG]$SLAVE_BASE_TAG"
@@ -89,11 +95,26 @@ jobs:
8995
displayName: Build sonic-slave-${{ parameters.dist }}-${{ parameters.arch }}
9096
9197
- task: Docker@2
98+
condition: ne(variables['Build.Reason'], 'PullRequest')
9299
displayName: Upload image
93100
inputs:
94101
containerRegistry: ${{ parameters.registry_conn }}
95102
repository: $(VARIABLE_SLAVE_BASE_IMAGE)
96103
command: push
97-
tags: |
98-
$(VARIABLE_SLAVE_BASE_TAG)
99-
latest
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

+20-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55
# 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
613

714
schedules:
815
- cron: "0 8 * * *"
@@ -24,6 +31,7 @@ pr:
2431
- sonic-slave-buster
2532
- sonic-slave-bullseye
2633
- src/sonic-build-hooks
34+
- .azure-pipelines
2735

2836
parameters:
2937
- name: 'arches'
@@ -52,8 +60,15 @@ stages:
5260
- ${{ each dist in parameters.dists }}:
5361
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
5462
- ${{ each arch in parameters.arches }}:
55-
- template: docker-sonic-slave-template.yml
56-
parameters:
57-
pool: sonicbld
58-
arch: ${{ arch }}
59-
dist: ${{ dist }}
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'
71+
parameters:
72+
pool: sonicbld
73+
arch: ${{ arch }}
74+
dist: ${{ dist }}

.azure-pipelines/official-build-cisco-8000.yml

+13
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ resources:
2222
name: Cisco-8000-sonic/platform-cisco-8000
2323
endpoint: cisco-connection
2424

25+
2526
variables:
2627
- group: SONIC-AKV-STROAGE-1
2728
- name: StorageSASKey
2829
value: $(sonicstorage-SasToken)
30+
- name: SONIC_ENABLE_SECUREBOOT_SIGNATURE
31+
value: y
32+
- name: SIGNING_KEY
33+
value: /etc/certificates/sonic-secure-boot-private.pem
34+
- name: SIGNING_CERT
35+
value: $(Build.StagingDirectory)/target/sonic-secure-boot-public.pem
2936

3037
stages:
3138
- stage: Build
@@ -41,6 +48,7 @@ stages:
4148
parameters:
4249
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
4350
preSteps:
51+
- template: azure-pipelines-download-certificate.yml
4452
- checkout: self
4553
submodules: recursive
4654
path: s
@@ -90,5 +98,10 @@ stages:
9098
StorageSASKey: $(StorageSASKey)
9199
condition: ne(variables['Build.Reason'], 'PullRequest')
92100
displayName: "Override cisco sai packages"
101+
- script: |
102+
echo "SONIC_ENABLE_SECUREBOOT_SIGNATURE := y" >> rules/config.user
103+
echo "SIGNING_KEY := $(SIGNING_KEY)" >> rules/config.user
104+
echo "SIGNING_CERT := $(SIGNING_CERT)" >> rules/config.user
105+
displayName: "Enable secure boot signature"
93106
jobGroups:
94107
- name: cisco-8000

.azure-pipelines/official-build.yml

+11
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,20 @@ schedules:
1818
- 201911
1919
- 201811
2020

21+
resources:
22+
repositories:
23+
- repository: buildimage
24+
type: github
25+
name: Azure/sonic-buildimage
26+
ref: master
27+
endpoint: build
28+
2129
trigger: none
2230
pr: none
2331

32+
variables:
33+
- template: .azure-pipelines/template-variables.yml@buildimage
34+
2435
stages:
2536
- stage: Build
2637
pool: sonicbld

0 commit comments

Comments
 (0)