Skip to content

Commit

Permalink
Merge branch 'master' into include_docker_script_in_sonic
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanblyschak authored Feb 8, 2021
2 parents 18873fb + de51ee3 commit a623ffd
Show file tree
Hide file tree
Showing 1,810 changed files with 108,298 additions and 15,234 deletions.
12 changes: 12 additions & 0 deletions .artifactignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**/*
!target/*.bin
!target/*.log
!target/*.img.gz
!target/docker-sonic-vs.gz
!target/docker-ptf.gz
!target/debs/**/*.deb
!target/debs/**/*.deb.log
!target/debs/**/*.deb-install.log
!target/python-wheels/*.whl
!target/python-wheels/*.whl.log
!target/python-wheels/*.whl-install.log
94 changes: 94 additions & 0 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
parameters:
- name: platform
type: string
values:
- broadcom
- mellanox
- marvell-armhf

- name: platform_arch
type: string
values:
- amd64
- armhf
- arm64
default: amd64

- name: platform_short
type: string
values:
- brcm
- mlnx
- marvell-armhf

- name: cache_mode
type: string
values:
- wcache
- rcache
- cache

- name: pool
type: string
values:
- sonicbld
- sonicbld_8c
default: sonicbld

- name: dbg_image
type: boolean
default: false

- name: swi_image
type: boolean
default: false

- name: raw_image
type: boolean
default: false

- name: sync_rpc_image
type: boolean
default: false

- name: timeout
type: number
default: 600

jobs:
- job:
pool: ${{ parameters.pool }}
displayName: ${{ parameters.platform }}
timeoutInMinutes: ${{ parameters.timeout }}
steps:
- checkout: self
submodules: recursive
displayName: 'Checkout code'
- template: cleanup.yml
- script: |
set -e
sudo modprobe overlay
sudo apt-get install -y acl
export DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker
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
fi
make USERNAME=admin $CACHE_OPTIONS SONIC_BUILD_JOBS=$(nproc) target/sonic-${{ parameters.platform }}.bin
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.${{ parameters.platform }}
displayName: "Archive sonic image"
- template: cleanup.yml
18 changes: 18 additions & 0 deletions .azure-pipelines/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
steps:
- script: |
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
sudo rm -f /var/run/march/docker.pid || true
sudo rm -rf fsroot || true
git clean -xfdf || true
git reset --hard || true
git submodule foreach --recursive 'git clean -xfdf || true' || true
git submodule foreach --recursive 'git reset --hard || true' || true
git submodule foreach --recursive 'git remote update || true' || true
git submodule update --init --recursive || true
# clean native docker build
if sudo [ -f dockerfs/var/run/docker.pid ] ; then
pid=`sudo cat dockerfs/var/run/docker.pid` ; sudo kill $pid
fi
sudo rm -rf /data/march/docker
displayName: "Clean Workspace"
38 changes: 38 additions & 0 deletions .azure-pipelines/official-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

schedules:
- cron: "0 8 * * *"
displayName: Daily midnight build
branches:
include:
- master
always: true

trigger: none
pr: none

stages:
- stage: Build

jobs:
- template: build-template.yml
parameters:
platform: broadcom
platform_short: brcm
cache_mode: wcache
dbg_image: true
swi_image: true
raw_image: true
sync_rpc_image: true

- template: build-template.yml
parameters:
timeout: 3600
platform: marvell-armhf
platform_arch: armhf
platform_short: marvell-armhf
cache_mode: wcache
pool: sonicbld_8c
82 changes: 82 additions & 0 deletions .azure-pipelines/run-test-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
parameters:
- name: dut
type: string
- name: tbname
type: string
- name: tbtype
type: string
- name: ptf_name
type: string

steps:
- checkout: self
clean: true
displayName: 'checkout sonic-mgmt repo'

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

- script: |
set -x
sudo mkdir -p /data/sonic-vm/images
sudo cp -v ../target/sonic-vs.img.gz /data/sonic-vm/images/sonic-vs.img.gz
sudo gzip -fd /data/sonic-vm/images/sonic-vs.img.gz
username=$(id -un)
sudo chown -R $username.$username /data/sonic-vm
pushd /data/sonic-mgmt
git remote update
git reset --hard origin/master
sed -i s/use_own_value/${username}/ ansible/veos_vtb
echo aaa > ansible/password.txt
docker exec sonic-mgmt bash -c "pushd /data/sonic-mgmt/ansible;./testbed-cli.sh -d /data/sonic-vm -m $(inventory) -t $(testbed_file) -k ceos refresh-dut ${{ parameters.tbname }} password.txt" && sleep 180
displayName: "Setup testbed"

- script: |
rm -rf $(Build.ArtifactStagingDirectory)/*
docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }}"
displayName: "Run tests"

- script: |
# save dut state if test fails
virsh_version=$(virsh --version)
if [ $virsh_version == "6.0.0" ]; then
mkdir -p $(Build.ArtifactStagingDirectory)/kvmdump
virsh -c qemu:///system list
virsh -c qemu:///system save ${{ parameters.dut }} $(Build.ArtifactStagingDirectory)/kvmdump/${{ parameters.dut }}.memdmp
virsh -c qemu:///system dumpxml ${{ parameters.dut }} > $(Build.ArtifactStagingDirectory)/kvmdump/${{ parameters.dut }}.xml
img=$(virsh -c qemu:///system domblklist ${{ parameters.dut }} | grep vda | awk '{print $2}')
cp $img $(Build.ArtifactStagingDirectory)/kvmdump/${{ parameters.dut }}.img
virsh -c qemu:///system undefine ${{ parameters.dut }}
fi
docker commit ${{ parameters.ptf_name }} docker-ptf:$(Build.BuildNumber)
docker save docker-ptf:$(Build.BuildNumber) | gzip -c > $(Build.ArtifactStagingDirectory)/kvmdump/docker-ptf-dump.gz
docker rmi docker-ptf:$(Build.BuildNumber)
displayName: "Collect kvmdump"
condition: failed()

- script: |
cp -r /data/sonic-mgmt/tests/logs $(Build.ArtifactStagingDirectory)/
username=$(id -un)
sudo chown -R $username.$username $(Build.ArtifactStagingDirectory)
displayName: "Collect test logs"
condition: succeededOrFailed()

- publish: $(Build.ArtifactStagingDirectory)/kvmdump
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}.memdump@$(System.JobAttempt)
displayName: "Archive sonic kvm memdump"
condition: failed()

- publish: $(Build.ArtifactStagingDirectory)/logs
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}.log@$(System.JobAttempt)
displayName: "Archive sonic kvm logs"
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testResultsFiles: '$(Build.ArtifactStagingDirectory)/logs/**/*.xml'
testRunTitle: kvmtest.${{ parameters.tbtype }}
condition: succeededOrFailed()
35 changes: 35 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# rules are explained here
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @lguohan will be requested for review when someone opens
# a pull request.
* @lguohan

/device/ @jleveque

# build
/rules/ @qiluo-msft @xumia @lguohan
/Makefile @qiluo-msft @xumia @lguohan
/Makefile.cache @qiluo-msft @xumia @lguohan
/Makefile.work @qiluo-msft @xumia @lguohan
/slave.mk @qiluo-msft @xumia @lguohan
/scripts @qiluo-msft @xumia @lguohan

# installer
/installer/ @qiluo-msft

# permission
/files/image_config/sudoers/ @qiluo-msft

# dockers
/dockers/docker-base*/ @qiluo-msft
/dockers/docker-config-engine*/ @qiluo-msft
/dockers/docker-snmp/ @qiluo-msft

# src
/src/initramfs-tools/ @qiluo-msft
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Please provide the following information:
- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012

**- Description for the changelog**
<!--
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ target/

# Autogenerated Dockerfiles
sonic-slave*/Dockerfile
sonic-slave*/Dockerfile.user
dockers/*/Dockerfile
platform/*/docker-*/Dockerfile

Expand Down Expand Up @@ -61,3 +62,10 @@ platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_lpc.c
platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_ich.c
platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_mailbox.c
platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/ipmihelper.py

# buildinfo
files/build/buildinfo
files/build/tmp
dockers/**/buildinfo
platform/**/buildinfo
sonic-slave*/**/buildinfo
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
[submodule "src/sonic-frr/frr"]
path = src/sonic-frr/frr
url = https://github.com/Azure/sonic-frr.git
branch = frr/7.2
branch = frr/7.5
[submodule "platform/p4/p4-hlir/p4-hlir-v1.1"]
path = platform/p4/p4-hlir/p4-hlir-v1.1
url = https://github.com/p4lang/p4-hlir.git
Expand Down Expand Up @@ -85,3 +85,6 @@
[submodule "src/sonic-mgmt-common"]
path = src/sonic-mgmt-common
url = https://github.com/Azure/sonic-mgmt-common.git
[submodule "src/wpasupplicant/sonic-wpa-supplicant"]
path = src/wpasupplicant/sonic-wpa-supplicant
url = https://github.com/Azure/sonic-wpa-supplicant.git
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SONiC make file

NOJESSIE ?= 0
NOJESSIE ?= 1
NOSTRETCH ?= 0

%::
Expand All @@ -25,7 +25,11 @@ ifeq ($(NOSTRETCH), 0)
make -f Makefile.work stretch
endif

clean reset init configure showtag sonic-slave-build sonic-slave-bash :
init:
@echo "+++ Making $@ +++"
make -f Makefile.work $@

clean configure reset showtag sonic-slave-build sonic-slave-bash :
@echo "+++ Making $@ +++"
ifeq ($(NOJESSIE), 0)
make -f Makefile.work $@
Expand All @@ -34,3 +38,7 @@ ifeq ($(NOSTRETCH), 0)
BLDENV=stretch make -f Makefile.work $@
endif
BLDENV=buster make -f Makefile.work $@

# Freeze the versions, see more detail options: scripts/versions_manager.py freeze -h
freeze:
@scripts/versions_manager.py freeze $(FREEZE_VERSION_OPTIONS)
Loading

0 comments on commit a623ffd

Please sign in to comment.