Skip to content

Commit

Permalink
[ci]: use build template (sonic-net#793)
Browse files Browse the repository at this point in the history
Signed-off-by: Guohan Lu <lguohan@gmail.com>
  • Loading branch information
lguohan authored Feb 12, 2021
1 parent 2675d59 commit e0748a6
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 257 deletions.
129 changes: 129 additions & 0 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
parameters:
- name: arch
type: string
values:
- amd64
- armhf
- arm64

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

- name: timeout
type: number
default: 60

- name: sonic_slave
type: string

- name: swss_common_artifact_name
type: string

- name: artifact_name
type: string

- name: syslog_artifact_name
type: string

- name: run_unit_test
type: boolean
default: false

jobs:
- job:
displayName: ${{ parameters.arch }}
timeoutInMinutes: ${{ parameters.timeout }}

pool:
${{ if ne(parameters.pool, 'default') }}:
name: ${{ parameters.pool }}
${{ if eq(parameters.pool, 'default') }}:
vmImage: 'ubuntu-20.04'

container:
image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest

steps:
- script: |
sudo apt-get install -qq -y \
qtbase5-dev \
libdbus-glib-1-2 \
libdbus-glib-1-dev \
libpcsclite-dev \
docbook-to-man \
docbook-utils \
aspell-en \
libhiredis0.14 \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
libnl-cli-3-dev \
swig3.0 \
libpython2.7-dev \
libzmq5 libzmq3-dev
sudo apt-get install -y redis-server
sudo sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf
sudo sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf
sudo sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf
sudo service redis-server start
sudo apt-get install -y rsyslog
sudo service rsyslog start
displayName: "Install dependencies"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
artifacts: ${{ parameters.swss_common_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic swss common deb packages"
- script: |
sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
workingDirectory: $(Pipeline.Workspace)
displayName: "Install sonic swss Common"
- checkout: self
submodules: true
- script: |
./autogen.sh
fakeroot dpkg-buildpackage -b -us -uc -Tbinary-syncd-vs -j$(nproc) && cp ../*.deb .
displayName: "Compile sonic sairedis"
- script: |
sudo cp azsyslog.conf /etc/rsyslog.conf
sudo service rsyslog restart
displayName: "Update rsyslog.conf"
- ${{ if eq(parameters.run_unit_test, true) }}:
- script: |
make check
displayName: "Run sonic sairedis unit tests"
- publish: $(System.DefaultWorkingDirectory)/
artifact: ${{ parameters.artifact_name }}
displayName: "Archive sonic sairedis debian packages"
- script: |
pwd
sudo chmod a+r /var/log/syslog*
tar -czf syslog-all.tgz /var/log/syslog*
ls -al .
ls -al /var/log/
displayName: "Env info"
condition: always()
- task: CopyFiles@2
displayName: "Copy syslog to staging directory"
condition: always()
inputs:
contents: 'syslog-all.tgz'
targetFolder: $(Build.ArtifactStagingDirectory)
- publish: $(Build.ArtifactStagingDirectory)/
artifact: ${{ parameters.syslog_artifact_name }}
displayName: "Publish syslog artifacts"
condition: always()
Loading

0 comments on commit e0748a6

Please sign in to comment.