Skip to content

Commit b313563

Browse files
[ci] Add arm artifacts in common lib azure pipeline (#10817)
* [ci] Add arm artifacts in common lib azure pipeline
1 parent 3928996 commit b313563

File tree

2 files changed

+56
-39
lines changed

2 files changed

+56
-39
lines changed
+52-39
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,53 @@
1-
jobs:
2-
- job: Build
3-
timeoutInMinutes: 120
4-
pool: sonicbld
5-
variables:
6-
- template: template-variables.yml
7-
steps:
8-
- checkout: self
9-
clean: true
10-
submodules: recursive
11-
- script: |
12-
set -ex
13-
branch=$(Build.SourceBranchName)
14-
# DIST_MASTER is set in variable.
15-
BRANCH=DIST_${branch^^}
16-
bldenvs=${!BRANCH}
17-
[ "$bldenvs" == "" ] && bldenvs="$(COMMON_LIB_BUILD_ENVS)"
18-
for bldenv in $bldenvs
19-
do
20-
BLDENV=$bldenv make -f Makefile.work configure PLATFORM=vs ENABLE_DOCKER_BASE_PULL=y
21-
done
22-
set +x
23-
echo "##vso[task.setvariable variable=bldenvs;]$bldenvs"
24-
displayName: Make configure
25-
- script: |
26-
set -ex
27-
for bldenv in $(bldenvs)
28-
do
29-
LIBNL3_VERSION_BASE=$(grep "LIBNL3_VERSION_BASE =" rules/libnl3.mk | awk '{print$3}')
30-
LIBNL3_VERSION=$(grep "LIBNL3_VERSION =" rules/libnl3.mk | awk '{print$3}' | sed -e "s/(//" -e "s/)//" -e "s/\\$//" -e "s/LIBNL3_VERSION_BASE/$LIBNL3_VERSION_BASE/")
31-
SONIC_BUILD_JOBS=$(nproc) BLDENV=$bldenv make -f Makefile.work target/debs/$bldenv/libnl-3-200_${LIBNL3_VERSION}_amd64.deb ENABLE_DOCKER_BASE_PULL=y
1+
parameters:
2+
- name: archs
3+
type: object
4+
default:
5+
- amd64
6+
- armhf
7+
- arm64
328

33-
LIBYANG_VERSION_BASE=$(grep "LIBYANG_VERSION_BASE =" rules/libyang.mk | awk '{print$3}')
34-
LIBYANG_VERSION=$(grep "LIBYANG_VERSION =" rules/libyang.mk | awk '{print$3}' | sed -e "s/\\$//" -e "s/(//" -e "s/)//" -e "s/LIBYANG_VERSION_BASE/$LIBYANG_VERSION_BASE/")
35-
SONIC_BUILD_JOBS=$(nproc) BLDENV=$bldenv make -f Makefile.work target/debs/$bldenv/libyang_${LIBYANG_VERSION}_amd64.deb
36-
done
37-
mv target $(Build.ArtifactStagingDirectory)
38-
displayName: Make common lib packages
39-
- publish: $(Build.ArtifactStagingDirectory)
40-
artifact: common-lib
9+
jobs:
10+
- ${{ each arch in parameters.archs }}:
11+
- job: Build_${{ arch }}
12+
timeoutInMinutes: 120
13+
${{ if eq(arch,'amd64') }}:
14+
pool: sonicbld
15+
${{ else }}:
16+
pool: sonicbld-${{ arch }}
17+
variables:
18+
- template: template-variables.yml
19+
steps:
20+
- checkout: self
21+
clean: true
22+
submodules: recursive
23+
- script: |
24+
set -ex
25+
branch=$(Build.SourceBranchName)
26+
# replace all: '-' -> '_'
27+
branch=${branch//-/_}
28+
# replace all: 'a' -> 'A', DIST_MASTER is set in variable.
29+
BRANCH=DIST_${branch^^}
30+
# variable name is dynamic
31+
bldenvs=${!BRANCH}
32+
[ "$bldenvs" == "" ] && bldenvs="$(COMMON_LIB_BUILD_ENVS)"
33+
for bldenv in $bldenvs
34+
do
35+
BLDENV=$bldenv make -f Makefile.work configure PLATFORM_ARCH=${{ arch }} PLATFORM=vs ENABLE_DOCKER_BASE_PULL=y
36+
done
37+
set +x
38+
echo "##vso[task.setvariable variable=bldenvs;]$bldenvs"
39+
displayName: Make configure
40+
- script: |
41+
set -ex
42+
for bldenv in $(bldenvs)
43+
do
44+
SONIC_BUILD_JOBS=$(nproc) BLDENV=$bldenv make -f Makefile.work lib-packages ENABLE_DOCKER_BASE_PULL=y
45+
done
46+
mv target $(Build.ArtifactStagingDirectory)
47+
displayName: Make common lib packages
48+
- ${{ if eq(arch,'amd64') }}:
49+
- publish: $(Build.ArtifactStagingDirectory)
50+
artifact: common-lib
51+
- ${{ else }}:
52+
- publish: $(Build.ArtifactStagingDirectory)
53+
artifact: common-lib.${{ arch }}

slave.mk

+4
Original file line numberDiff line numberDiff line change
@@ -1377,3 +1377,7 @@ jessie : $$(addprefix $(TARGET_PATH)/,$$(JESSIE_DOCKER_IMAGES)) \
13771377
.PHONY : $(SONIC_CLEAN_DEBS) $(SONIC_CLEAN_FILES) $(SONIC_CLEAN_TARGETS) $(SONIC_CLEAN_STDEB_DEBS) $(SONIC_CLEAN_WHEELS) $(SONIC_PHONY_TARGETS) clean distclean configure
13781378

13791379
.INTERMEDIATE : $(SONIC_INSTALL_DEBS) $(SONIC_INSTALL_WHEELS) $(DOCKER_LOAD_TARGETS) docker-start .platform
1380+
1381+
## To build some commonly used libs. Some submodules depend on these libs.
1382+
## It is used in component pipelines. For example: swss needs libnl, libyang
1383+
lib-packages: $(addprefix $(DEBS_PATH)/,$(LIBNL3) $(LIBYANG))

0 commit comments

Comments
 (0)