[ci] Fix the boolean value case sensitive issue in Azure Pipelines (#7399)

Why I did it
Fix the boolean value case sensitive issue in Azure Pipelines

When passing parameters to a template, the "true" or "false" will have case sensitive issue, it should be a type casting issue.
To fix it, we change the true/false to yes/no, to escape the trap.

Support to override the job groups in the template, so PR build has chance to use different build parameters, only build simple targets. For example, for broadcom, we only build target/sonic-broadcom.bin, the other images, such as swi, debug bin, etc, will not be built.
This commit is contained in:
xumia 2021-04-23 09:26:16 +08:00 committed by GitHub
parent 38f65c8fd0
commit 39d877c1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 59 deletions

View File

@ -13,6 +13,9 @@ parameters:
- name: 'postSteps' - name: 'postSteps'
type: stepList type: stepList
default: [] default: []
- name: 'jobGroups'
type: object
default: []
jobs: jobs:
- template: azure-pipelines-image-template.yml - template: azure-pipelines-image-template.yml
@ -25,29 +28,32 @@ jobs:
PLATFORM_ARCH: amd64 PLATFORM_ARCH: amd64
BUILD_OPTIONS: ${{ parameters.buildOptions }} BUILD_OPTIONS: ${{ parameters.buildOptions }}
DOCKER_DATA_ROOT_FOR_MULTIARCH: /data/march/docker DOCKER_DATA_ROOT_FOR_MULTIARCH: /data/march/docker
dbg_image: false dbg_image: no
swi_image: false swi_image: no
raw_image: false raw_image: no
sync_rpc_image: false sync_rpc_image: no
platform_rpc: false platform_rpc: no
${{ if ne(parameters.jobGroups, '') }}:
jobGroups: ${{ parameters.jobGroups }}
${{ if eq(parameters.jobGroups, '') }}:
jobGroups: jobGroups:
- name: vs - name: vs
variables: variables:
dbg_image: true dbg_image: yes
- name: barefoot - name: barefoot
variables: variables:
swi_image: true swi_image: yes
- name: broadcom - name: broadcom
variables: variables:
dbg_image: true dbg_image: yes
swi_image: true swi_image: yes
raw_image: true raw_image: yes
sync_rpc_image: true sync_rpc_image: yes
platform_rpc: brcm platform_rpc: brcm
- name: centec - name: centec
variables: variables:
dbg_image: true dbg_image: yes
sync_rpc_image: true sync_rpc_image: yes
platform_rpc: centec platform_rpc: centec
- name: centec-arm64 - name: centec-arm64
pool: sonicbld_8c pool: sonicbld_8c
@ -56,10 +62,10 @@ jobs:
PLATFORM_ARCH: arm64 PLATFORM_ARCH: arm64
- name: generic - name: generic
variables: variables:
dbg_image: true dbg_image: yes
- name: innovium - name: innovium
variables: variables:
swi_image: true swi_image: yes
- name: marvell-armhf - name: marvell-armhf
pool: sonicbld_8c pool: sonicbld_8c
timeoutInMinutes: 1800 timeoutInMinutes: 1800
@ -67,33 +73,33 @@ jobs:
PLATFORM_ARCH: armhf PLATFORM_ARCH: armhf
- name: mellanox - name: mellanox
variables: variables:
dbg_image: true dbg_image: yes
sync_rpc_image: true sync_rpc_image: yes
platform_rpc: mlnx platform_rpc: mlnx
- name: nephos - name: nephos
variables: variables:
dbg_image: true dbg_image: yes
sync_rpc_image: true sync_rpc_image: yes
platform_rpc: nephos platform_rpc: nephos
buildSteps: buildSteps:
- bash: | - bash: |
if [ $(GROUP_NAME) == vs ]; then if [ $(GROUP_NAME) == vs ]; then
if [ $(dbg_image) == true ]; then if [ $(dbg_image) == yes ]; then
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz && mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz && mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz
fi fi
make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
else else
if [ $(dbg_image) == true ]; then if [ $(dbg_image) == yes ]; then
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin && \ make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin && \
mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin
fi fi
if [ $(swi_image) == true ]; then if [ $(swi_image) == yes ]; then
make $BUILD_OPTIONS ENABLE_IMAGE_SIGNATURE=y target/sonic-aboot-$(GROUP_NAME).swi make $BUILD_OPTIONS ENABLE_IMAGE_SIGNATURE=y target/sonic-aboot-$(GROUP_NAME).swi
fi fi
if [ $(raw_image) == true ]; then if [ $(raw_image) == yes ]; then
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).raw make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).raw
fi fi
if [ $(sync_rpc_image) == true ]; then if [ $(sync_rpc_image) == yes ]; then
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-rpc.gz make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-rpc.gz
fi fi
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin

View File

@ -41,10 +41,10 @@ stages:
- template: .azure-pipelines/azure-pipelines-build.yml - template: .azure-pipelines/azure-pipelines-build.yml
parameters: parameters:
buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}' buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}'
jobFilters: jobGroups:
- vs - name: vs
- broadcom - name: broadcom
- mellanox - name: mellanox
- stage: Test - stage: Test
variables: variables: