-
Notifications
You must be signed in to change notification settings - Fork 264
/
build-sairedis-template.yml
167 lines (152 loc) · 4.91 KB
/
build-sairedis-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
parameters:
- name: arch
type: string
values:
- amd64
- armhf
- arm64
- name: pool
type: string
values:
- sonicbld
- default
default: default
- name: timeout
type: number
default: 90
- name: sonic_slave
type: string
- name: debian_version
type: string
default: buster
- 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 }}
${{ else }}:
vmImage: 'ubuntu-20.04'
container:
image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}
options: "--privileged"
steps:
- checkout: sonic-sairedis
submodules: true
clean: true
- script: |
set -ex
git checkout $(BUILD_BRANCH)
git submodule update
git status
displayName: Set up sonic-sairedis branch
- script: |
set -ex
sudo apt-get update
sudo apt-get install -qq -y \
qtbase5-dev \
libdbus-glib-1-dev \
libpcsclite-dev \
docbook-to-man \
docbook-utils \
aspell-en \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
libnl-cli-3-dev \
swig4.0 \
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 sed -ri 's/^databases .*/databases 17/' /etc/redis/redis.conf
sudo service redis-server start
sudo mkdir -m 755 /var/run/sswsyncd
sudo apt-get install -y rsyslog
sudo service rsyslog start
displayName: "Install dependencies"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: Azure.sonic-buildimage.common_libs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
artifact: common-lib
patterns: |
target/debs/${{ parameters.debian_version }}/libyang-*.deb
target/debs/${{ parameters.debian_version }}/libyang_*.deb
displayName: "Download libyang from common lib"
- script: |
set -ex
sudo dpkg -i $(find ./download -name *.deb)
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install libyang from common lib"
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ parameters.swss_common_artifact_name }}
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download pre-stage built ${{ parameters.swss_common_artifact_name }}"
- script: |
set -ex
sudo dpkg -i download/libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i download/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
rm -rf download || true
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install sonic swss Common"
- script: |
set -ex
rm ../*.deb || true
./autogen.sh
DEB_BUILD_OPTIONS=nocheck DEB_BUILD_PROFILES=nopython2 fakeroot dpkg-buildpackage -b -us -uc -Psyncd,vs,nopython2 -j$(nproc)
# Add SYS_TIME capability for settimeofday ok in syncd test
sudo setcap "cap_sys_time=eip" syncd/.libs/syncd_tests
# Add CAP_DAC_OVERRIDE capability for system directory creation in syncd unittest
sudo setcap "cap_dac_override,cap_ipc_lock,cap_ipc_owner,cap_sys_time=eip" unittest/syncd/.libs/tests
make check
mv ../*.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)/
# publish artifact with retry count, otherwise "artifact already exist" error will block job re-run.
artifact: ${{ parameters.syslog_artifact_name }}_$(System.JobAttempt)
displayName: "Publish syslog artifacts"
condition: always()