Skip to content

Commit 36d975b

Browse files
authored
Adding a build stage for arm64 cni (#990)
* Making multi-platform make target and integrating it into PR pipeline
1 parent 2e6a5f6 commit 36d975b

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

.pipelines/pipeline.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,17 @@ stages:
4242
name: "$(BUILD_POOL_NAME_DEFAULT)"
4343
steps:
4444
- script: |
45-
GOOS=windows make all-binaries VERSION=$(TAG)
46-
name: "BuildWindows"
47-
displayName: "Build Windows"
48-
49-
- script: |
50-
GOOS=linux make all-binaries VERSION=$(TAG)
51-
name: "BuildLinux"
52-
displayName: "Build Linux"
45+
make all-binaries-platforms VERSION=$(TAG)
46+
name: "BuildAllPlatformBinaries"
47+
displayName: "Build all platform binaries"
5348
5449
- script: |
5550
mkdir -p ./output/bins
56-
cd ./output/linux_amd64
57-
sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete
58-
sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \;
59-
sudo rm -R -- */ && cd ..
60-
cd ./windows_amd64
61-
sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete
62-
sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \;
63-
sudo rm -R -- */ && cd ..
64-
rmdir ./linux_amd64 && rmdir ./windows_amd64
51+
cd ./output
52+
find . -name '*.tgz' -print -exec mv -t ./bins/ {} +
53+
find . -name '*.zip' -print -exec mv -t ./bins/ {} +
54+
shopt -s extglob
55+
rm -rf !("bins")
6556
name: "PrepareArtifacts"
6657
displayName: "Prepare Artifacts"
6758

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SHELL=/bin/bash
2+
13
# Source files common to all targets.
24
COREFILES = \
35
$(wildcard common/*.go) \
@@ -74,6 +76,8 @@ NPMFILES = \
7476
# Build defaults.
7577
GOOS ?= linux
7678
GOARCH ?= amd64
79+
GOOSES ?= "linux windows" # To override at the cli do: GOOSES="\"darwin bsd\""
80+
GOARCHES ?= "amd64 arm64" # To override at the cli do: GOARCHES="\"ppc64 mips\""
7781

7882
# Build directories.
7983
ROOT_DIR = $(shell pwd)
@@ -167,6 +171,14 @@ CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef
167171
cnsaipath=github.com/Azure/azure-container-networking/cns/logger.aiMetadata
168172
ENSURE_OUTPUT_DIR_EXISTS := $(shell mkdir -p $(OUTPUT_DIR))
169173

174+
.PHONY: all-binaries-platforms
175+
all-binaries-platforms: ## Make all platform binaries
176+
@for goos in "$(GOOSES)"; do \
177+
for goarch in "$(GOARCHES)"; do \
178+
make all-binaries GOOS=$$goos GOARCH=$$goarch; \
179+
done \
180+
done
181+
170182
# Shorthand target names for convenience.
171183
azure-cnm-plugin: $(CNM_BUILD_DIR)/azure-vnet-plugin$(EXE_EXT) cnm-archive
172184
azure-vnet: $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT)
@@ -269,12 +281,6 @@ all-containerized:
269281
docker rm $(BUILD_CONTAINER_NAME)
270282
docker rmi $(BUILD_CONTAINER_IMAGE):$(VERSION)
271283

272-
# Make both linux and windows binaries
273-
.PHONY: all-binaries-platforms
274-
all-binaries-platforms:
275-
export GOOS=linux; make all-binaries
276-
export GOOS=windows; make all-binaries
277-
278284

279285
.PHONY: tools
280286
tools: acncli

0 commit comments

Comments
 (0)