From 861e4b8468a558a623afe40786d0233ede7c0a55 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Mon, 27 Sep 2021 11:06:44 -0700 Subject: [PATCH 1/3] remove acr name from repo path --- .../Parameters/ContainerInsights.Linux.Parameters.json | 2 +- .../Parameters/ContainerInsights.Windows.Parameters.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json index 6104609a6..70d0950a2 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -41,7 +41,7 @@ }, { "name": "AGENT_IMAGE_FULL_PATH", - "value": "__ACR_NAME__/public/azuremonitor/containerinsights/__AGENT_RELEASE__:__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__" + "value": "public/azuremonitor/containerinsights/__AGENT_RELEASE__:__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__" }, { "name": "CDPX_REGISTRY", diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index de0bbfe1c..b6a31ed10 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -41,7 +41,7 @@ }, { "name": "AGENT_IMAGE_FULL_PATH", - "value": "__ACR_NAME__/public/azuremonitor/containerinsights/__AGENT_RELEASE__:win-__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__" + "value": "public/azuremonitor/containerinsights/__AGENT_RELEASE__:win-__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__" }, { "name": "CDPX_REGISTRY", From 28f63f4ae5afd0945107c1ede814ede928b1c00c Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Mon, 27 Sep 2021 14:37:13 -0700 Subject: [PATCH 2/3] add check to make sure tag does not exist --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 7d1b6c27e..f502688ec 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -8,11 +8,20 @@ if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then exit 1 fi +#Make sure that tag being pushed will not overwrite an existing tag in mcr +MCR_TAG_RESULT="`wget -qO- https://mcr.microsoft.com/v2/azuremonitor/containerinsights/ciprod/tags/list`" +TAG_EXISTS=$(echo $MCR_TAG_RESULT | jq '.tags | contains(["'"$AGENT_IMAGE_TAG_SUFFIX"'"])') + +if $TAG_EXISTS; then + echo "-e error ${AGENT_IMAGE_TAG_SUFFIX} already exists in mcr. make sure the image tag is unique" + exit 1 +fi + if [ -z $AGENT_RELEASE ]; then echo "-e error AGENT_RELEASE shouldnt be empty. check release variables" exit 1 fi -#! + if [ -z $AGENT_IMAGE_FULL_PATH ]; then echo "-e error AGENT_IMAGE_FULL_PATH shouldnt be empty. check release variables" exit 1 From 86341c63f7cca702e56e196a61ce775d0ce5e2dd Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Mon, 27 Sep 2021 14:57:51 -0700 Subject: [PATCH 3/3] add check to make sure tag does not exist --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index f502688ec..c3f092d90 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -10,6 +10,10 @@ fi #Make sure that tag being pushed will not overwrite an existing tag in mcr MCR_TAG_RESULT="`wget -qO- https://mcr.microsoft.com/v2/azuremonitor/containerinsights/ciprod/tags/list`" +if [ $? -ne 0 ]; then + echo "-e error unable to get list of mcr tags for azuremonitor/containerinsights/ciprod repository" + exit 1 +fi TAG_EXISTS=$(echo $MCR_TAG_RESULT | jq '.tags | contains(["'"$AGENT_IMAGE_TAG_SUFFIX"'"])') if $TAG_EXISTS; then