# 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 # Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64 parameters: - name: arch type: string values: - amd64 - armhf - arm64 - name: march type: string default: '' - name: dist type: string values: - bookworm - bullseye - buster - stretch - jessie - name: registry_url type: string default: sonicdev-microsoft.azurecr.io - name: registry_conn type: string default: sonicdev - name: pool type: string default: sonicbld values: - sonicbld - sonicbld-arm64 - sonicbld-armhf jobs: - job: sonic_slave_${{ parameters.dist }}${{ parameters.march }} timeoutInMinutes: 360 variables: - template: /.azure-pipelines/template-variables.yml@buildimage - template: /.azure-pipelines/azure-pipelines-repd-build-variables.yml@buildimage pool: ${{ parameters.pool }} steps: - template: cleanup.yml - template: /.azure-pipelines/template-clean-sonic-slave.yml@buildimage - checkout: self clean: true - task: Docker@2 displayName: Login to ACR inputs: command: login containerRegistry: ${{ parameters.registry_conn }} - bash: | set -ex build_options="$(VERSION_CONTROL_OPTIONS)" image_tag=$(BLDENV=${{ parameters.dist }} make -f Makefile.work showtag $build_options PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} | grep sonic-slave | tail -n 1) image_latest=$(echo $(echo $image_tag | awk -F: '{print$1}'):latest) if echo ${{ parameters.pool }} | grep ${{ parameters.arch }};then image_latest=$(echo ${image_latest} | sed 's/:/-${{ parameters.arch }}:/') fi image_branch=$(echo $(echo $image_latest | awk -F: '{print$1}'):$(Build.SourceBranchName)) docker rmi $image_tag || true if [[ "$(Build.Reason)" =~ [a-zA-Z]*CI ]] && docker pull ${{ parameters.registry_url }}/${image_tag};then exit 0 fi DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} make -f Makefile.work configure $build_options PLATFORM=generic PLATFORM_ARCH=${{ parameters.arch }} $args || docker image ls $image_tag if [[ "$(Build.Reason)" == "PullRequest" ]];then exit 0 fi docker tag ${image_tag} ${REGISTRY_SERVER}/${image_tag} docker push ${REGISTRY_SERVER}/${image_tag} docker tag ${image_tag} ${REGISTRY_SERVER}/${image_branch} docker push ${REGISTRY_SERVER}/${image_branch} if [[ "$(Build.SourceBranchName)" == "master" ]];then docker tag ${image_tag} ${REGISTRY_SERVER}/${image_latest} docker push ${REGISTRY_SERVER}/${image_latest} fi env: REGISTRY_SERVER: ${{ parameters.registry_url }} displayName: Build sonic-slave-${{ parameters.dist }}-${{ parameters.arch }}