sonic-buildimage/azure-pipelines.yml
xumia 6fc6346263 [ci]: Cleanup fsroot before checking out code (#6639)
Signed-off-by: Guohan Lu <lguohan@gmail.com>
Co-authored-by: Guohan Lu <lguohan@gmail.com>
2021-02-03 15:41:20 -08:00

108 lines
3.5 KiB
YAML

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
resources:
repositories:
- repository: sonic-mgmt
type: github
name: Azure/sonic-mgmt
endpoint: build
stages:
- stage: Build
pool: sonicbld
jobs:
- job:
displayName: "broadcom"
timeoutInMinutes: 600
steps:
- script: |
sudo rm -rf fsroot
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: |
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/broadcom"
make configure PLATFORM=broadcom
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-broadcom.bin
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.broadcom.201911
displayName: "Archive sonic image"
- job:
displayName: "mellanox"
timeoutInMinutes: 600
steps:
- script: |
sudo rm -rf fsroot
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: |
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/mellanox"
make configure PLATFORM=mellanox
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-mellanox.bin
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.mellanox.201911
displayName: "Archive sonic image"
- job:
displayName: "kvm"
timeoutInMinutes: 600
steps:
- script: |
sudo rm -rf fsroot
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"
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 && \
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.kvm.201911
displayName: "Archive sonic image"