Skip to content

Commit 8874a2a

Browse files
[CI] Support 202012 branch generating version files for reproducible build (#7303)
for reproducible build azp Signed-off-by: Shilong Liu <[email protected]>
1 parent b43c400 commit 8874a2a

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

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

+21-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,25 @@ pool: sonicbld
1818

1919
stages:
2020
- stage: Build
21+
variables:
22+
CACHE_MODE: none
23+
VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS='
2124
jobs:
2225
- template: azure-pipelines-build.yml
2326
parameters:
24-
buildSlave: y
27+
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
28+
preSteps:
29+
- script: |
30+
containers=$(docker container ls | grep "sonic-slave" | awk '{ print $1 }')
31+
if [ ! -z "$containers" ]; then
32+
docker container kill $containers || true
33+
sleep 5
34+
fi
35+
images=$(docker images 'sonic-slave-*' -a -q)
36+
if [ ! -z "$images" ]; then
37+
docker rmi -f $images
38+
fi
39+
displayName: 'Cleanup sonic slave'
2540
- stage: UpgradeVersions
2641
jobs:
2742
- job: UpgradeVersions
@@ -48,11 +63,14 @@ stages:
4863
cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/versions target/
4964
make freeze FREEZE_VERSION_OPTIONS=-r
5065
find files/build/versions
51-
for artifact in $artifacts
66+
ordered_artifacts=$(echo "$artifacts" | grep -v -E "arm64|armhf" && echo "$artifacts" | grep -E "arm64|armhf")
67+
for artifact in $ordered_artifacts
5268
do
5369
rm -rf target/versions
5470
cp -r $artifact/versions target/
55-
make freeze FREEZE_VERSION_OPTIONS="-a -d"
71+
OPTIONS="-a -d"
72+
[[ "$artifact" == *arm64* || "$artifact" == *armhf* ]] && OPTIONS="-d"
73+
make freeze FREEZE_VERSION_OPTIONS="$OPTIONS"
5674
done
5775
git diff files/build/versions
5876
displayName: 'Freeze Versions'

0 commit comments

Comments
 (0)