sonic-buildimage/.azure-pipelines/azure-pipelines-build.yml
lixiaoyuner 10b65d9826
Add k8s master code new (#15716)
Why I did it
Currently, k8s master image is generated from a separate branch which we created by ourselves, not release ones. We need to commit these k8s master related code to master branch for a better way to do k8s master image build out.

Work item tracking
Microsoft ADO (number only):
19998138
How I did it
Install k8s dashboard docker images
Install geneva mds and mdsd and fluentd docker images and tag them as latest, tagging latest will help create container always with the latest version
Install azure-storage-blob and azure-identity, this will help do etcd backup and restore.
Install kubernetes python client packages, this will help read worker and container state, we can send these metric to Geneva.
Remove mdm debian package, will replace it with the mdm docker image
Add k8s master entrance script, this script will be called by rc-local service when system startup. we have some master systemd services in compute-move repo, when VMM service create master VM, VMM will copy all master service files inside VM, the entrance script will setup all services according to the service files.
When the entrance script content changed, the PR build will set include_kubernetes_master=y to help do validation for k8s master related code change. The default value of include_kubernetes_master should be always n for public master branch. We will generate master image from internal master branch
How to verify it
Build with INCLUDE_KUBERNETES_MASTER = y
2023-07-25 07:44:59 +08:00

176 lines
5.8 KiB
YAML

# The azure pipeline template for Official build, and upgrade version build
parameters:
- name: 'jobFilters'
type: object
default: ''
- name: 'buildOptions'
type: string
default: 'SONIC_CONFIG_BUILD_JOBS=1'
- name: 'preSteps'
type: stepList
default: []
- name: 'postSteps'
type: stepList
default: []
- name: 'jobGroups'
type: object
default: ''
- name: 'qemuOrCrossBuild'
type: boolean
default: false
jobs:
- template: azure-pipelines-image-template.yml
parameters:
jobFilters: ${{ parameters.jobFilters }}
preSteps: ${{ parameters.preSteps }}
postSteps: ${{ parameters.postSteps }}
jobVariables:
PLATFORM_AZP: $(GROUP_NAME)
PLATFORM_ARCH: amd64
BUILD_NUMBER: $(Build.BuildId)
BUILD_OPTIONS: ${{ parameters.buildOptions }}
DOCKER_DATA_ROOT_FOR_MULTIARCH: /data/march/docker
dbg_image: no
asan_image: no
swi_image: no
raw_image: no
docker_syncd_rpc_image: no
syncd_rpc_image: no
platform_rpc: no
${{ if parameters.qemuOrCrossBuild }}:
SONIC_SLAVE_DOCKER_DRIVER: 'vfs'
CACHE_MODE: 'none'
${{ if ne(parameters.jobGroups, '') }}:
jobGroups: ${{ parameters.jobGroups }}
${{ if eq(parameters.jobGroups, '') }}:
jobGroups:
- name: vs
variables:
dbg_image: yes
asan_image: yes
- name: barefoot
variables:
docker_syncd_rpc_image: yes
platform_rpc: bfn
swi_image: yes
- name: broadcom
timeoutInMinutes: 1440
variables:
dbg_image: yes
swi_image: yes
raw_image: yes
docker_syncd_rpc_image: yes
platform_rpc: brcm
- name: centec
variables:
dbg_image: yes
docker_syncd_rpc_image: yes
platform_rpc: centec
- name: centec-arm64
${{ if not(parameters.qemuOrCrossBuild) }}:
pool: sonicbld-arm64
timeoutInMinutes: 2880
variables:
PLATFORM_ARCH: arm64
- name: generic
variables:
dbg_image: yes
- name: innovium
variables:
dbg_image: yes
- name: marvell-armhf
${{ if not(parameters.qemuOrCrossBuild) }}:
pool: sonicbld-armhf
timeoutInMinutes: 2880
variables:
PLATFORM_ARCH: armhf
- name: marvell-arm64
${{ if not(parameters.qemuOrCrossBuild) }}:
pool: sonicbld-arm64
timeoutInMinutes: 2880
variables:
PLATFORM_ARCH: arm64
- name: marvell
- name: mellanox
variables:
dbg_image: yes
docker_syncd_rpc_image: yes
syncd_rpc_image: yes
platform_rpc: mlnx
- name: nephos
variables:
dbg_image: yes
docker_syncd_rpc_image: yes
platform_rpc: nephos
buildSteps:
- template: .azure-pipelines/template-skipvstest.yml@buildimage
- template: .azure-pipelines/template-daemon.yml@buildimage
- bash: |
set -ex
if [ $(GROUP_NAME) == vs ]; 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
fi
if [ $(asan_image) == yes ]; then
make $BUILD_OPTIONS ENABLE_ASAN=y target/docker-sonic-vs.gz
mv target/docker-sonic-vs.gz target/docker-sonic-vs-asan.gz
fi
if [ $(K8S_OPTIONS) == 'INCLUDE_KUBERNETES_MASTER=y' ]; then
make $BUILD_OPTIONS $(K8S_OPTIONS) target/sonic-vs.img.gz
mv target/sonic-vs.img.gz target/sonic-vs-k8s.img.gz
fi
make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
make $BUILD_OPTIONS target/docker-ptf-sai.gz
if [ $(Build.Reason) != 'PullRequest' ];then
gzip -kd target/sonic-vs.img.gz
SONIC_RUN_CMDS="qemu-img convert target/sonic-vs.img -O vhdx -o subformat=dynamic target/sonic-vs.vhdx" make $BUILD_OPTIONS sonic-slave-run
rm target/sonic-vs.img
fi
else
if [ $(dbg_image) == yes ]; then
make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin
mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin
fi
if [ $(swi_image) == yes ]; then
make $BUILD_OPTIONS ENABLE_IMAGE_SIGNATURE=y target/sonic-aboot-$(GROUP_NAME).swi
fi
if [ $(raw_image) == yes ]; then
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).raw
fi
if [ $(docker_syncd_rpc_image) == yes ]; then
# workaround for issue in rules/sairedis.dep, git ls-files will list un-exist files for cache
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-rpc.gz
pushd ./src/sonic-sairedis/SAI
git stash
popd
if [ $(GROUP_NAME) == broadcom ]; then
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/docker-syncd-$(platform_rpc)-dnx-rpc.gz
pushd ./src/sonic-sairedis/SAI
git stash
popd
fi
fi
if [ $(syncd_rpc_image) == yes ]; then
make $BUILD_OPTIONS ENABLE_SYNCD_RPC=y target/sonic-$(GROUP_NAME).bin
mv target/sonic-mellanox.bin target/sonic-$(GROUP_NAME)-rpc.bin
fi
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
fi
displayName: "Build sonic image"
- template: .azure-pipelines/check-dirty-version.yml@buildimage