From b01e337826c94c1191058d9615afba2f2150f5cc Mon Sep 17 00:00:00 2001 From: Esteban Capillo Date: Wed, 19 Oct 2022 14:46:59 -0500 Subject: [PATCH 1/5] feat: migrate powershell docker scripts to docker@2 --- .../container-template-windows.yaml | 31 +++++++++++++------ .pipelines/pipeline.yaml | 12 +++++++ cns/windows.Dockerfile | 2 ++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.pipelines/containers/container-template-windows.yaml b/.pipelines/containers/container-template-windows.yaml index 9f1ec05245..ad328654a9 100644 --- a/.pipelines/containers/container-template-windows.yaml +++ b/.pipelines/containers/container-template-windows.yaml @@ -2,6 +2,10 @@ parameters: name: "" arch: "" tag: "" + ai_path: "" + ai_path_var: "" + ai_id: "" + ai_id_var: "" steps: - task: Docker@2 @@ -11,19 +15,26 @@ steps: command: 'login' addPipelineData: false -- powershell: | - echo "using tag ${{ parameters.tag }}" - . .\build\scripts\windows.ps1; ${{ parameters.name }}-image windows-${{ parameters.arch }}-${{ parameters.tag }} - name: image_build +- task: Docker@2 displayName: Image Build - retryCountOnTaskFailure: 3 + inputs: + command: 'build' + containerRegistry: $(ACR_SERVICE_CONNECTION) + repository: 'azure-${{ parameters.name }}' + tags: 'windows-${{ parameters.arch }}-${{ parameters.tag }}' + Dockerfile: '${{ parameters.name }}/windows.Dockerfile' + arguments: ' + --build-arg VERSION=windows-${{ parameters.arch }}-${{ parameters.tag }} + --build-arg ${{ parameters.ai_path_var }}=${{ parameters.ai_path }} + --build-arg ${{ parameters.ai_id_var }}=${{ parameters.ai_id }}' + buildContext: '**/..' -- powershell: | - $registry = "acnpublic.azurecr.io" - docker push $registry/azure-${{ parameters.name }}:windows-${{ parameters.arch }}-${{ parameters.tag }} - name: image_push +- task: Docker@2 displayName: Image Push - retryCountOnTaskFailure: 3 + inputs: + command: 'push' + containerRegistry: $(ACR_SERVICE_CONNECTION) + tags: 'windows-${{ parameters.arch }}-${{ parameters.tag }}' - task: Docker@2 displayName: Logout diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 49bef70df1..6036b15288 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -230,14 +230,26 @@ stages: cns_windows_amd64: arch: amd64 name: cns + ai_path: github.com/Azure/azure-container-networking/cns/logger.aiMetadata + ai_path_var: CNS_AI_PATH + ai_id: ce672799-8f08-4235-8c12-08563dc2acef + ai_id_var: CNS_AI_ID npm_windows_amd64: arch: amd64 name: npm + ai_path: github.com/Azure/azure-container-networking/npm.aiMetadata + ai_path_var: NPM_AI_PATH + ai_id: 014c22bd-4107-459e-8475-67909e96edcb + ai_id_var: NPM_AI_ID steps: - template: containers/container-template-windows.yaml parameters: name: $(name) arch: $(arch) + ai_path: $(ai_path) + ai_path_var: $(ai_path_var) + ai_id: $(ai_id) + ai_id_var: $(ai_id_var) tag: $(TAG) - stage: publish diff --git a/cns/windows.Dockerfile b/cns/windows.Dockerfile index d40b76ffd1..d2cfe2b05f 100644 --- a/cns/windows.Dockerfile +++ b/cns/windows.Dockerfile @@ -11,6 +11,8 @@ RUN mkdir /usr/bin/ # Copy the source COPY . . +RUN $PWD +RUN ls # Build cns RUN $Env:CGO_ENABLED=0; go build -mod vendor -v -o /usr/bin/azure-cns.exe -ldflags """-X main.version=${env:VERSION} -X ${env:CNS_AI_PATH}=${env:CNS_AI_ID}""" -gcflags="-dwarflocationlists=true" ./cns/service From 4f139be837451c1a99d093164fed9aa884f691e0 Mon Sep 17 00:00:00 2001 From: Esteban Capillo Date: Mon, 31 Oct 2022 13:04:54 -0500 Subject: [PATCH 2/5] feat: added retry to docker task --- .pipelines/containers/container-template-windows.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pipelines/containers/container-template-windows.yaml b/.pipelines/containers/container-template-windows.yaml index ad328654a9..027964f6c7 100644 --- a/.pipelines/containers/container-template-windows.yaml +++ b/.pipelines/containers/container-template-windows.yaml @@ -17,6 +17,7 @@ steps: - task: Docker@2 displayName: Image Build + retryCountOnTaskFailure: 3 inputs: command: 'build' containerRegistry: $(ACR_SERVICE_CONNECTION) @@ -31,6 +32,7 @@ steps: - task: Docker@2 displayName: Image Push + retryCountOnTaskFailure: 3 inputs: command: 'push' containerRegistry: $(ACR_SERVICE_CONNECTION) From 5764722f822f187b1b97d6111987820e2e9ba6d0 Mon Sep 17 00:00:00 2001 From: Esteban Capillo Date: Tue, 1 Nov 2022 14:54:10 -0500 Subject: [PATCH 3/5] fix: added repo info for image push step --- .pipelines/containers/container-template-windows.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pipelines/containers/container-template-windows.yaml b/.pipelines/containers/container-template-windows.yaml index 027964f6c7..7e25a44872 100644 --- a/.pipelines/containers/container-template-windows.yaml +++ b/.pipelines/containers/container-template-windows.yaml @@ -36,6 +36,7 @@ steps: inputs: command: 'push' containerRegistry: $(ACR_SERVICE_CONNECTION) + repository: 'azure-${{ parameters.name }}' tags: 'windows-${{ parameters.arch }}-${{ parameters.tag }}' - task: Docker@2 From ffe383620db69766fb8554cc87b07190560e5b63 Mon Sep 17 00:00:00 2001 From: Esteban Capillo Date: Tue, 1 Nov 2022 17:02:56 -0500 Subject: [PATCH 4/5] fix: added missing parameters for windows template parents --- .pipelines/npm/npm-conformance-tests.yaml | 8 ++++++++ .pipelines/submodules-pipeline.yaml | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.pipelines/npm/npm-conformance-tests.yaml b/.pipelines/npm/npm-conformance-tests.yaml index 556a9724ae..b097653d8b 100644 --- a/.pipelines/npm/npm-conformance-tests.yaml +++ b/.pipelines/npm/npm-conformance-tests.yaml @@ -71,12 +71,20 @@ jobs: npm_windows_amd64: arch: amd64 name: npm + ai_path: github.com/Azure/azure-container-networking/npm.aiMetadata + ai_path_var: NPM_AI_PATH + ai_id: 014c22bd-4107-459e-8475-67909e96edcb + ai_id_var: NPM_AI_ID steps: - template: ../containers/container-template-windows.yaml parameters: name: $(name) arch: $(arch) tag: $(TAG) + ai_path: $(ai_path) + ai_path_var: $(ai_path_var) + ai_id: $(ai_id) + ai_id_var: $(ai_id_var) - job: k8se2e displayName: "Build Kubernetes Test Suite" diff --git a/.pipelines/submodules-pipeline.yaml b/.pipelines/submodules-pipeline.yaml index 43641048a3..46797d3364 100644 --- a/.pipelines/submodules-pipeline.yaml +++ b/.pipelines/submodules-pipeline.yaml @@ -199,15 +199,27 @@ stages: cns_windows_amd64: arch: amd64 name: cns + ai_path: github.com/Azure/azure-container-networking/cns/logger.aiMetadata + ai_path_var: CNS_AI_PATH + ai_id: ce672799-8f08-4235-8c12-08563dc2acef + ai_id_var: CNS_AI_ID npm_windows_amd64: arch: amd64 name: npm + ai_path: github.com/Azure/azure-container-networking/npm.aiMetadata + ai_path_var: NPM_AI_PATH + ai_id: 014c22bd-4107-459e-8475-67909e96edcb + ai_id_var: NPM_AI_ID steps: - template: containers/container-template-windows.yaml parameters: name: $(name) arch: $(arch) tag: $(TAG) + ai_path: $(ai_path) + ai_path_var: $(ai_path_var) + ai_id: $(ai_id) + ai_id_var: $(ai_id_var) - stage: publish displayName: Publish Multiarch Manifests From d03506ca5d87e2775db9f1ac93c68ec9ed0c5e1a Mon Sep 17 00:00:00 2001 From: Esteban Capillo Date: Thu, 3 Nov 2022 14:26:17 -0500 Subject: [PATCH 5/5] fix: removed debugging lines --- cns/windows.Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/cns/windows.Dockerfile b/cns/windows.Dockerfile index d2cfe2b05f..d40b76ffd1 100644 --- a/cns/windows.Dockerfile +++ b/cns/windows.Dockerfile @@ -11,8 +11,6 @@ RUN mkdir /usr/bin/ # Copy the source COPY . . -RUN $PWD -RUN ls # Build cns RUN $Env:CGO_ENABLED=0; go build -mod vendor -v -o /usr/bin/azure-cns.exe -ldflags """-X main.version=${env:VERSION} -X ${env:CNS_AI_PATH}=${env:CNS_AI_ID}""" -gcflags="-dwarflocationlists=true" ./cns/service