Skip to content

Commit

Permalink
[ci]: build vs image in official build (#6768)
Browse files Browse the repository at this point in the history
Signed-off-by: Guohan Lu <[email protected]>
  • Loading branch information
lguohan authored Feb 12, 2021
1 parent d3072cd commit 7475b98
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 52 deletions.
47 changes: 30 additions & 17 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ parameters:
type: string
values:
- broadcom
- mellanox
- marvell-armhf
- centec-arm64
- marvell-armhf
- mellanox
- vs

- name: platform_arch
type: string
Expand All @@ -19,9 +20,10 @@ parameters:
type: string
values:
- brcm
- mlnx
- marvell-armhf
- centec-arm64
- marvell-armhf
- mlnx
- vs

- name: cache_mode
type: string
Expand Down Expand Up @@ -82,20 +84,31 @@ jobs:
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
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
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.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
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)/
Expand Down
7 changes: 7 additions & 0 deletions .azure-pipelines/official-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ stages:
raw_image: true
sync_rpc_image: true

- template: build-template.yml
parameters:
platform: vs
platform_short: vs
dbg_image: true
cache_mode: wcache

- template: build-template.yml
parameters:
timeout: 3600
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/run-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ steps:

- task: DownloadPipelineArtifact@2
inputs:
artifact: sonic-buildimage.kvm
displayName: "Download sonic-buildimage.kvm artifact"
artifact: sonic-buildimage.vs
displayName: "Download sonic-buildimage.vs artifact"

- script: |
set -x
Expand Down
40 changes: 7 additions & 33 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,11 @@ stages:
cache_mode: rcache
sync_rpc_image: true

- job:
displayName: "kvm"
timeoutInMinutes: 600
steps:
- script: |
sudo rm -rf fsroot
username=$(id -un)
sudo chown -R ${username}.${username} .
displayName: 'Cleanup'
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'

- script: |
git submodule foreach --recursive git clean -xfdf
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
displayName: 'reset submodules'
- script: |
echo $(Build.BuildNumber)
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/vs"
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=vs
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS \
target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.kvm
displayName: "Archive sonic image"
- template: .azure-pipelines/build-template.yml
parameters:
platform: vs
platform_short: vs
cache_mode: rcache

- stage: Test
variables:
Expand Down Expand Up @@ -110,8 +84,8 @@ stages:

- task: DownloadPipelineArtifact@2
inputs:
artifact: sonic-buildimage.kvm
displayName: "Download sonic-buildimage.kvm artifact"
artifact: sonic-buildimage.vs
displayName: "Download sonic-buildimage.vs artifact"

- script: |
set -x
Expand Down

0 comments on commit 7475b98

Please sign in to comment.