Skip to content

Commit ba3c5de

Browse files
authored
Merge branch 'master' into mellanox_security
2 parents a16ed29 + 2f46689 commit ba3c5de

File tree

96 files changed

+1704
-654
lines changed

Some content is hidden

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

96 files changed

+1704
-654
lines changed

.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 & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,28 @@ 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
32+
- sonic-slave-*
3333
- src/sonic-build-hooks
34-
- .azure-pipelines
34+
- files/build/versions
35+
- Makefile
36+
- Makefile.work
3537

3638
parameters:
3739
- name: 'arches'
@@ -60,15 +62,21 @@ stages:
6062
- ${{ each dist in parameters.dists }}:
6163
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
6264
- ${{ 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'
65+
- template: .azure-pipelines/docker-sonic-slave-template.yml@buildimage
66+
parameters:
67+
pool: sonicbld
68+
arch: ${{ arch }}
69+
dist: ${{ dist }}
70+
- stage: Build_march
71+
dependsOn: []
72+
jobs:
73+
- ${{ each dist in parameters.dists }}:
74+
- ${{ if endswith(variables['Build.DefinitionName'], dist) }}:
75+
- ${{ each arch in parameters.arches }}:
76+
- ${{ if ne(arch, 'amd64') }}:
77+
- template: .azure-pipelines/docker-sonic-slave-template.yml@buildimage
7178
parameters:
72-
pool: sonicbld
79+
pool: sonicbld-${{ arch }}
7380
arch: ${{ arch }}
7481
dist: ${{ dist }}
82+
march: march_

Makefile.work

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# * Default: yes
3535
# * Values: yes, no
3636
# * KERNEL_PROCURE_METHOD: Specifying method of obtaining kernel Debian package: download or build
37-
# * TELEMETRY_WRITABLE: Enable write/config operations via the gNMI interface.
37+
# * ENABLE_TRANSLIB_WRITE: Enable translib write/config operations via the gNMI interface.
3838
# * Default: unset
3939
# * Values: y
4040
# * SONIC_DPKG_CACHE_METHOD: Specifying method of obtaining the Debian packages from cache: none or cache
@@ -395,7 +395,7 @@ SONIC_BUILD_INSTRUCTION := make \
395395
INCLUDE_MACSEC=$(INCLUDE_MACSEC) \
396396
SONIC_INCLUDE_RESTAPI=$(INCLUDE_RESTAPI) \
397397
SONIC_INCLUDE_MUX=$(INCLUDE_MUX) \
398-
TELEMETRY_WRITABLE=$(TELEMETRY_WRITABLE) \
398+
ENABLE_TRANSLIB_WRITE=$(ENABLE_TRANSLIB_WRITE) \
399399
EXTRA_DOCKER_TARGETS=$(EXTRA_DOCKER_TARGETS) \
400400
BUILD_LOG_TIMESTAMP=$(BUILD_LOG_TIMESTAMP) \
401401
SONIC_ENABLE_IMAGE_SIGNATURE=$(ENABLE_IMAGE_SIGNATURE) \

azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ stages:
113113

114114
- script: |
115115
set -x
116+
sudo apt-get update
117+
sudo apt-get install libyang0.16 -y
116118
sudo dpkg -i --force-confask,confnew ../libswsscommon_1.0.0_amd64.deb
117119
sudo dpkg -i ../python3-swsscommon_1.0.0_amd64.deb
118120
sudo docker load -i ../target/docker-sonic-vs.gz
@@ -137,7 +139,7 @@ stages:
137139
pool: sonictest
138140
displayName: "kvmtest-t0-part1"
139141
timeoutInMinutes: 360
140-
continueOnError: true
142+
continueOnError: false
141143
steps:
142144
- template: .azure-pipelines/run-test-template.yml
143145
parameters:
@@ -151,7 +153,7 @@ stages:
151153
pool: sonictest
152154
displayName: "kvmtest-t0-part2"
153155
timeoutInMinutes: 360
154-
continueOnError: true
156+
continueOnError: false
155157
steps:
156158
- template: .azure-pipelines/run-test-template.yml
157159
parameters:

build_debian.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,16 @@ rm /files/etc/ssh/sshd_config/ClientAliveInterval
467467
rm /files/etc/ssh/sshd_config/ClientAliveCountMax
468468
touch /files/etc/ssh/sshd_config/EmptyLineHack
469469
rename /files/etc/ssh/sshd_config/EmptyLineHack ""
470-
set /files/etc/ssh/sshd_config/ClientAliveInterval 900
470+
set /files/etc/ssh/sshd_config/ClientAliveInterval 300
471471
set /files/etc/ssh/sshd_config/ClientAliveCountMax 1
472472
ins #comment before /files/etc/ssh/sshd_config/ClientAliveInterval
473-
set /files/etc/ssh/sshd_config/#comment[following-sibling::*[1][self::ClientAliveInterval]] "Close inactive client sessions after 15 minutes"
473+
set /files/etc/ssh/sshd_config/#comment[following-sibling::*[1][self::ClientAliveInterval]] "Close inactive client sessions after 5 minutes"
474+
rm /files/etc/ssh/sshd_config/MaxAuthTries
475+
set /files/etc/ssh/sshd_config/MaxAuthTries 3
476+
rm /files/etc/ssh/sshd_config/LogLevel
477+
set /files/etc/ssh/sshd_config/LogLevel VERBOSE
478+
rm /files/etc/ssh/sshd_config/Banner
479+
set /files/etc/ssh/sshd_config/Banner /etc/issue
474480
save
475481
quit
476482
EOF

build_image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then
191191
zip -g $ABOOT_BOOT_IMAGE .imagehash
192192
rm .imagehash
193193
echo "SWI_VERSION=42.0.0" > version
194+
echo "BUILD_DATE=$(date -d "${build_date}" -u +%Y%m%dT%H%M%SZ)" >> version
194195
echo "SWI_MAX_HWEPOCH=2" >> version
195196
echo "SWI_VARIANT=US" >> version
196197
zip -g $OUTPUT_ABOOT_IMAGE version

0 commit comments

Comments
 (0)