[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,75 +28,78 @@ 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
jobGroups: ${{ if ne(parameters.jobGroups, '') }}:
- name: vs jobGroups: ${{ parameters.jobGroups }}
variables: ${{ if eq(parameters.jobGroups, '') }}:
dbg_image: true jobGroups:
- name: barefoot - name: vs
variables: variables:
swi_image: true dbg_image: yes
- name: broadcom - name: barefoot
variables: variables:
dbg_image: true swi_image: yes
swi_image: true - name: broadcom
raw_image: true variables:
sync_rpc_image: true dbg_image: yes
platform_rpc: brcm swi_image: yes
- name: centec raw_image: yes
variables: sync_rpc_image: yes
dbg_image: true platform_rpc: brcm
sync_rpc_image: true - name: centec
platform_rpc: centec variables:
- name: centec-arm64 dbg_image: yes
pool: sonicbld_8c sync_rpc_image: yes
timeoutInMinutes: 1800 platform_rpc: centec
variables: - name: centec-arm64
PLATFORM_ARCH: arm64 pool: sonicbld_8c
- name: generic timeoutInMinutes: 1800
variables: variables:
dbg_image: true PLATFORM_ARCH: arm64
- name: innovium - name: generic
variables: variables:
swi_image: true dbg_image: yes
- name: marvell-armhf - name: innovium
pool: sonicbld_8c variables:
timeoutInMinutes: 1800 swi_image: yes
variables: - name: marvell-armhf
PLATFORM_ARCH: armhf pool: sonicbld_8c
- name: mellanox timeoutInMinutes: 1800
variables: variables:
dbg_image: true PLATFORM_ARCH: armhf
sync_rpc_image: true - name: mellanox
platform_rpc: mlnx variables:
- name: nephos dbg_image: yes
variables: sync_rpc_image: yes
dbg_image: true platform_rpc: mlnx
sync_rpc_image: true - name: nephos
platform_rpc: nephos variables:
dbg_image: yes
sync_rpc_image: yes
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: