diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 613c6eb058..e4eca77d0c 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -42,26 +42,17 @@ 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" + make all-binaries-platforms 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 ./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/ {} + + shopt -s extglob + rm -rf !("bins") name: "PrepareArtifacts" displayName: "Prepare Artifacts" diff --git a/Makefile b/Makefile index 879fd37396..a24cce9997 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +SHELL=/bin/bash + # Source files common to all targets. COREFILES = \ $(wildcard common/*.go) \ @@ -74,6 +76,8 @@ NPMFILES = \ # Build defaults. GOOS ?= linux GOARCH ?= amd64 +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) @@ -167,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) @@ -269,12 +281,6 @@ all-containerized: docker rm $(BUILD_CONTAINER_NAME) docker rmi $(BUILD_CONTAINER_IMAGE):$(VERSION) -# Make both linux and windows binaries -.PHONY: all-binaries-platforms -all-binaries-platforms: - export GOOS=linux; make all-binaries - export GOOS=windows; make all-binaries - .PHONY: tools tools: acncli