From 947a5c7a3a744f10572ea77657ee6670ec83a48d Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Mon, 8 Apr 2019 13:25:28 -0700 Subject: [PATCH 01/10] fixing merge conflict --- azure-pipelines.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2366e41..5774bd3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,8 +12,8 @@ pool: variables: imageName: 'athens-win-test:$(build.buildId)' dockerHubImageName: 'gomods/$(imageName)' - acrImageName: 'gomods/$(imageName)' - + acrImageName: '$(acrName)/gomods/$(imageName)' + steps: - powershell: | choco install azure-cli @@ -26,11 +26,12 @@ steps: docker tag $(imageName) $(dockerHubImageName) echo "push to dockerhub" docker push $(dockerHubImageName) + echo "done with dockerhub and ACR push" echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) - docker push $(acrImageName) - echo "done with dockerhub and ACR push" + docker push $(acrImageName) + echo "done with ACR push" From 4e64d4caf03042497a4c3dc9a9032d026811c08f Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Mon, 8 Apr 2019 13:30:04 -0700 Subject: [PATCH 02/10] trying without docker login --- azure-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5774bd3..80487f0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,13 +20,13 @@ steps: gci 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin' echo "docker build" docker build --isolation=hyperv -f Dockerfile -t $(imageName) . - echo "dockerhub login" - docker login -u $(dockerHubUsername) -p $(dockerHubPassword) - echo "tag for dockerhub" - docker tag $(imageName) $(dockerHubImageName) - echo "push to dockerhub" - docker push $(dockerHubImageName) - echo "done with dockerhub and ACR push" + # echo "dockerhub login" + # docker login -u $(dockerHubUsername) -p $(dockerHubPassword) + # echo "tag for dockerhub" + # docker tag $(imageName) $(dockerHubImageName) + # echo "push to dockerhub" + # docker push $(dockerHubImageName) + # echo "done with dockerhub and ACR push" echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs From 6068630bcb2b241c1455f15af15fdcbc7602ac2e Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Mon, 8 Apr 2019 14:45:56 -0700 Subject: [PATCH 03/10] trying az login --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 80487f0..9835ac7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,6 +30,7 @@ steps: echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs + & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" az login & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) From 803edd6346343041ecb3fb9ac7552a81977c876f Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Mon, 8 Apr 2019 14:54:18 -0700 Subject: [PATCH 04/10] doh --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9835ac7..44e6dab 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,7 @@ steps: echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs - & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" az login + & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) From 1c79d88fd0c51ca15e541519307efea75e9f417c Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Mon, 8 Apr 2019 15:19:20 -0700 Subject: [PATCH 05/10] trying login with the managed identity --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 44e6dab..c180819 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,7 @@ steps: echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs - & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login + & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --identity & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) From 1df4ce24f71d0e89c4eae5c64583a94a7f0e3b5a Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Tue, 9 Apr 2019 13:20:56 -0700 Subject: [PATCH 06/10] logging in with service principal --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c180819..82158b2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,7 @@ steps: echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs - & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --identity + & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login -u $(acr-appId) -p $(acr-name) & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) From 6a131b69170f345cb7f7f47c8e2b48f5a2cdbe0b Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Tue, 9 Apr 2019 13:41:35 -0700 Subject: [PATCH 07/10] logging in with a service principal properly --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 82158b2..a5e0e90 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,7 @@ steps: echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs - & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login -u $(acr-appId) -p $(acr-name) + & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --service-principal -u $(acr-appId) -p $(acr-password) --tenant $(acr-tenant) & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) From 807c774ae2d87ce086e52b44e79f2d8274ededc1 Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Tue, 9 Apr 2019 14:09:41 -0700 Subject: [PATCH 08/10] triggering azure pipelines From c2fee08384c9553c9cf13370a25a305879617020 Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Tue, 9 Apr 2019 14:37:13 -0700 Subject: [PATCH 09/10] pushing to the right place (I think) --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a5e0e90..dc788c2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,7 +12,7 @@ pool: variables: imageName: 'athens-win-test:$(build.buildId)' dockerHubImageName: 'gomods/$(imageName)' - acrImageName: '$(acrName)/gomods/$(imageName)' + acrImageName: 'gomods.azurecr.io/$(imageName)' steps: - powershell: | From b01a4b80f2a56d6b8d2cd57dc67908a3fecbf66a Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Tue, 9 Apr 2019 14:48:20 -0700 Subject: [PATCH 10/10] fixing var names --- azure-pipelines.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dc788c2..2e182ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,7 +12,9 @@ pool: variables: imageName: 'athens-win-test:$(build.buildId)' dockerHubImageName: 'gomods/$(imageName)' - acrImageName: 'gomods.azurecr.io/$(imageName)' + acrRegistryName: 'gomods' + acrLoginServer: '$(acrRegistryName).azurecr.io' + acrImageName: '$(acrLoginServer)/$(imageName)' steps: - powershell: | @@ -27,11 +29,12 @@ steps: # echo "push to dockerhub" # docker push $(dockerHubImageName) # echo "done with dockerhub and ACR push" - echo "ACR login" # for some reason choco install azure-cli does not add the az dir to the PATH # dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs + echo "Azure CLI Login" & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --service-principal -u $(acr-appId) -p $(acr-password) --tenant $(acr-tenant) - & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrName) + echo "ACR login" + & "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrRegistryName) echo "tag for ACR" docker tag $(imageName) $(acrImageName) docker push $(acrImageName)