sonic-buildimage/.azure-pipelines/build-template.yml
lguohan ed9a14f0af
[ci]: move cleanup before archive artifacts (#6749)
Signed-off-by: Guohan Lu <lguohan@gmail.com>
2021-02-10 11:45:07 -08:00

104 lines
2.9 KiB
YAML

parameters:
- name: platform
type: string
values:
- broadcom
- mellanox
- marvell-armhf
- centec-arm64
- name: platform_arch
type: string
values:
- amd64
- armhf
- arm64
default: amd64
- name: platform_short
type: string
values:
- brcm
- mlnx
- marvell-armhf
- centec-arm64
- name: cache_mode
type: string
values:
- wcache
- rcache
- cache
- name: pool
type: string
values:
- sonicbld
- sonicbld_8c
default: sonicbld
- name: dbg_image
type: boolean
default: false
- name: swi_image
type: boolean
default: false
- name: raw_image
type: boolean
default: false
- name: sync_rpc_image
type: boolean
default: false
- name: timeout
type: number
default: 600
jobs:
- job:
pool: ${{ parameters.pool }}
displayName: ${{ parameters.platform }}
timeoutInMinutes: ${{ parameters.timeout }}
steps:
- template: cleanup.yml
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'
- script: |
git submodule foreach --recursive 'git clean -xfdf || true'
git submodule foreach --recursive 'git reset --hard || true'
git submodule foreach --recursive 'git remote update || true'
git submodule update --init --recursive
displayName: 'Reset submodules'
- script: |
set -e
sudo modprobe overlay
sudo apt-get install -y acl
export DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=${{ parameters.cache_mode }} SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/${{ parameters.platform }}"
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=${{ parameters.platform }} PLATFORM_ARCH=${{ parameters.platform_arch }}
trap "sudo rm -rf fsroot" EXIT
if [ ${{ parameters.dbg_image }} == true ];then
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) INSTALL_DEBUG_TOOLS=y target/sonic-${{ parameters.platform }}.bin && \
mv target/sonic-${{ parameters.platform }}.bin target/sonic-${{ parameters.platform }}-dbg.bin
fi
if [ ${{ parameters.swi_image }} == true ];then
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y target/sonic-aboot-${{ parameters.platform }}.swi
fi
if [ ${{ parameters.raw_image }} == true ];then
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/sonic-${{ parameters.platform }}.raw
fi
if [ ${{ parameters.sync_rpc_image }} == true ];then
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y target/docker-syncd-${{ parameters.platform_short }}-rpc.gz
fi
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/sonic-${{ parameters.platform }}.bin
displayName: 'Build sonic image'
- template: cleanup.yml
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.${{ parameters.platform }}
displayName: "Archive sonic image"