2021-02-05 17:38:25 -06:00
|
|
|
parameters:
|
|
|
|
- name: platform
|
|
|
|
type: string
|
|
|
|
values:
|
|
|
|
- broadcom
|
2021-02-09 03:24:43 -06:00
|
|
|
- centec-arm64
|
2021-02-12 01:34:05 -06:00
|
|
|
- marvell-armhf
|
|
|
|
- mellanox
|
|
|
|
- vs
|
2021-02-06 18:58:15 -06:00
|
|
|
|
|
|
|
- name: platform_arch
|
|
|
|
type: string
|
|
|
|
values:
|
|
|
|
- amd64
|
|
|
|
- armhf
|
|
|
|
- arm64
|
|
|
|
default: amd64
|
2021-02-05 17:38:25 -06:00
|
|
|
|
|
|
|
- name: platform_short
|
|
|
|
type: string
|
|
|
|
values:
|
|
|
|
- brcm
|
2021-02-09 03:24:43 -06:00
|
|
|
- centec-arm64
|
2021-02-12 01:34:05 -06:00
|
|
|
- marvell-armhf
|
|
|
|
- mlnx
|
|
|
|
- vs
|
2021-02-05 17:38:25 -06:00
|
|
|
|
|
|
|
- name: cache_mode
|
|
|
|
type: string
|
|
|
|
values:
|
|
|
|
- wcache
|
|
|
|
- rcache
|
|
|
|
- cache
|
|
|
|
|
2021-02-06 18:58:15 -06:00
|
|
|
- name: pool
|
|
|
|
type: string
|
|
|
|
values:
|
|
|
|
- sonicbld
|
|
|
|
- sonicbld_8c
|
|
|
|
default: sonicbld
|
|
|
|
|
2021-02-05 17:38:25 -06:00
|
|
|
- name: dbg_image
|
|
|
|
type: boolean
|
2021-02-06 18:58:15 -06:00
|
|
|
default: false
|
2021-02-05 17:38:25 -06:00
|
|
|
|
|
|
|
- name: swi_image
|
|
|
|
type: boolean
|
2021-02-06 18:58:15 -06:00
|
|
|
default: false
|
2021-02-05 17:38:25 -06:00
|
|
|
|
|
|
|
- name: raw_image
|
|
|
|
type: boolean
|
2021-02-06 18:58:15 -06:00
|
|
|
default: false
|
2021-02-05 17:38:25 -06:00
|
|
|
|
|
|
|
- name: sync_rpc_image
|
|
|
|
type: boolean
|
2021-02-06 18:58:15 -06:00
|
|
|
default: false
|
|
|
|
|
|
|
|
- name: timeout
|
|
|
|
type: number
|
|
|
|
default: 600
|
2021-02-05 17:38:25 -06:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
- job:
|
2021-02-06 18:58:15 -06:00
|
|
|
pool: ${{ parameters.pool }}
|
2021-02-05 17:38:25 -06:00
|
|
|
displayName: ${{ parameters.platform }}
|
2021-02-06 18:58:15 -06:00
|
|
|
timeoutInMinutes: ${{ parameters.timeout }}
|
2021-02-05 17:38:25 -06:00
|
|
|
steps:
|
2021-02-08 10:06:36 -06:00
|
|
|
- template: cleanup.yml
|
2021-02-05 17:38:25 -06:00
|
|
|
- checkout: self
|
2021-02-08 10:06:36 -06:00
|
|
|
clean: true
|
2021-02-05 17:38:25 -06:00
|
|
|
submodules: recursive
|
|
|
|
displayName: 'Checkout code'
|
2021-02-08 10:06:36 -06:00
|
|
|
- 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'
|
2021-02-05 17:38:25 -06:00
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
sudo modprobe overlay
|
2021-02-06 18:58:15 -06:00
|
|
|
sudo apt-get install -y acl
|
|
|
|
export DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker
|
2021-02-05 17:38:25 -06:00
|
|
|
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=${{ parameters.cache_mode }} SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/${{ parameters.platform }}"
|
2021-02-06 18:58:15 -06:00
|
|
|
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=${{ parameters.platform }} PLATFORM_ARCH=${{ parameters.platform_arch }}
|
2021-02-05 17:38:25 -06:00
|
|
|
trap "sudo rm -rf fsroot" EXIT
|
2021-02-12 01:34:05 -06:00
|
|
|
|
|
|
|
if [ ${{ parameters.platform }} == vs ]; then
|
|
|
|
if [ ${{ parameters.dbg_image }} == true ]; then
|
|
|
|
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz && \
|
|
|
|
mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz
|
|
|
|
fi
|
|
|
|
|
|
|
|
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
|
2022-11-17 06:42:51 -06:00
|
|
|
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/docker-ptf-sai.gz
|
2021-02-12 01:34:05 -06:00
|
|
|
else
|
|
|
|
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.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
|
2022-12-01 00:26:54 -06:00
|
|
|
# workaround for issue in rules/sairedis.dep, git ls-files will list un-exist files for cache
|
|
|
|
pushd ./src/sonic-sairedis/SAI
|
|
|
|
git stash
|
|
|
|
popd
|
|
|
|
if [ ${{ parameters.platform }} == broadcom ]; then
|
|
|
|
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) ENABLE_SYNCD_RPC=y SAITHRIFT_V2=y target/docker-saiserverv2-brcm.gz
|
|
|
|
pushd ./src/sonic-sairedis/SAI
|
|
|
|
git stash
|
|
|
|
popd
|
|
|
|
fi
|
2023-01-05 21:45:03 -06:00
|
|
|
if [ ${{ parameters.platform }} == barefoot ]; then
|
|
|
|
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) SAITHRIFT_V2=y ENABLE_SYNCD_RPC=y target/docker-saiserverv2-bfn.gz
|
|
|
|
pushd ./src/sonic-sairedis/SAI
|
|
|
|
git stash
|
|
|
|
popd
|
|
|
|
fi
|
2021-02-12 01:34:05 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/sonic-${{ parameters.platform }}.bin
|
2021-02-05 17:38:25 -06:00
|
|
|
fi
|
|
|
|
displayName: 'Build sonic image'
|
2021-02-10 13:45:07 -06:00
|
|
|
- template: cleanup.yml
|
2021-02-05 17:38:25 -06:00
|
|
|
- publish: $(System.DefaultWorkingDirectory)/
|
|
|
|
artifact: sonic-buildimage.${{ parameters.platform }}
|
|
|
|
displayName: "Archive sonic image"
|
2021-04-03 11:28:56 -05:00
|
|
|
- script: |
|
|
|
|
set -x
|
|
|
|
find target -name "*.log" | xargs -I{} cp {} $(Build.ArtifactStagingDirectory)/
|
|
|
|
condition: failed()
|
|
|
|
displayName: "Copy build logs"
|
|
|
|
- publish: $(Build.ArtifactStagingDirectory)/
|
|
|
|
artifact: sonic-buildimage.${{ parameters.platform}}.logs@$(System.JobAttempt)
|
|
|
|
displayName: "Archive build logs"
|
|
|
|
condition: failed()
|