From faa6e0d7abf306f28ff184fe4100da030e50aa05 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Thu, 2 Sep 2021 16:47:00 -0700 Subject: [PATCH 1/7] Adding a build stage for arm64 cni --- .pipelines/pipeline.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 613c6eb058..0afb505f68 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -51,6 +51,11 @@ stages: name: "BuildLinux" displayName: "Build Linux" + - script: | + GOOS=linux GOARCH=arm64 make azure-cni-plugin VERSION=$(TAG) + name: "BuildCNIArm64" + displayName: "Build CNI ARM64" + - script: | mkdir -p ./output/bins cd ./output/linux_amd64 From 05ee2267c2e07314fccff14cf0ca665eb0fdb882 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Thu, 2 Sep 2021 17:03:27 -0700 Subject: [PATCH 2/7] Move arm64 binaries --- .pipelines/pipeline.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 0afb505f68..79c4234198 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -62,6 +62,10 @@ stages: sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \; sudo rm -R -- */ && cd .. + cd ./output/linux_arm64 + sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete + sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \; + sudo rm -R -- */ && cd .. cd ./windows_amd64 sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \; From ca2453ea0402e62d4a134b1f13df3fa6f39d63b5 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Fri, 3 Sep 2021 10:56:39 -0700 Subject: [PATCH 3/7] MAking build matrix for binaries and changing pipeline to allow for that --- .pipelines/pipeline.yaml | 33 +++++++-------------------------- Makefile | 11 ++++++++--- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 79c4234198..9647537f35 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -42,35 +42,16 @@ stages: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: - script: | - GOOS=windows make all-binaries VERSION=$(TAG) - name: "BuildWindows" - displayName: "Build Windows" - - - script: | - GOOS=linux make all-binaries VERSION=$(TAG) - name: "BuildLinux" - displayName: "Build Linux" - - - script: | - GOOS=linux GOARCH=arm64 make azure-cni-plugin VERSION=$(TAG) - name: "BuildCNIArm64" - displayName: "Build CNI ARM64" + make all-binaries-platforms GOOS=linux,windows GOARCH=amd64,arm64 VERSION=$(TAG) + name: "BuildAllPlatformBinaries" + displayName: "Build all platform binaries" - script: | mkdir -p ./output/bins - cd ./output/linux_amd64 - sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete - sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \; - sudo rm -R -- */ && cd .. - cd ./output/linux_arm64 - sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete - sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \; - sudo rm -R -- */ && cd .. - cd ./windows_amd64 - sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete - sudo find . -mindepth 2 -type f -print -exec mv {} ../bins \; - sudo rm -R -- */ && cd .. - rmdir ./linux_amd64 && rmdir ./windows_amd64 + cd ./output + find . -name '*.tgz' -print -exec mv -t ./bins/ {} +; + find . -name '*.zip' -print -exec mv -t ./bins/ {} +; + rm -rf !("bins") name: "PrepareArtifacts" displayName: "Prepare Artifacts" diff --git a/Makefile b/Makefile index 879fd37396..6513957fd0 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +SHELL=/bin/bash + # Source files common to all targets. COREFILES = \ $(wildcard common/*.go) \ @@ -269,11 +271,14 @@ all-containerized: docker rm $(BUILD_CONTAINER_NAME) docker rmi $(BUILD_CONTAINER_IMAGE):$(VERSION) -# Make both linux and windows binaries +# Make all platform binaries .PHONY: all-binaries-platforms all-binaries-platforms: - export GOOS=linux; make all-binaries - export GOOS=windows; make all-binaries + for goos in $$(echo $(GOOS) | sed "s/,/ /g"); do \ + for goarch in $$(echo $(GOARCH) | sed "s/,/ /g"); do \ + make all-binaries GOOS=$$goos GOARCH=$$goarch; \ + done \ + done .PHONY: tools From a2231f1c6a363cc4f5957c71052f71f1cc50700c Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Fri, 3 Sep 2021 15:23:28 -0700 Subject: [PATCH 4/7] without ; --- .pipelines/pipeline.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 9647537f35..bebc68d9a0 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -49,8 +49,8 @@ stages: - script: | mkdir -p ./output/bins cd ./output - find . -name '*.tgz' -print -exec mv -t ./bins/ {} +; - find . -name '*.zip' -print -exec mv -t ./bins/ {} +; + find . -name '*.tgz' -print -exec mv -t ./bins/ {} + + find . -name '*.zip' -print -exec mv -t ./bins/ {} + rm -rf !("bins") name: "PrepareArtifacts" displayName: "Prepare Artifacts" From 3bb8e8f7aaf183384d2762728f31a16c1262dd63 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 8 Sep 2021 11:26:21 -0700 Subject: [PATCH 5/7] Enable options --- .pipelines/pipeline.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index bebc68d9a0..f14eeb9793 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -51,6 +51,7 @@ stages: cd ./output find . -name '*.tgz' -print -exec mv -t ./bins/ {} + find . -name '*.zip' -print -exec mv -t ./bins/ {} + + shopt -s extglob rm -rf !("bins") name: "PrepareArtifacts" displayName: "Prepare Artifacts" From d29e718e3ce4e4d87bfa4f6b1c4ba290057cf603 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 8 Sep 2021 11:55:08 -0700 Subject: [PATCH 6/7] Addressed Evan's requested changes hopefully --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 6513957fd0..550c009492 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,8 @@ NPMFILES = \ # Build defaults. GOOS ?= linux GOARCH ?= amd64 +GOOSES ?= "linux windows" +GOARCHES ?= "amd64 arm64" # Build directories. ROOT_DIR = $(shell pwd) @@ -169,6 +171,14 @@ CNS_AI_ID = ce672799-8f08-4235-8c12-08563dc2acef cnsaipath=github.com/Azure/azure-container-networking/cns/logger.aiMetadata ENSURE_OUTPUT_DIR_EXISTS := $(shell mkdir -p $(OUTPUT_DIR)) +.PHONY: all-binaries-platforms +all-binaries-platforms: ## Make all platform binaries + @for goos in "$(GOOSES)"; do \ + for goarch in "$(GOARCHES)"; do \ + make all-binaries GOOS=$$goos GOARCH=$$goarch; \ + done \ + done + # Shorthand target names for convenience. azure-cnm-plugin: $(CNM_BUILD_DIR)/azure-vnet-plugin$(EXE_EXT) cnm-archive azure-vnet: $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) @@ -271,15 +281,6 @@ all-containerized: docker rm $(BUILD_CONTAINER_NAME) docker rmi $(BUILD_CONTAINER_IMAGE):$(VERSION) -# Make all platform binaries -.PHONY: all-binaries-platforms -all-binaries-platforms: - for goos in $$(echo $(GOOS) | sed "s/,/ /g"); do \ - for goarch in $$(echo $(GOARCH) | sed "s/,/ /g"); do \ - make all-binaries GOOS=$$goos GOARCH=$$goarch; \ - done \ - done - .PHONY: tools tools: acncli From 5c85bdd55f10dd92f0ab95f673d3e24606451c23 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Wed, 8 Sep 2021 12:42:13 -0700 Subject: [PATCH 7/7] Addressing some more changes --- .pipelines/pipeline.yaml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index f14eeb9793..e4eca77d0c 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -42,7 +42,7 @@ stages: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: - script: | - make all-binaries-platforms GOOS=linux,windows GOARCH=amd64,arm64 VERSION=$(TAG) + make all-binaries-platforms VERSION=$(TAG) name: "BuildAllPlatformBinaries" displayName: "Build all platform binaries" diff --git a/Makefile b/Makefile index 550c009492..a24cce9997 100644 --- a/Makefile +++ b/Makefile @@ -76,8 +76,8 @@ NPMFILES = \ # Build defaults. GOOS ?= linux GOARCH ?= amd64 -GOOSES ?= "linux windows" -GOARCHES ?= "amd64 arm64" +GOOSES ?= "linux windows" # To override at the cli do: GOOSES="\"darwin bsd\"" +GOARCHES ?= "amd64 arm64" # To override at the cli do: GOARCHES="\"ppc64 mips\"" # Build directories. ROOT_DIR = $(shell pwd)