-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
142 lines (116 loc) · 4.2 KB
/
Copy pathazure-pipelines.yml
File metadata and controls
142 lines (116 loc) · 4.2 KB
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
# 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
trigger:
branches:
include:
- master
- 202???
pr:
branches:
include:
- master
- 202???
variables:
- name: BUILD_BRANCH
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
value: $(System.PullRequest.TargetBranch)
${{ else }}:
value: $(Build.SourceBranchName)
resources:
repositories:
- repository: sonic-mgmt-common
type: github
name: sonic-net/sonic-mgmt-common
endpoint: sonic-net
ref: refs/heads/$(BUILD_BRANCH)
stages:
- stage: Build
jobs:
- job:
displayName: "build"
timeoutInMinutes: 60
pool:
vmImage: ubuntu-latest
container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-trixie:latest
steps:
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'
- checkout: sonic-mgmt-common
clean: true
submodules: recursive
displayName: 'Checkout sonic-mgmt-common'
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: Azure.sonic-buildimage.official.vs
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
patterns: |
target/debs/trixie/libpcre3_*.deb
target/debs/trixie/libpcre16-3_*.deb
target/debs/trixie/libpcre32-3_*.deb
target/debs/trixie/libpcrecpp0v5_*.deb
target/debs/trixie/libyang3_*.deb
target/debs/trixie/libyang-dev_3*.deb
target/debs/trixie/python3-libyang_*.deb
target/python-wheels/trixie/sonic_yang_models*.whl
displayName: "Download sonic buildimage"
- script: |
# REDIS
sudo apt-get update
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
# LIBPCRE3 (not in Trixie repos, required by libyang3)
sudo dpkg -i ../target/debs/trixie/libpcre3_*.deb \
../target/debs/trixie/libpcre16-3_*.deb \
../target/debs/trixie/libpcre32-3_*.deb \
../target/debs/trixie/libpcrecpp0v5_*.deb
# LIBYANG
sudo dpkg -i ../target/debs/trixie/libyang3_*.deb \
../target/debs/trixie/libyang-dev_3*.deb \
../target/debs/trixie/python3-libyang_*.deb
# Install from "requirement" files in sonic-mgmt-framework/tools/test directory.
pushd sonic-mgmt-framework/tools/test
[[ ! -f apt_requirements.txt ]] || \
sed 's/#.*//' apt_requirements.txt | xargs -r sudo apt-get install -y
[[ ! -f python2_requirements.txt ]] || \
sudo pip install --no-cache-dir -r python2_requirements.txt
[[ ! -f python3_requirements.txt ]] || \
sudo pip3 install --no-cache-dir -r python3_requirements.txt
displayName: "Install dependency"
- script: |
sudo pip3 install ../target/python-wheels/trixie/sonic_yang_models*.whl
displayName: "Install sonic yangs"
- script: |
set -ex
pushd sonic-mgmt-common
NO_TEST_BINS=1 dpkg-buildpackage -rfakeroot -b -us -uc -j$(nproc)
displayName: "Build sonic-mgmt-common"
- script: |
set -ex
pushd sonic-mgmt-framework
dpkg-buildpackage -rfakeroot -us -uc -b -j$(nproc) && cp ../*.deb $(Build.ArtifactStagingDirectory)/
displayName: "Build"
- publish: $(Build.ArtifactStagingDirectory)/
artifact: sonic-mgmt-framework
displayName: "Archive artifacts"
- script: |
# Run REST Server gotests
pushd sonic-mgmt-framework
tools/test/rest-gotest.sh -bin
displayName: "REST Server Sanity Test"
- script: |
# KLISH sanity
pushd sonic-mgmt-framework
tools/test/cli.sh -c 'exit'
displayName: "KLISH Sanity Test"