[ci] Add OVERRIDE_BUILD_OPTIONS in image build template. (#15309)

Why I did it
Set build options in pipeline UI.
Support setting reproducible build options to py2,py3 in release branch and none in master branch.

Work item tracking
Microsoft ADO (number only): 22335854
How I did it
How to verify it
This commit is contained in:
Liu Shilong 2023-06-05 18:42:06 +08:00 committed by GitHub
parent 1477f779de
commit d2915969d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -73,7 +73,7 @@ stages:
- template: azure-pipelines-build.yml
parameters:
jobFilters: ${{ parameters.jobFilters }}
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y $(OVERRIDE_BUILD_OPTIONS)'
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
preSteps:
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
- checkout: self

View File

@ -28,11 +28,13 @@ jobs:
- template: .azure-pipelines/cleanup.yml@buildimage
- ${{ parameters.preSteps }}
- script: |
BUILD_OPTIONS="$(BUILD_OPTIONS)"
[ -n "$OVERRIDE_BUILD_OPTIONS" ] && OVERRIDE_BUILD_OPTIONS=$(OVERRIDE_BUILD_OPTIONS)
BUILD_OPTIONS="$(BUILD_OPTIONS) $OVERRIDE_BUILD_OPTIONS"
if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox|marvell-armhf)$"; then
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=$(CACHE_MODE) SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/$(PLATFORM_AZP)"
BUILD_OPTIONS="$(BUILD_OPTIONS) $CACHE_OPTIONS"
BUILD_OPTIONS="$BUILD_OPTIONS $CACHE_OPTIONS"
fi
echo $BUILD_OPTIONS
echo "##vso[task.setvariable variable=BUILD_OPTIONS]$BUILD_OPTIONS"
displayName: "Set cache options"
- checkout: self