From 175bbeb7ca8a88c9eec2016b8554adf9bd4a406d Mon Sep 17 00:00:00 2001 From: Jaeryn Date: Thu, 21 Apr 2022 09:49:14 -0700 Subject: [PATCH 1/7] add windows cns manifest to multi arch image --- .pipelines/containers/manifest-template.yaml | 5 +- .pipelines/pipeline.yaml | 7 ++- .pipelines/windows-image.yaml | 50 +++++++++++++++++++ Makefile | 9 ++-- ...{Dockerfile.windows => windows.Dockerfile} | 0 windows.ps1 | 17 ++++++- 6 files changed, 79 insertions(+), 9 deletions(-) rename npm/{Dockerfile.windows => windows.Dockerfile} (100%) diff --git a/.pipelines/containers/manifest-template.yaml b/.pipelines/containers/manifest-template.yaml index aa3c44e2c9..793882aecb 100644 --- a/.pipelines/containers/manifest-template.yaml +++ b/.pipelines/containers/manifest-template.yaml @@ -1,7 +1,6 @@ parameters: name: "" - oses: "" - arches: "" + platforms: "" tag: "" steps: @@ -14,7 +13,7 @@ steps: - script: | set -e - make ${{ parameters.name }}-multiarch-manifest-create OSES="${{ parameters.oses }}" ARCHES="${{ parameters.arches }}" TAG=${{ parameters.tag }} + make ${{ parameters.name }}-multiarch-manifest-create PLATFORMS="${{ parameters.platforms }}" TAG=${{ parameters.tag }} make ${{ parameters.name }}-image-info TAG=${{ parameters.tag }} name: manifest_build displayName: Manifest Build diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 50fc83b204..c714c1778c 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -189,6 +189,7 @@ stages: dependsOn: - setup - containerize + - build_windows_images jobs: - job: manifest displayName: Compile Manifests @@ -200,16 +201,18 @@ stages: matrix: cni-manager: name: cni-manager + platforms: linux/amd64 linux/arm64 cns: name: cns + platforms: linux/amd64 linux/arm64 windows/amd64 npm: name: npm + platforms: linux/amd64 linux/arm64 steps: - template: containers/manifest-template.yaml parameters: name: $(name) - oses: linux - arches: amd64 arm64 + platforms: $(platforms) tag: $(TAG) - template: singletenancy/aks-swift/e2e-job-template.yaml diff --git a/.pipelines/windows-image.yaml b/.pipelines/windows-image.yaml index 5fee9f04e8..60960cbe53 100644 --- a/.pipelines/windows-image.yaml +++ b/.pipelines/windows-image.yaml @@ -54,3 +54,53 @@ stages: artifactName: "output" pathtoPublish: "$(Build.ArtifactStagingDirectory)" condition: succeeded() + - job: CNS + displayName: Build CNS + variables: + tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + pool: + name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" + steps: + - powershell: | + powershell.exe -command "& { . .\windows.ps1; Retry({cns-image windows-amd64-$(tag)}) }" + name: "build_cns" + displayName: "Build" + + - task: Docker@2 + displayName: Docker Login + inputs: + containerRegistry: $(ACR_SERVICE_CONNECTION) + command: 'login' + addPipelineData: false + + - powershell: | + docker tag acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) + docker push acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) + name: "push_cns" + displayName: "Push" + + - powershell: | + mkdir .\output\images\windows\ + docker save acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) -o .\output\images\windows\azure-cns-windows-amd64-$(tag).tar + name: "save_cns" + displayName: "Save" + + - task: Docker@2 + displayName: Docker Logout + inputs: + containerRegistry: $(ACR_SERVICE_CONNECTION) + command: 'logout' + addPipelineData: false + + - task: CopyFiles@2 + inputs: + sourceFolder: "output" + targetFolder: $(Build.ArtifactStagingDirectory) + condition: succeeded() + + - task: PublishBuildArtifacts@1 + inputs: + artifactName: "output" + pathtoPublish: "$(Build.ArtifactStagingDirectory)" + condition: succeeded() + \ No newline at end of file diff --git a/Makefile b/Makefile index 3a35adcea5..aa08c2ca1d 100644 --- a/Makefile +++ b/Makefile @@ -349,10 +349,13 @@ azure-cnm-plugin-image: azure-cnm-plugin ## build the azure-cnm plugin container ## This section is for building multi-arch/os container image manifests. -multiarch-manifest-create: # util target to compose multiarch container manifests from os/arch images. - $(CONTAINER_BUILDER) manifest create \ +multiarch-image-pull-docker: # util target to pull all variants of a multi-arch/os image + $(foreach PLATFORM,$(PLATFORMS),docker pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) + +multiarch-manifest-create-docker: # util target to compose multiarch container manifests from os/arch images. + docker manifest create \ $(REGISTRY)/$(IMAGE):$(TAG) \ - $(foreach OS,$(OSES),$(foreach ARCH,$(ARCHES),$(REGISTRY)/$(IMAGE):$(OS)-$(ARCH)-$(TAG))) + $(foreach PLATFORM,$(PLATFORMS),docker pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) multiarch-manifest-push: # util target to push multiarch container manifest. $(CONTAINER_BUILDER) manifest push $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(TAG) diff --git a/npm/Dockerfile.windows b/npm/windows.Dockerfile similarity index 100% rename from npm/Dockerfile.windows rename to npm/windows.Dockerfile diff --git a/windows.ps1 b/windows.ps1 index 54e242187f..af7f1b139d 100644 --- a/windows.ps1 +++ b/windows.ps1 @@ -27,10 +27,25 @@ function npm-image { if ($null -eq $env:VERSION) { $env:VERSION = $args[0] } docker build ` - -f npm/Dockerfile.windows ` + -f npm/windows.Dockerfile ` -t acnpublic.azurecr.io/azure-npm:$env:VERSION ` --build-arg VERSION=$env:VERSION ` --build-arg NPM_AI_PATH=$env:NPM_AI_PATH ` --build-arg NPM_AI_ID=$env:NPM_AI_ID ` . } + +function cns-image { + $env:ACN_PACKAGE_PATH = "github.com/Azure/azure-container-networking" + $env:CNS_AI_ID = "ce672799-8f08-4235-8c12-08563dc2acef" + $env:CNS_AI_PATH = "$env:ACN_PACKAGE_PATH/cns/logger.aiMetadata" + + if ($null -eq $env:VERSION) { $env:VERSION = $args[0] } + docker build ` + -f cns/windows.Dockerfile ` + -t acnpublic.azurecr.io/azure-cns:$env:VERSION ` + --build-arg VERSION=$env:VERSION ` + --build-arg CNS_AI_PATH=$env:CNS_AI_PATH ` + --build-arg CNS_AI_ID=$env:CNS_AI_ID ` + . +} From b665d9ff636d8e2c050b85a02ed75e26584410f8 Mon Sep 17 00:00:00 2001 From: Jaeryn Date: Thu, 21 Apr 2022 17:03:11 -0700 Subject: [PATCH 2/7] try to use generic windows template w/ containerize stage in pipeline --- .../container-template-windows.yaml | 31 ++++++++++++ .pipelines/containers/manifest-template.yaml | 2 +- .pipelines/pipeline.yaml | 18 ++++++- .pipelines/windows-image.yaml | 50 ------------------- Makefile | 4 +- 5 files changed, 51 insertions(+), 54 deletions(-) create mode 100644 .pipelines/containers/container-template-windows.yaml diff --git a/.pipelines/containers/container-template-windows.yaml b/.pipelines/containers/container-template-windows.yaml new file mode 100644 index 0000000000..4a2860e719 --- /dev/null +++ b/.pipelines/containers/container-template-windows.yaml @@ -0,0 +1,31 @@ +parameters: + name: "" + arch: "" + tag: "" + +steps: +- task: Docker@2 + displayName: Login + inputs: + containerRegistry: $(ACR_SERVICE_CONNECTION) + command: 'login' + addPipelineData: false + +- powershell: | + powershell.exe -command "& { . .\windows.ps1; Retry({${{ parameters.name }}-image windows-${{ parameters.arch }}-${{ parameters.tag }}}) }" + name: image_build + displayName: Image Build + +- powershell: | + $registry = "acnpublic.azurecr.io" + docker push $registry/azure-${{ parameters.name }}:windows-${{ parameters.arch }}-${{ parameters.tag }} + name: image_push + displayName: Image Push + retryCountOnTaskFailure: 3 + +- task: Docker@2 + displayName: Logout + inputs: + containerRegistry: $(ACR_SERVICE_CONNECTION) + command: 'logout' + addPipelineData: false diff --git a/.pipelines/containers/manifest-template.yaml b/.pipelines/containers/manifest-template.yaml index 793882aecb..a474693300 100644 --- a/.pipelines/containers/manifest-template.yaml +++ b/.pipelines/containers/manifest-template.yaml @@ -13,7 +13,7 @@ steps: - script: | set -e - make ${{ parameters.name }}-multiarch-manifest-create PLATFORMS="${{ parameters.platforms }}" TAG=${{ parameters.tag }} + make ${{ parameters.name }}-multiarch-manifest-create REGISTRY=$IMAGE_REGISTRY PLATFORMS="${{ parameters.platforms }}" TAG=${{ parameters.tag }} make ${{ parameters.name }}-image-info TAG=${{ parameters.tag }} name: manifest_build displayName: Manifest Build diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index c714c1778c..f77366ae3e 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -183,13 +183,29 @@ stages: os: $(os) arch: $(arch) tag: $(TAG) + - job: containerize_windows + displayName: Build Images + variables: + TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + pool: + name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" + strategy: + matrix: + cns_windows_amd64: + arch: amd64 + name: cns + steps: + - template: containers/container-template-windows.yaml + parameters: + name: $(name) + arch: $(arch) + tag: $(TAG) - stage: publish displayName: Publish Multiarch Manifests dependsOn: - setup - containerize - - build_windows_images jobs: - job: manifest displayName: Compile Manifests diff --git a/.pipelines/windows-image.yaml b/.pipelines/windows-image.yaml index 60960cbe53..5fee9f04e8 100644 --- a/.pipelines/windows-image.yaml +++ b/.pipelines/windows-image.yaml @@ -54,53 +54,3 @@ stages: artifactName: "output" pathtoPublish: "$(Build.ArtifactStagingDirectory)" condition: succeeded() - - job: CNS - displayName: Build CNS - variables: - tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] - pool: - name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" - steps: - - powershell: | - powershell.exe -command "& { . .\windows.ps1; Retry({cns-image windows-amd64-$(tag)}) }" - name: "build_cns" - displayName: "Build" - - - task: Docker@2 - displayName: Docker Login - inputs: - containerRegistry: $(ACR_SERVICE_CONNECTION) - command: 'login' - addPipelineData: false - - - powershell: | - docker tag acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) - docker push acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) - name: "push_cns" - displayName: "Push" - - - powershell: | - mkdir .\output\images\windows\ - docker save acnpublic.azurecr.io/azure-cns:windows-amd64-$(tag) -o .\output\images\windows\azure-cns-windows-amd64-$(tag).tar - name: "save_cns" - displayName: "Save" - - - task: Docker@2 - displayName: Docker Logout - inputs: - containerRegistry: $(ACR_SERVICE_CONNECTION) - command: 'logout' - addPipelineData: false - - - task: CopyFiles@2 - inputs: - sourceFolder: "output" - targetFolder: $(Build.ArtifactStagingDirectory) - condition: succeeded() - - - task: PublishBuildArtifacts@1 - inputs: - artifactName: "output" - pathtoPublish: "$(Build.ArtifactStagingDirectory)" - condition: succeeded() - \ No newline at end of file diff --git a/Makefile b/Makefile index aa08c2ca1d..fd85b2f6db 100644 --- a/Makefile +++ b/Makefile @@ -350,12 +350,12 @@ azure-cnm-plugin-image: azure-cnm-plugin ## build the azure-cnm plugin container ## This section is for building multi-arch/os container image manifests. multiarch-image-pull-docker: # util target to pull all variants of a multi-arch/os image - $(foreach PLATFORM,$(PLATFORMS),docker pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) + $(foreach PLATFORM,$(PLATFORMS),docker pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);) multiarch-manifest-create-docker: # util target to compose multiarch container manifests from os/arch images. docker manifest create \ $(REGISTRY)/$(IMAGE):$(TAG) \ - $(foreach PLATFORM,$(PLATFORMS),docker pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) + $(foreach PLATFORM,$(PLATFORMS),$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) multiarch-manifest-push: # util target to push multiarch container manifest. $(CONTAINER_BUILDER) manifest push $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(TAG) From 249b00443f6afa50a8ea5d9ff5f386c7dbe21dad Mon Sep 17 00:00:00 2001 From: Jaeryn Date: Wed, 27 Apr 2022 15:35:52 -0700 Subject: [PATCH 3/7] try and use buildah to pull images --- .../containers/container-template-windows.yaml | 2 +- Makefile | 13 +++++-------- cns/windows.Dockerfile | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.pipelines/containers/container-template-windows.yaml b/.pipelines/containers/container-template-windows.yaml index 4a2860e719..344c2a714f 100644 --- a/.pipelines/containers/container-template-windows.yaml +++ b/.pipelines/containers/container-template-windows.yaml @@ -15,7 +15,7 @@ steps: powershell.exe -command "& { . .\windows.ps1; Retry({${{ parameters.name }}-image windows-${{ parameters.arch }}-${{ parameters.tag }}}) }" name: image_build displayName: Image Build - + - powershell: | $registry = "acnpublic.azurecr.io" docker push $registry/azure-${{ parameters.name }}:windows-${{ parameters.arch }}-${{ parameters.tag }} diff --git a/Makefile b/Makefile index fd85b2f6db..7462dfaf51 100644 --- a/Makefile +++ b/Makefile @@ -349,8 +349,8 @@ azure-cnm-plugin-image: azure-cnm-plugin ## build the azure-cnm plugin container ## This section is for building multi-arch/os container image manifests. -multiarch-image-pull-docker: # util target to pull all variants of a multi-arch/os image - $(foreach PLATFORM,$(PLATFORMS),docker pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);) +multiarch-image-pull: # util target to pull all variants of a multi-arch/os image + $(foreach PLATFORM,$(PLATFORMS),$(CONTAINER_BUILDER) pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);) multiarch-manifest-create-docker: # util target to compose multiarch container manifests from os/arch images. docker manifest create \ @@ -362,24 +362,21 @@ multiarch-manifest-push: # util target to push multiarch container manifest. cni-manager-multiarch-manifest-create: ## build cni-manager multi-arch container manifest. $(MAKE) multiarch-manifest-create \ - OSES="$(OSES)" \ - ARCHES="$(ARCHES)" \ + PLATFORMS="$(PLATFORMS)" \ REGISTRY=$(IMAGE_REGISTRY) \ IMAGE=$(CNI_IMAGE) \ TAG=$(TAG) cns-multiarch-manifest-create: ## build azure-cns multi-arch container manifest. $(MAKE) multiarch-manifest-create \ - OSES="$(OSES)" \ - ARCHES="$(ARCHES)" \ + PLATFORMS="$(PLATFORMS)" \ REGISTRY=$(IMAGE_REGISTRY) \ IMAGE=$(CNS_IMAGE) \ TAG=$(TAG) npm-multiarch-manifest-create: ## build azure-npm multi-arch container manifest. $(MAKE) multiarch-manifest-create \ - OSES="$(OSES)" \ - ARCHES="$(ARCHES)" \ + PLATFORMS="$(PLATFORMS)" \ REGISTRY=$(IMAGE_REGISTRY) \ IMAGE=$(NPM_IMAGE) \ TAG=$(TAG) diff --git a/cns/windows.Dockerfile b/cns/windows.Dockerfile index 47ae1c7ad9..e65f20cf4e 100644 --- a/cns/windows.Dockerfile +++ b/cns/windows.Dockerfile @@ -1,5 +1,5 @@ # Build cns -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.18 AS builder +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.18-windowsservercore-ltsc2022 AS builder # Build args ARG VERSION ARG CNS_AI_PATH @@ -14,7 +14,7 @@ COPY . . RUN $Env:CGO_ENABLED=0; go build -v -o /usr/local/bin/azure-cns.exe -ldflags """-X main.version=${env:VERSION} -X ${env:CNS_AI_PATH}=${env:CNS_AI_ID}""" -gcflags="-dwarflocationlists=true" ./cns/service # Copy into final image -FROM mcr.microsoft.com/windows/nanoserver:1809 +FROM mcr.microsoft.com/windows/servercore:ltsc2022 COPY --from=builder /usr/local/bin/azure-cns.exe \ /usr/local/bin/azure-cns.exe From 714962010c1411a20fc88464d22127a5b9033941 Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Wed, 27 Apr 2022 18:52:15 -0500 Subject: [PATCH 4/7] update manifest build and push for buildah --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7462dfaf51..434548bca7 100644 --- a/Makefile +++ b/Makefile @@ -352,8 +352,8 @@ azure-cnm-plugin-image: azure-cnm-plugin ## build the azure-cnm plugin container multiarch-image-pull: # util target to pull all variants of a multi-arch/os image $(foreach PLATFORM,$(PLATFORMS),$(CONTAINER_BUILDER) pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);) -multiarch-manifest-create-docker: # util target to compose multiarch container manifests from os/arch images. - docker manifest create \ +multiarch-manifest-create: # util target to compose multiarch container manifests from os/arch images. + $(CONTAINER_BUILDER) manifest create \ $(REGISTRY)/$(IMAGE):$(TAG) \ $(foreach PLATFORM,$(PLATFORMS),$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) From 3edce81f8d9f6369df5f491073f9dce13e77fc35 Mon Sep 17 00:00:00 2001 From: Jaeryn Date: Mon, 2 May 2022 09:51:07 -0700 Subject: [PATCH 5/7] create manifest by referencing images instead of pulling to avoid OS mismatch error --- .pipelines/pipeline.yaml | 9 +++++---- Makefile | 15 ++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index f77366ae3e..955d099706 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -35,7 +35,7 @@ stages: condition: always() - stage: test - displayName: Test + displayName: Test ACN dependsOn: - setup jobs: @@ -136,8 +136,6 @@ stages: - publish: ./test/apimodels/ artifact: clusterdefinitions - - template: windows-image.yaml - - stage: containerize displayName: Build Images dependsOn: @@ -194,6 +192,9 @@ stages: cns_windows_amd64: arch: amd64 name: cns + npm_windows_amd64: + arch: amd64 + name: npm steps: - template: containers/container-template-windows.yaml parameters: @@ -223,7 +224,7 @@ stages: platforms: linux/amd64 linux/arm64 windows/amd64 npm: name: npm - platforms: linux/amd64 linux/arm64 + platforms: linux/amd64 linux/arm64 windows/amd64 steps: - template: containers/manifest-template.yaml parameters: diff --git a/Makefile b/Makefile index 434548bca7..738c03ab8b 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ GOOS ?= $(shell go env GOOS) GOARCH ?= $(shell go env GOARCH) GOOSES ?= "linux windows" # To override at the cli do: GOOSES="\"darwin bsd\"" GOARCHES ?= "amd64 arm64" # To override at the cli do: GOARCHES="\"ppc64 mips\"" +WINVER ?= "10.0.20348.643" # Windows specific extensions ifeq ($(GOOS),windows) @@ -349,16 +350,16 @@ azure-cnm-plugin-image: azure-cnm-plugin ## build the azure-cnm plugin container ## This section is for building multi-arch/os container image manifests. -multiarch-image-pull: # util target to pull all variants of a multi-arch/os image - $(foreach PLATFORM,$(PLATFORMS),$(CONTAINER_BUILDER) pull $(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);) - multiarch-manifest-create: # util target to compose multiarch container manifests from os/arch images. - $(CONTAINER_BUILDER) manifest create \ - $(REGISTRY)/$(IMAGE):$(TAG) \ - $(foreach PLATFORM,$(PLATFORMS),$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG)) + $(CONTAINER_BUILDER) manifest create $(REGISTRY)/$(IMAGE):$(TAG) + $(foreach PLATFORM,$(PLATFORMS), \ + $(if $(filter $(PLATFORM),windows/amd64), \ + $(CONTAINER_BUILDER) manifest add --os-version=$(WINVER) $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG); \ + , \ + $(CONTAINER_BUILDER) manifest add $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);)) multiarch-manifest-push: # util target to push multiarch container manifest. - $(CONTAINER_BUILDER) manifest push $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(TAG) + $(CONTAINER_BUILDER) manifest push --all $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(TAG) cni-manager-multiarch-manifest-create: ## build cni-manager multi-arch container manifest. $(MAKE) multiarch-manifest-create \ From 877ed96d90a65c14712f1186c521106187887ebc Mon Sep 17 00:00:00 2001 From: Jaeryn Date: Wed, 4 May 2022 16:36:15 -0700 Subject: [PATCH 6/7] remove unused windows-image.yaml --- .pipelines/windows-image.yaml | 56 ----------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 .pipelines/windows-image.yaml diff --git a/.pipelines/windows-image.yaml b/.pipelines/windows-image.yaml deleted file mode 100644 index 5fee9f04e8..0000000000 --- a/.pipelines/windows-image.yaml +++ /dev/null @@ -1,56 +0,0 @@ -stages: -- stage: build_windows_images - displayName: Build Windows Images - dependsOn: - - setup - - test - jobs: - - job: NPM - displayName: Build NPM - variables: - tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] - pool: - name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" - steps: - - powershell: | - powershell.exe -command "& { . .\windows.ps1; Retry({npm-image windows-amd64-$(tag)}) }" - name: "build_npm" - displayName: "Build" - - - task: Docker@2 - displayName: Docker Login - inputs: - containerRegistry: $(ACR_SERVICE_CONNECTION) - command: 'login' - addPipelineData: false - - - powershell: | - docker tag acnpublic.azurecr.io/azure-npm:windows-amd64-$(tag) acnpublic.azurecr.io/azure-npm:windows-amd64-$(tag)-test - docker push acnpublic.azurecr.io/azure-npm:windows-amd64-$(tag)-test - name: "push_npm" - displayName: "Push" - - - powershell: | - mkdir .\output\images\windows\ - docker save acnpublic.azurecr.io/azure-npm:windows-amd64-$(tag)-test -o .\output\images\windows\azure-npm-windows-amd64-$(tag).tar - name: "save_npm" - displayName: "Save" - - - task: Docker@2 - displayName: Docker Logout - inputs: - containerRegistry: $(ACR_SERVICE_CONNECTION) - command: 'logout' - addPipelineData: false - - - task: CopyFiles@2 - inputs: - sourceFolder: "output" - targetFolder: $(Build.ArtifactStagingDirectory) - condition: succeeded() - - - task: PublishBuildArtifacts@1 - inputs: - artifactName: "output" - pathtoPublish: "$(Build.ArtifactStagingDirectory)" - condition: succeeded() From 38b0283858b97b70bd46ff03238a455fe6bd03b6 Mon Sep 17 00:00:00 2001 From: Jaeryn Date: Wed, 4 May 2022 16:48:53 -0700 Subject: [PATCH 7/7] remove REGISTRY var and use IMAGE_REGISTRY from makefile --- .pipelines/containers/manifest-template.yaml | 6 ++-- Makefile | 29 +++++++++----------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.pipelines/containers/manifest-template.yaml b/.pipelines/containers/manifest-template.yaml index a474693300..c5772d1a70 100644 --- a/.pipelines/containers/manifest-template.yaml +++ b/.pipelines/containers/manifest-template.yaml @@ -13,15 +13,15 @@ steps: - script: | set -e - make ${{ parameters.name }}-multiarch-manifest-create REGISTRY=$IMAGE_REGISTRY PLATFORMS="${{ parameters.platforms }}" TAG=${{ parameters.tag }} + make ${{ parameters.name }}-multiarch-manifest-create PLATFORMS="${{ parameters.platforms }}" TAG=${{ parameters.tag }} make ${{ parameters.name }}-image-info TAG=${{ parameters.tag }} name: manifest_build displayName: Manifest Build - script: | set -e - make multiarch-manifest-push REGISTRY=$IMAGE_REGISTRY IMAGE=$(make ${{ parameters.name }}-image-name) TAG=${{ parameters.tag }} - make container-pull REGISTRY=$IMAGE_REGISTRY IMAGE=$(make ${{ parameters.name }}-image-name) TAG=${{ parameters.tag }} + make multiarch-manifest-push IMAGE=$(make ${{ parameters.name }}-image-name) TAG=${{ parameters.tag }} + make container-pull IMAGE=$(make ${{ parameters.name }}-image-name) TAG=${{ parameters.tag }} name: manifest_push displayName: Manifest Push diff --git a/Makefile b/Makefile index 738c03ab8b..c3dad84015 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ containerize-buildah: # util target to build container images using buildah. do --platform $(PLATFORM) \ -f $(DOCKERFILE) \ --build-arg VERSION=$(VERSION) $(EXTRA_BUILD_ARGS) \ - -t $(REGISTRY)/$(IMAGE):$(TAG) \ + -t $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) \ . containerize-docker: # util target to build container images using docker buildx. do not invoke directly. @@ -189,21 +189,21 @@ containerize-docker: # util target to build container images using docker buildx --platform $(PLATFORM) \ -f $(DOCKERFILE) \ --build-arg VERSION=$(VERSION) $(EXTRA_BUILD_ARGS) \ - -t $(REGISTRY)/$(IMAGE):$(TAG) \ + -t $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) \ . container-tag-test: # util target to retag an image with -test suffix. do not invoke directly. $(CONTAINER_BUILDER) tag \ - $(REGISTRY)/$(IMAGE):$(TAG) \ - $(REGISTRY)/$(IMAGE):$(TAG)-test + $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) \ + $(IMAGE_REGISTRY)/$(IMAGE):$(TAG)-test container-push: # util target to publish container image. do not invoke directly. $(CONTAINER_BUILDER) push \ - $(REGISTRY)/$(IMAGE):$(TAG) + $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) container-pull: # util target to pull container image. do not invoke directly. $(CONTAINER_BUILDER) pull \ - $(REGISTRY)/$(IMAGE):$(TAG) + $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) container-info: # util target to write container info file. do not invoke directly. # these commands need to be root due to some ongoing perms issues in the pipeline. @@ -351,34 +351,31 @@ azure-cnm-plugin-image: azure-cnm-plugin ## build the azure-cnm plugin container ## This section is for building multi-arch/os container image manifests. multiarch-manifest-create: # util target to compose multiarch container manifests from os/arch images. - $(CONTAINER_BUILDER) manifest create $(REGISTRY)/$(IMAGE):$(TAG) - $(foreach PLATFORM,$(PLATFORMS), \ - $(if $(filter $(PLATFORM),windows/amd64), \ - $(CONTAINER_BUILDER) manifest add --os-version=$(WINVER) $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG); \ - , \ - $(CONTAINER_BUILDER) manifest add $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);)) + $(CONTAINER_BUILDER) manifest create $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) + $(foreach PLATFORM,$(PLATFORMS), \ + $(if $(filter $(PLATFORM),windows/amd64), \ + $(CONTAINER_BUILDER) manifest add --os-version=$(WINVER) $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG); \ + , \ + $(CONTAINER_BUILDER) manifest add $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(subst /,-,$(PLATFORM))-$(TAG);)) multiarch-manifest-push: # util target to push multiarch container manifest. - $(CONTAINER_BUILDER) manifest push --all $(REGISTRY)/$(IMAGE):$(TAG) docker://$(REGISTRY)/$(IMAGE):$(TAG) + $(CONTAINER_BUILDER) manifest push --all $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(TAG) cni-manager-multiarch-manifest-create: ## build cni-manager multi-arch container manifest. $(MAKE) multiarch-manifest-create \ PLATFORMS="$(PLATFORMS)" \ - REGISTRY=$(IMAGE_REGISTRY) \ IMAGE=$(CNI_IMAGE) \ TAG=$(TAG) cns-multiarch-manifest-create: ## build azure-cns multi-arch container manifest. $(MAKE) multiarch-manifest-create \ PLATFORMS="$(PLATFORMS)" \ - REGISTRY=$(IMAGE_REGISTRY) \ IMAGE=$(CNS_IMAGE) \ TAG=$(TAG) npm-multiarch-manifest-create: ## build azure-npm multi-arch container manifest. $(MAKE) multiarch-manifest-create \ PLATFORMS="$(PLATFORMS)" \ - REGISTRY=$(IMAGE_REGISTRY) \ IMAGE=$(NPM_IMAGE) \ TAG=$(TAG)