From 088fc3933626e21dbd0f75a2b64c8b47fe7415b7 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Wed, 3 Nov 2021 12:42:36 -0700 Subject: [PATCH 01/12] build pool windows --- .pipelines/pipeline.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 8d62048627..c7cc1b1faf 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -14,6 +14,18 @@ stages: - stage: build_and_test displayName: ACN jobs: + + - job: setup_windows + displayName: Setup Windows + pool: + name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" + steps: + - script: | + docker ps + name: "EnvironmentalVariables" + displayName: "Set environmental variables" + condition: always() + - job: setup displayName: Setup pool: From 343a5c58803fc39ec6c24cf1cd4176eca48d90d7 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Wed, 3 Nov 2021 15:57:00 -0700 Subject: [PATCH 02/12] add npm dockerfile --- .pipelines/pipeline.yaml | 53 +++++++++++-------- .../aks-engine/e2e-job-template.yaml | 10 ++-- .../aks-swift/e2e-job-template.yaml | 6 ++- Makefile | 2 +- npm/Dockerfile.windows | 19 +++++++ windows.ps1 | 3 ++ 6 files changed, 64 insertions(+), 29 deletions(-) create mode 100644 npm/Dockerfile.windows create mode 100644 windows.ps1 diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index c7cc1b1faf..3ed57a55dd 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -11,22 +11,10 @@ trigger: - honeycomb-dev stages: - - stage: build_and_test + - stage: setup displayName: ACN jobs: - - - job: setup_windows - displayName: Setup Windows - pool: - name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" - steps: - - script: | - docker ps - name: "EnvironmentalVariables" - displayName: "Set environmental variables" - condition: always() - - - job: setup + - job: env displayName: Setup pool: name: "$(BUILD_POOL_NAME_DEFAULT)" @@ -44,13 +32,38 @@ stages: displayName: "Set environmental variables" condition: always() + - stage: build_windows_images + displayName: Build Windows Images + dependsOn: + - "setup" + jobs: + - job: npm + displayName: Build Windows NPM Image + variables: + Tag: $[ stagedependencies.setup.outputs['EnvironmentalVariables.Tag'] ] + pool: + name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" + steps: + - powershell: | + docker ps + echo $Tag + powershell -command "& { . .\windows.ps1; azure-npm-image }" + env: + Tag: $(Tag) + name: "powershelltest" + displayName: "Powershell Test" + + + - stage: build_and_test + displayName: ACN + dependsOn: + - "setup" + jobs: - job: build displayName: Build Binaries - dependsOn: - - "setup" variables: - TAG: $[ dependencies.setup.outputs['EnvironmentalVariables.Tag'] ] - STORAGE_ID: $[ dependencies.setup.outputs['EnvironmentalVariables.StorageID'] ] + TAG: $[ stagedependencies.setup.outputs['EnvironmentalVariables.Tag'] ] + STORAGE_ID: $[ stagedependencies.setup.outputs['EnvironmentalVariables.StorageID'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: @@ -97,8 +110,6 @@ stages: - job: build_images displayName: Build Images - dependsOn: - - "setup" variables: TAG: $[ dependencies.setup.outputs['EnvironmentalVariables.Tag'] ] pool: @@ -170,8 +181,6 @@ stages: - job: test displayName: Run Tests - dependsOn: - - "setup" variables: STORAGE_ID: $[ dependencies.setup.outputs['EnvironmentalVariables.StorageID'] ] pool: diff --git a/.pipelines/singletenancy/aks-engine/e2e-job-template.yaml b/.pipelines/singletenancy/aks-engine/e2e-job-template.yaml index ab0c62dbf7..f12e743e47 100644 --- a/.pipelines/singletenancy/aks-engine/e2e-job-template.yaml +++ b/.pipelines/singletenancy/aks-engine/e2e-job-template.yaml @@ -10,7 +10,9 @@ parameters: stages: - stage: ${{ parameters.name }} displayName: E2E - ${{ parameters.displayName }} - dependsOn: build_and_test + dependsOn: + - setup + - build_and_test jobs: - job: ${{ parameters.name }} displayName: Singletenancy AKS Engine Suite - (${{ parameters.name }}) @@ -27,9 +29,9 @@ stages: GOBIN: "$(GOPATH)/bin" # Go binaries path modulePath: "$(GOPATH)/src/github.com/Azure/aks-engine" acnPath: "$(GOPATH)/src/github.com/Azure/azure-container-networking" - Tag: $[ stagedependencies.build_and_test.setup.outputs['EnvironmentalVariables.Tag'] ] - CommitHash: $[ stagedependencies.build_and_test.setup.outputs['EnvironmentalVariables.CommitHash'] ] - StorageID: $[ stagedependencies.build_and_test.setup.outputs['EnvironmentalVariables.StorageID'] ] + Tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + CommitHash: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.CommitHash'] ] + StorageID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ] steps: - template: e2e-step-template.yaml parameters: diff --git a/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml b/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml index 3332471b1c..83319e10ae 100644 --- a/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml +++ b/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml @@ -6,7 +6,9 @@ parameters: stages: - stage: ${{ parameters.name }} displayName: E2E - ${{ parameters.displayName }} - dependsOn: build_and_test + dependsOn: + - setup + - build_and_test jobs: - job: ${{ parameters.name }} displayName: Singletenancy AKS Swift Suite - (${{ parameters.name }}) @@ -19,7 +21,7 @@ stages: variables: GOPATH: "$(Agent.TempDirectory)/go" # Go workspace path GOBIN: "$(GOPATH)/bin" # Go binaries path - Tag: $[ stagedependencies.build_and_test.setup.outputs['EnvironmentalVariables.Tag'] ] + Tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] modulePath: "$(GOPATH)/src/github.com/Azure/azure-container-networking" steps: - template: e2e-step-template.yaml diff --git a/Makefile b/Makefile index 6dffae9929..a55619e40b 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ ifeq ($(GOOS),linux) all-binaries: azure-cnm-plugin azure-cni-plugin azure-cns azure-npm all-images: azure-npm-image azure-cns-image else -all-binaries: azure-cnm-plugin azure-cni-plugin azure-cns +all-binaries: azure-cnm-plugin azure-cni-plugin azure-cns azure-npm all-images: @echo "Nothing to build. Skip." endif diff --git a/npm/Dockerfile.windows b/npm/Dockerfile.windows new file mode 100644 index 0000000000..de4c142976 --- /dev/null +++ b/npm/Dockerfile.windows @@ -0,0 +1,19 @@ +FROM golang:1.17 AS builder +# Build args +ARG VERSION +ARG NPM_AI_PATH +ARG NPM_AI_ID + +WORKDIR /usr/src/npm +RUN mkdir /usr/bin/ +# Copy the source +COPY . . + +RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -gcflags="-dwarflocationlists=true" ./npm/cmd/ + +# Copy into final image +FROM mcr.microsoft.com/windows/servercore:ltsc2022 +COPY --from=builder /usr/bin/npm.exe \ + /usr/bin/npm.exe + +ENTRYPOINT ["/usr/bin/npm.exe"] diff --git a/windows.ps1 b/windows.ps1 new file mode 100644 index 0000000000..e75e96f030 --- /dev/null +++ b/windows.ps1 @@ -0,0 +1,3 @@ +function azure-npm-image { + echo "test" +} From 96ba4727842cb0f606a54c75dcccd4db2756e80a Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Wed, 3 Nov 2021 16:11:21 -0700 Subject: [PATCH 03/12] script --- .pipelines/pipeline.yaml | 21 ++++++++------------- windows.ps1 | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 3ed57a55dd..63e827f66c 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -37,21 +37,16 @@ stages: dependsOn: - "setup" jobs: - - job: npm - displayName: Build Windows NPM Image + - job: npm1 variables: - Tag: $[ stagedependencies.setup.outputs['EnvironmentalVariables.Tag'] ] + Tag: $[ stagedependencies.setup.outputs['EnvironmentalVariables.Tag'] ] pool: - name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" - steps: - - powershell: | - docker ps - echo $Tag - powershell -command "& { . .\windows.ps1; azure-npm-image }" - env: - Tag: $(Tag) - name: "powershelltest" - displayName: "Powershell Test" + name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" + steps: + - script: | + powershell.exe -command "& { . .\windows.ps1; azure-npm-image }" + name: "powershelltest2" + displayName: "Powershell Test2" - stage: build_and_test diff --git a/windows.ps1 b/windows.ps1 index e75e96f030..a0d9a39480 100644 --- a/windows.ps1 +++ b/windows.ps1 @@ -1,3 +1,3 @@ function azure-npm-image { - echo "test" + echo $Tag } From 3291fcc681dc00d9b280625b77637ba4c684b7a9 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Wed, 3 Nov 2021 18:11:36 -0700 Subject: [PATCH 04/12] tag --- .pipelines/pipeline.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 63e827f66c..a0b7f391e3 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -39,12 +39,15 @@ stages: jobs: - job: npm1 variables: - Tag: $[ stagedependencies.setup.outputs['EnvironmentalVariables.Tag'] ] + Tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" steps: - - script: | + - powershell: | + [System.Environment]::SetEnvironmentVariable('Tag',$(Tag)) + echo "Tag1": $env:Tag powershell.exe -command "& { . .\windows.ps1; azure-npm-image }" + echo "Tag2": $env:Tag name: "powershelltest2" displayName: "Powershell Test2" From af452014b2ab6c146c8689bbcfb110a45c117ad5 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 09:34:18 -0700 Subject: [PATCH 05/12] tag --- .pipelines/pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index a0b7f391e3..249e4e8be3 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -44,7 +44,7 @@ stages: name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" steps: - powershell: | - [System.Environment]::SetEnvironmentVariable('Tag',$(Tag)) + [System.Environment]::SetEnvironmentVariable('Tag',"$(Tag)") echo "Tag1": $env:Tag powershell.exe -command "& { . .\windows.ps1; azure-npm-image }" echo "Tag2": $env:Tag From d4ba7c7828e07da59b25720eaef32190ea6d71ce Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 09:46:10 -0700 Subject: [PATCH 06/12] docker build --- .pipelines/pipeline.yaml | 8 ++++---- windows.ps1 | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 249e4e8be3..ff10020b67 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -39,15 +39,15 @@ stages: jobs: - job: npm1 variables: - Tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" steps: - powershell: | - [System.Environment]::SetEnvironmentVariable('Tag',"$(Tag)") - echo "Tag1": $env:Tag + [System.Environment]::SetEnvironmentVariable('tag',"$(tag)") + echo "Tag1": $env:tag powershell.exe -command "& { . .\windows.ps1; azure-npm-image }" - echo "Tag2": $env:Tag + echo "Tag2": $env:tag name: "powershelltest2" displayName: "Powershell Test2" diff --git a/windows.ps1 b/windows.ps1 index a0d9a39480..8859b37a88 100644 --- a/windows.ps1 +++ b/windows.ps1 @@ -1,3 +1,3 @@ function azure-npm-image { - echo $Tag + docker build -f npm/Dockerfile.windows -t acnpublic.azurecr.io/azure-npm:$env:tag-windows-amd64 . } From 71fc5f8cbb7d2f14746490403c35c8dd71e684fd Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 10:45:41 -0700 Subject: [PATCH 07/12] image pipeline --- .pipelines/pipeline.yaml | 27 ++++------------- .pipelines/windows-image.yaml | 55 +++++++++++++++++++++++++++++++++++ windows.ps1 | 4 ++- 3 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 .pipelines/windows-image.yaml diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index ff10020b67..c541b568fa 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -32,25 +32,8 @@ stages: displayName: "Set environmental variables" condition: always() - - stage: build_windows_images - displayName: Build Windows Images - dependsOn: - - "setup" - jobs: - - job: npm1 - variables: - tag: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] - pool: - name: "$(BUILD_POOL_NAME_DEFAULT_WINDOWS)" - steps: - - powershell: | - [System.Environment]::SetEnvironmentVariable('tag',"$(tag)") - echo "Tag1": $env:tag - powershell.exe -command "& { . .\windows.ps1; azure-npm-image }" - echo "Tag2": $env:tag - name: "powershelltest2" - displayName: "Powershell Test2" + - template: windows-image.yaml - stage: build_and_test displayName: ACN @@ -60,8 +43,8 @@ stages: - job: build displayName: Build Binaries variables: - TAG: $[ stagedependencies.setup.outputs['EnvironmentalVariables.Tag'] ] - STORAGE_ID: $[ stagedependencies.setup.outputs['EnvironmentalVariables.StorageID'] ] + TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + STORAGE_ID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: @@ -109,7 +92,7 @@ stages: - job: build_images displayName: Build Images variables: - TAG: $[ dependencies.setup.outputs['EnvironmentalVariables.Tag'] ] + TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: @@ -180,7 +163,7 @@ stages: - job: test displayName: Run Tests variables: - STORAGE_ID: $[ dependencies.setup.outputs['EnvironmentalVariables.StorageID'] ] + STORAGE_ID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: diff --git a/.pipelines/windows-image.yaml b/.pipelines/windows-image.yaml new file mode 100644 index 0000000000..33133ab736 --- /dev/null +++ b/.pipelines/windows-image.yaml @@ -0,0 +1,55 @@ +stages: +- stage: build_windows_images + displayName: Build Windows Images + dependsOn: + - "setup" + 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; azure-npm-image $(tag)-windows-amd64 }" + 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:$(tag)-windows-amd64 acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64-test + docker push acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64-test + name: "push_npm" + displayName: "Push" + + - powershell: | + mkdir .\output\images\windows\ + docker save acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 | gzip -c > .\output\images\windows\acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 + 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() diff --git a/windows.ps1 b/windows.ps1 index 8859b37a88..abfd142daf 100644 --- a/windows.ps1 +++ b/windows.ps1 @@ -1,3 +1,5 @@ + function azure-npm-image { - docker build -f npm/Dockerfile.windows -t acnpublic.azurecr.io/azure-npm:$env:tag-windows-amd64 . + if ($null -eq $env:imagetag) { $env:imagetag = $args[0] } + docker build -f npm/Dockerfile.windows -t acnpublic.azurecr.io/azure-npm:$env:imagetag . } From 9eea7d0df38b6ec419b3addadfa82d972427fd63 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 11:23:50 -0700 Subject: [PATCH 08/12] nanoserver --- .pipelines/windows-image.yaml | 2 +- npm/Dockerfile.windows | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/windows-image.yaml b/.pipelines/windows-image.yaml index 33133ab736..95e13f728e 100644 --- a/.pipelines/windows-image.yaml +++ b/.pipelines/windows-image.yaml @@ -31,7 +31,7 @@ stages: - powershell: | mkdir .\output\images\windows\ - docker save acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 | gzip -c > .\output\images\windows\acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 + docker save .\output\images\windows\acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 -o azure-npm-$(tag)-windows-amd64.tar name: "save_npm" displayName: "Save" diff --git a/npm/Dockerfile.windows b/npm/Dockerfile.windows index de4c142976..234b46774a 100644 --- a/npm/Dockerfile.windows +++ b/npm/Dockerfile.windows @@ -12,7 +12,7 @@ COPY . . RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -gcflags="-dwarflocationlists=true" ./npm/cmd/ # Copy into final image -FROM mcr.microsoft.com/windows/servercore:ltsc2022 +FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 COPY --from=builder /usr/bin/npm.exe \ /usr/bin/npm.exe From 36f2d9b1f555bc6542f7b5660f187e7876b3ddc2 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 12:21:03 -0700 Subject: [PATCH 09/12] save --- .pipelines/windows-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/windows-image.yaml b/.pipelines/windows-image.yaml index 95e13f728e..6bf293dcf3 100644 --- a/.pipelines/windows-image.yaml +++ b/.pipelines/windows-image.yaml @@ -31,7 +31,7 @@ stages: - powershell: | mkdir .\output\images\windows\ - docker save .\output\images\windows\acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64 -o azure-npm-$(tag)-windows-amd64.tar + docker save acnpublic.azurecr.io/azure-npm:$(tag)-windows-amd64-test -o .\output\images\windows\azure-npm-$(tag)-windows-amd64.tar name: "save_npm" displayName: "Save" From f54a0ea1ca20776b2334859b5ced68fa810b5e5f Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 12:55:03 -0700 Subject: [PATCH 10/12] servercore --- npm/Dockerfile.windows | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/Dockerfile.windows b/npm/Dockerfile.windows index 234b46774a..6a4dccee69 100644 --- a/npm/Dockerfile.windows +++ b/npm/Dockerfile.windows @@ -12,8 +12,8 @@ COPY . . RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -gcflags="-dwarflocationlists=true" ./npm/cmd/ # Copy into final image -FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 +FROM mcr.microsoft.com/windows/servercore:ltsc2022 COPY --from=builder /usr/bin/npm.exe \ /usr/bin/npm.exe -ENTRYPOINT ["/usr/bin/npm.exe"] +ENTRYPOINT ["/usr/bin/npm.exe", "start"] From b9d003e3a233c335a9ae7dae701ca17fec172cf5 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 13:47:23 -0700 Subject: [PATCH 11/12] logger --- log/logger_windows.go | 3 +++ npm/Dockerfile.windows | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/log/logger_windows.go b/log/logger_windows.go index 85a48b318b..352f801d79 100644 --- a/log/logger_windows.go +++ b/log/logger_windows.go @@ -19,6 +19,9 @@ func (logger *Logger) SetTarget(target int) error { var err error switch target { + case TargetStdout: + logger.out = os.Stdout + case TargetStderr: logger.out = os.Stderr diff --git a/npm/Dockerfile.windows b/npm/Dockerfile.windows index 6a4dccee69..e242fb2775 100644 --- a/npm/Dockerfile.windows +++ b/npm/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM golang:1.17 AS builder +FROM golang:windowsservercore-ltsc2022 AS builder # Build args ARG VERSION ARG NPM_AI_PATH @@ -9,10 +9,11 @@ RUN mkdir /usr/bin/ # Copy the source COPY . . -RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -gcflags="-dwarflocationlists=true" ./npm/cmd/ +RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" ./npm/cmd/ # Copy into final image -FROM mcr.microsoft.com/windows/servercore:ltsc2022 +FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 +COPY --from=builder /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll COPY --from=builder /usr/bin/npm.exe \ /usr/bin/npm.exe From 11c6a0f809bb98a764551e5b2fdf73c21749af22 Mon Sep 17 00:00:00 2001 From: Mathew Merrick Date: Thu, 4 Nov 2021 14:49:22 -0700 Subject: [PATCH 12/12] ai --- npm/Dockerfile.windows | 2 +- windows.ps1 | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/npm/Dockerfile.windows b/npm/Dockerfile.windows index e242fb2775..910954d2c0 100644 --- a/npm/Dockerfile.windows +++ b/npm/Dockerfile.windows @@ -9,7 +9,7 @@ RUN mkdir /usr/bin/ # Copy the source COPY . . -RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" ./npm/cmd/ +RUN $Env:CGO_ENABLED=0; go build -v -o /usr/bin/npm.exe -ldflags """-X main.version=${env:VERSION} -X ${env:NPM_AI_PATH}=${env:NPM_AI_ID}""" -gcflags="-dwarflocationlists=true" ./npm/cmd/ # Copy into final image FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 diff --git a/windows.ps1 b/windows.ps1 index abfd142daf..32cd475d65 100644 --- a/windows.ps1 +++ b/windows.ps1 @@ -1,5 +1,15 @@ function azure-npm-image { - if ($null -eq $env:imagetag) { $env:imagetag = $args[0] } - docker build -f npm/Dockerfile.windows -t acnpublic.azurecr.io/azure-npm:$env:imagetag . + $env:ACN_PACKAGE_PATH = "github.com/Azure/azure-container-networking" + $env:NPM_AI_ID = "014c22bd-4107-459e-8475-67909e96edcb" + $env:NPM_AI_PATH="$env:ACN_PACKAGE_PATH/npm.aiMetadata" + + if ($null -eq $env:VERSION) { $env:VERSION = $args[0] } + docker build ` + -f npm/Dockerfile.windows ` + -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 ` + . }