From 8d0537ccfa085029a70894c90d9b9ec8eefcb73e Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Thu, 2 Sep 2021 11:00:54 -0700 Subject: [PATCH 01/20] ev2 artifacts for release pipeline --- .../ContainerInsights.Linux.Parameters.json | 61 +++++++++++++++++++ .../ContainerInsights.Windows.Parameters.json | 61 +++++++++++++++++++ .../RolloutSpecs/RolloutSpecs.json | 37 +++++++++++ .../ScopeBindings/Public.ScopeBindings.json | 27 ++++++++ .../Scripts/pushAgentToAcr.sh | 58 ++++++++++++++++++ .../ServiceModels/Public.ServiceModel.json | 57 +++++++++++++++++ .../ServiceGroupRoot/buildver.txt | 1 + 7 files changed, 302 insertions(+) create mode 100644 deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json create mode 100644 deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json create mode 100644 deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json create mode 100644 deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json create mode 100644 deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh create mode 100644 deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json create mode 100644 deployment/agent-deployment/ServiceGroupRoot/buildver.txt diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json new file mode 100644 index 000000000..b62363d15 --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://schema.express.azure.com/schemas/2015-01-01-alpha/RolloutParameters.json", + "contentVersion": "1.0.0.0", + "wait": [ + { + "name": "waitSdpBakeTime", + "properties": { + "duration": "PT24H" + } + } + ], + "shellExtensions": [ + { + "name": "PushAgentToACR", + "type": "ShellExtensionType", + "properties": { + "maxexecutiontime": "PT1H" + }, + "package": { + "reference": { + "path": "artifacts.tar.gz" + } + }, + "launch": { + "command": [ + "/bin/bash", + "pushAgentToAcr.sh" + ], + "environmentVariables": [ + { + "name": "AGENT_IMAGE_TAR_FILE_NAME", + "value": "agentimage.tar.gz" + }, + { + "name": "ACR_NAME", + "value": "__ACR_NAME__" + }, + { + "name": "AGENT_RELEASE", + "value": "__AGENT_RELEASE__" + }, + { + "name": "AGENT_IMAGE_TAG_SUFFIX", + "value": "__AGENT_IMAGE_TAG_SUFFIX__" + }, + { + "name": "AGENT_IMAGE_FULL_PATH", + "value": "__ACR_NAME__/public/azuremonitor/containerinsights/__AGENT_RELEASE__:__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__" + } + ], + "identity": { + "type": "userAssigned", + "userAssignedIdentities": [ + "__MANAGED_IDENTITY__" + ] + } + } + } + ] + } + \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json new file mode 100644 index 000000000..4327a7664 --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://schema.express.azure.com/schemas/2015-01-01-alpha/RolloutParameters.json", + "contentVersion": "1.0.0.0", + "wait": [ + { + "name": "waitSdpBakeTime", + "properties": { + "duration": "PT24H" + } + } + ], + "shellExtensions": [ + { + "name": "PushAgentToACR", + "type": "ShellExtensionType", + "properties": { + "maxexecutiontime": "PT1H" + }, + "package": { + "reference": { + "path": "artifacts.tar.gz" + } + }, + "launch": { + "command": [ + "/bin/bash", + "pushAgentToAcr.sh" + ], + "environmentVariables": [ + { + "name": "AGENT_IMAGE_TAR_FILE_NAME", + "value": "agentimage.tar.zip" + }, + { + "name": "ACR_NAME", + "value": "__ACR_NAME__" + }, + { + "name": "AGENT_RELEASE", + "value": "__AGENT_RELEASE__" + }, + { + "name": "AGENT_IMAGE_TAG_SUFFIX", + "value": "__AGENT_IMAGE_TAG_SUFFIX__" + }, + { + "name": "AGENT_IMAGE_FULL_PATH", + "value": "__ACR_NAME__/public/azuremonitor/containerinsights/__AGENT_RELEASE__:win-__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__" + } + ], + "identity": { + "type": "userAssigned", + "userAssignedIdentities": [ + "__MANAGED_IDENTITY__" + ] + } + } + } + ] + } + \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json new file mode 100644 index 000000000..6d10c3fa7 --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://ev2schema.azure.net/schemas/2020-01-01/rolloutSpecification.json", + "ContentVersion": "1.0.0.0", + "RolloutMetadata": { + "ServiceModelPath": "ServiceModels//Public.ServiceModel.json", + "ScopeBindingsPath": "ScopeBindings//Public.ScopeBindings.json", + "Name": "ContainerInsightsExtension", + "RolloutType": "Major", + "BuildSource": { + "Parameters": { + "VersionFile": "buildver.txt" + } + }, + "Notification": { + "Email": { + "To": "omscontainers@microsoft.com" + } + } + }, + "OrchestratedSteps": [ + { + "name": "PushLinuxAgent", + "targetType": "ServiceResource", + "targetName": "PushLinuxAgent", + "actions": [ "Shell/PushAgentToACR" ], + "dependsOn": [ ] + }, + { + "name": "PushWindowsAgent", + "targetType": "ServiceResource", + "targetName": "PushWindowsAgent", + "actions": [ "Shell/PushAgentToACR" ], + "dependsOn": [ ] + } + ] + } + \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json new file mode 100644 index 000000000..70a35000a --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://ev2schema.azure.net/schemas/2020-01-01/scopeBindings.json", + "contentVersion": "0.0.0.1", + "scopeBindings": [ + { + "scopeTagName": "Global", + "bindings": [ + { + "find": "__ACR_NAME__", + "replaceWith": "$(ACRName)" + }, + { + "find": "__AGENT_RELEASE__", + "replaceWith": "$(AgentRelease)" + }, + { + "find": "__AGENT_IMAGE_TAG_SUFFIX__", + "replaceWith": "$(AgentImageTagSuffix)" + }, + { + "find": "__MANAGED_IDENTITY__", + "replaceWith": "$(ManagedIdentity)" + } + ] + } + ] +} diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh new file mode 100644 index 000000000..b40312eb7 --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -e + +# Note - This script used in the pipeline as inline script + +# These are plain pipeline variable which can be modified anyone in the team +# AGENT_RELEASE=ciprod +# AGENT_IMAGE_TAG_SUFFIX=08202021 + +# LINUX_AGENT_IMAGE_FULL_PATH=${ACR_NAME}/public/azuremonitor/containerinsights/${AGENT_RELEASE}:${AGENT_RELEASE}${AGENT_IMAGE_TAG_SUFFIX} +# WINDOWS_AGENT_IMAGE_FULL_PATH=${ACR_NAME}/public/azuremonitor/containerinsights/${AGENT_RELEASE}:win-${AGENT_RELEASE}${AGENT_IMAGE_TAG_SUFFIX} + +if [ -z ${AGENT_IMAGE_TAR_FILE_NAME+x} ]; then + echo "AGENT_IMAGE_TAR_FILE_NAME is unset, unable to continue" + exit 1; +fi + +if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then + echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty" + exit 1 +fi + +if [ ${#AGENT_IMAGE_TAG_SUFFIX} -ne 8 ]; then + echo "-e error length of AGENT_IMAGE_TAG_SUFFIX should be 8. Make sure it is in MMDDYYYY format" + exit 1 +fi + +if [ -z $AGENT_RELEASE ]; then + echo "-e error AGENT_RELEASE shouldnt be empty" + exit 1 +fi + +#Install crane +echo "Installing crane" +wget -O crane.tar.gz https://github.com/google/go-containerregistry/releases/download/v0.4.0/go-containerregistry_Linux_x86_64.tar.gz +tar xzvf crane.tar.gz +echo "Installed crane" + +#echo "Login cli using managed identity" +az login --identity + + +echo "Getting acr credentials" +TOKEN_QUERY_RES=$(az acr login -n "$ACR_NAME" -t) +TOKEN=$(echo "$TOKEN_QUERY_RES" | jq -r '.accessToken') +DESTINATION_ACR=$(echo "$TOKEN_QUERY_RES" | jq -r '.loginServer') +./crane auth login "$DESTINATION_ACR" -u "00000000-0000-0000-0000-000000000000" -p "$TOKEN" + +if [[ "$AGENT_IMAGE_TAR_FILE_NAME" == *"tar.gz"* ]]; then + gunzip $AGENT_IMAGE_TAR_FILE_NAME +fi + +if [[ "$AGENT_IMAGE_TAR_FILE_NAME" == *"tar.zip"* ]]; then + unzip $AGENT_IMAGE_TAR_FILE_NAME +fi + +echo "Pushing file $TARBALL_IMAGE_FILE to $AGENT_IMAGE_FULL_PATH" +./crane push *.tar "$AGENT_IMAGE_FULL_PATH" \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json new file mode 100644 index 000000000..8ca30c33c --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://ev2schema.azure.net/schemas/2020-01-01/serviceModel.json", + "contentVersion": "1.0.0.2", + "ServiceMetadata": { + "ServiceGroup": "ContainerInsightsExtension", + "Environment": "Prod" + }, + "ServiceResourceGroupDefinitions": [ + { + "Name": "CI-Extension-ServiceResourceGroupDefinition", + "ServiceResourceDefinitions": [ + { + "Name": "ShellExtension", + "ComposedOf": { + "Extension": { + "Shell": [ + { + "type": "ShellExtensionType", + "properties": { + "imageName": "adm-ubuntu-1804-l", + "imageVersion": "v18" + } + } + ] + } + } + } + ] + } + ], + "ServiceResourceGroups": [ + { + "AzureResourceGroupName": "ContainerInsightsExtension-Global-Release", + "Location": "eastus2", + "InstanceOf": "CI-Extension-ServiceResourceGroupDefinition", + "AzureSubscriptionId": "728bbd23-3b47-40c1-8c9a-c6c5ccd674fc", + "ScopeTags": [ + { + "Name": "Global" + } + ], + "ServiceResources": [ + { + "Name": "PushLinuxAgent", + "InstanceOf": "ShellExtension", + "RolloutParametersPath": "Parameters\\ContainerInsightsLinux.Parameters.json" + }, + { + "Name": "PushWindowsAgent", + "InstanceOf": "ShellExtension", + "RolloutParametersPath": "Parameters\\ContainerInsightsWindows.Parameters.json" + } + ] + } + ] + } + \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/buildver.txt b/deployment/agent-deployment/ServiceGroupRoot/buildver.txt new file mode 100644 index 000000000..bd2666abb --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/buildver.txt @@ -0,0 +1 @@ +1.0.0.0 \ No newline at end of file From be8a4c7a8b09c723fdbee12fb9be86d0d53f8160 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 3 Sep 2021 09:10:37 -0700 Subject: [PATCH 02/20] update parameters reference --- .../ServiceGroupRoot/ServiceModels/Public.ServiceModel.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json index 8ca30c33c..d01aca78a 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json @@ -43,12 +43,12 @@ { "Name": "PushLinuxAgent", "InstanceOf": "ShellExtension", - "RolloutParametersPath": "Parameters\\ContainerInsightsLinux.Parameters.json" + "RolloutParametersPath": "Parameters\\ContainerInsights.Linux.Parameters.json" }, { "Name": "PushWindowsAgent", "InstanceOf": "ShellExtension", - "RolloutParametersPath": "Parameters\\ContainerInsightsWindows.Parameters.json" + "RolloutParametersPath": "Parameters\\ContainerInsights.Windows.Parameters.json" } ] } From e50e3fee9909f9b79ec58495258c2ec600281c2e Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 3 Sep 2021 09:37:07 -0700 Subject: [PATCH 03/20] add artifacts tar file --- .pipelines/build-linux.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pipelines/build-linux.sh b/.pipelines/build-linux.sh index 53f6a3a07..b86dd5765 100644 --- a/.pipelines/build-linux.sh +++ b/.pipelines/build-linux.sh @@ -15,6 +15,11 @@ echo "----------- Build Docker Provider -------------------------------" make cd $DIR +echo "------------ Bundle Shell Extension Scripts for Agent Release -------------------------" +cd $DIR/../deployment/agent-deployment/ServiceGroupRoot/Scripts +tar -czvf ../artifacts.tar.gz ../../../../charts/azuremonitor-containers/ pushAgentToAcr.sh +cd $DIR + echo "------------ Bundle Shell Extension Scripts & HELM chart -------------------------" cd $DIR/../deployment/arc-k8s-extension/ServiceGroupRoot/Scripts tar -czvf ../artifacts.tar.gz ../../../../charts/azuremonitor-containers/ pushChartToAcr.sh From 2f7c0d0a8db89f48fdaf0a003f48bcf108652257 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 3 Sep 2021 10:31:19 -0700 Subject: [PATCH 04/20] changes to rollout and service model --- .../ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json | 2 +- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 5 +++++ .../ServiceModels/Public.ServiceModel.json | 10 +++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json index 6d10c3fa7..ae42a68f2 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json +++ b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -13,7 +13,7 @@ }, "Notification": { "Email": { - "To": "omscontainers@microsoft.com" + "To": "sarahpeiffer@microsoft.com" } } }, diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index b40312eb7..146d98c65 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -15,6 +15,11 @@ if [ -z ${AGENT_IMAGE_TAR_FILE_NAME+x} ]; then exit 1; fi +if [ ! -f $AGENT_IMAGE_TAR_FILE_NAME ]; then + echo "Agent tarfile: ${AGENT_IMAGE_TAR_FILE_NAME} does not exist, unable to continue" + exit 1 +fi + if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty" exit 1 diff --git a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json index d01aca78a..5aab38959 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json @@ -2,12 +2,12 @@ "$schema": "https://ev2schema.azure.net/schemas/2020-01-01/serviceModel.json", "contentVersion": "1.0.0.2", "ServiceMetadata": { - "ServiceGroup": "ContainerInsightsExtension", - "Environment": "Prod" + "ServiceGroup": "ContainerInsightsAgent", + "Environment": "Dev" }, "ServiceResourceGroupDefinitions": [ { - "Name": "CI-Extension-ServiceResourceGroupDefinition", + "Name": "CI-Agent-ServiceResourceGroupDefinition", "ServiceResourceDefinitions": [ { "Name": "ShellExtension", @@ -30,9 +30,9 @@ ], "ServiceResourceGroups": [ { - "AzureResourceGroupName": "ContainerInsightsExtension-Global-Release", + "AzureResourceGroupName": "ContainerInsightsAgent-Global-Release", "Location": "eastus2", - "InstanceOf": "CI-Extension-ServiceResourceGroupDefinition", + "InstanceOf": "CI-Agent-ServiceResourceGroupDefinition", "AzureSubscriptionId": "728bbd23-3b47-40c1-8c9a-c6c5ccd674fc", "ScopeTags": [ { From 349d1ba8b13cf53db15951b3e9cfcca85c2e9d1e Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 3 Sep 2021 12:28:39 -0700 Subject: [PATCH 05/20] change agentimage 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 b62363d15..2558887ee 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -29,7 +29,7 @@ "environmentVariables": [ { "name": "AGENT_IMAGE_TAR_FILE_NAME", - "value": "agentimage.tar.gz" + "value": "/drop/outputs/package/agentimage.tar.gz" }, { "name": "ACR_NAME", diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index 4327a7664..88126f287 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -29,7 +29,7 @@ "environmentVariables": [ { "name": "AGENT_IMAGE_TAR_FILE_NAME", - "value": "agentimage.tar.zip" + "value": "/drop/outputs/package/agentimage.tar.zip" }, { "name": "ACR_NAME", From b1f8982a446fa1bcb488e17d8abde051df4fb4b7 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 3 Sep 2021 13:48:45 -0700 Subject: [PATCH 06/20] adding agentimage to artifact script --- .../ContainerInsights.Linux.Parameters.json | 2 +- .../ContainerInsights.Windows.Parameters.json | 2 +- .../ServiceGroupRoot/Scripts/addImageToArtifact.sh | 11 +++++++++++ .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 8 ++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json index 2558887ee..b62363d15 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -29,7 +29,7 @@ "environmentVariables": [ { "name": "AGENT_IMAGE_TAR_FILE_NAME", - "value": "/drop/outputs/package/agentimage.tar.gz" + "value": "agentimage.tar.gz" }, { "name": "ACR_NAME", diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index 88126f287..4327a7664 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -29,7 +29,7 @@ "environmentVariables": [ { "name": "AGENT_IMAGE_TAR_FILE_NAME", - "value": "/drop/outputs/package/agentimage.tar.zip" + "value": "agentimage.tar.zip" }, { "name": "ACR_NAME", diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh new file mode 100644 index 000000000..fd43913f8 --- /dev/null +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "Adding Agent Image Tarball to existing artifact.tar.gz for Ev2 Shell Script" + +ls + +tar rvf ../artifacts.tar.gz ../drop/outputs/package/agentimage.tar.gz + +ls + +"Finished adding Agent Image Tarball" \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 146d98c65..ed908c9cb 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -15,6 +15,14 @@ if [ -z ${AGENT_IMAGE_TAR_FILE_NAME+x} ]; then exit 1; fi +CWD=$PWD +echo "current working directory" +echo $CWD + +cd .. +ls +cd Scripts + if [ ! -f $AGENT_IMAGE_TAR_FILE_NAME ]; then echo "Agent tarfile: ${AGENT_IMAGE_TAR_FILE_NAME} does not exist, unable to continue" exit 1 From 089abebe377a5818dfd7e6fc7b385c3de56cfed0 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 3 Sep 2021 16:52:17 -0700 Subject: [PATCH 07/20] removing charts from tarball --- .pipelines/build-linux.sh | 3 ++- .../ServiceGroupRoot/Scripts/addImageToArtifact.sh | 11 ----------- 2 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh diff --git a/.pipelines/build-linux.sh b/.pipelines/build-linux.sh index b86dd5765..8dbf57fdc 100644 --- a/.pipelines/build-linux.sh +++ b/.pipelines/build-linux.sh @@ -17,10 +17,11 @@ cd $DIR echo "------------ Bundle Shell Extension Scripts for Agent Release -------------------------" cd $DIR/../deployment/agent-deployment/ServiceGroupRoot/Scripts -tar -czvf ../artifacts.tar.gz ../../../../charts/azuremonitor-containers/ pushAgentToAcr.sh +tar -czvf ../artifacts.tar.gz pushAgentToAcr.sh cd $DIR echo "------------ Bundle Shell Extension Scripts & HELM chart -------------------------" cd $DIR/../deployment/arc-k8s-extension/ServiceGroupRoot/Scripts tar -czvf ../artifacts.tar.gz ../../../../charts/azuremonitor-containers/ pushChartToAcr.sh + diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh deleted file mode 100644 index fd43913f8..000000000 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/addImageToArtifact.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -echo "Adding Agent Image Tarball to existing artifact.tar.gz for Ev2 Shell Script" - -ls - -tar rvf ../artifacts.tar.gz ../drop/outputs/package/agentimage.tar.gz - -ls - -"Finished adding Agent Image Tarball" \ No newline at end of file From aff24393fd825e8b253038dae2ae8912543213e2 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 09:23:50 -0700 Subject: [PATCH 08/20] change script to use blob storage --- .../ContainerInsights.Linux.Parameters.json | 8 +++++ .../ContainerInsights.Windows.Parameters.json | 10 +++++- .../ScopeBindings/Public.ScopeBindings.json | 11 +++++- .../Scripts/pushAgentToAcr.sh | 35 +++++++++++-------- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json index b62363d15..5ff0f9ad9 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -27,6 +27,14 @@ "pushAgentToAcr.sh" ], "environmentVariables": [ + { + "name": "AGENT_IMAGE_URI", + "value": "__CONTAINER_URI__" + }, + { + "name": "AGENT_IMAGE_SAS", + "value": "__CONTAINER_SAS_TOKEN__" + }, { "name": "AGENT_IMAGE_TAR_FILE_NAME", "value": "agentimage.tar.gz" diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index 4327a7664..04c144feb 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -27,9 +27,17 @@ "pushAgentToAcr.sh" ], "environmentVariables": [ + { + "name": "AGENT_IMAGE_URI", + "value": "__CONTAINER_URI__" + }, + { + "name": "AGENT_IMAGE_SAS", + "value": "__CONTAINER_SAS_TOKEN__" + }, { "name": "AGENT_IMAGE_TAR_FILE_NAME", - "value": "agentimage.tar.zip" + "value": "agentimage.tar.gz" }, { "name": "ACR_NAME", diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json index 70a35000a..b148233d8 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -20,7 +20,16 @@ { "find": "__MANAGED_IDENTITY__", "replaceWith": "$(ManagedIdentity)" - } + }, + { + "find": "__CONTAINER_URI__", + "replaceWith": "$(Storage.StorageContainerUri)" + }, + { + "find": "__CONTAINER_SAS_TOKEN__", + "replaceWith": "$(Storage.StorageContainerSasToken)" + } + ] } ] diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index ed908c9cb..de356b171 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -10,23 +10,20 @@ set -e # LINUX_AGENT_IMAGE_FULL_PATH=${ACR_NAME}/public/azuremonitor/containerinsights/${AGENT_RELEASE}:${AGENT_RELEASE}${AGENT_IMAGE_TAG_SUFFIX} # WINDOWS_AGENT_IMAGE_FULL_PATH=${ACR_NAME}/public/azuremonitor/containerinsights/${AGENT_RELEASE}:win-${AGENT_RELEASE}${AGENT_IMAGE_TAG_SUFFIX} -if [ -z ${AGENT_IMAGE_TAR_FILE_NAME+x} ]; then - echo "AGENT_IMAGE_TAR_FILE_NAME is unset, unable to continue" - exit 1; -fi +# if [ -z ${AGENT_IMAGE_TAR_FILE_NAME+x} ]; then +# echo "AGENT_IMAGE_TAR_FILE_NAME is unset, unable to continue" +# exit 1; +# fi -CWD=$PWD -echo "current working directory" -echo $CWD +# CWD=$PWD +# echo "current working directory" +# echo $CWD + +# cd .. +# ls +# cd Scripts -cd .. -ls -cd Scripts -if [ ! -f $AGENT_IMAGE_TAR_FILE_NAME ]; then - echo "Agent tarfile: ${AGENT_IMAGE_TAR_FILE_NAME} does not exist, unable to continue" - exit 1 -fi if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty" @@ -43,6 +40,16 @@ if [ -z $AGENT_RELEASE ]; then exit 1 fi +echo "Downloading docker tarball image from $TARBALL_IMAGE_FILE_SAS" +wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}?${AGENT_IMAGE_SAS}" + +ls + +if [ ! -f $AGENT_IMAGE_TAR_FILE_NAME ]; then + echo "Agent tarfile: ${AGENT_IMAGE_TAR_FILE_NAME} does not exist, unable to continue" + exit 1 +fi + #Install crane echo "Installing crane" wget -O crane.tar.gz https://github.com/google/go-containerregistry/releases/download/v0.4.0/go-containerregistry_Linux_x86_64.tar.gz From 3a27e73b6157d52100c4276f9071f8209beff2f9 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 09:49:53 -0700 Subject: [PATCH 09/20] change blob variables --- .../ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json index b148233d8..75b987075 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -23,11 +23,11 @@ }, { "find": "__CONTAINER_URI__", - "replaceWith": "$(Storage.StorageContainerUri)" + "replaceWith": "$(StorageContainerUri)" }, { "find": "__CONTAINER_SAS_TOKEN__", - "replaceWith": "$(Storage.StorageContainerSasToken)" + "replaceWith": "$(StorageContainerSasToken)" } ] From 3e0208b2335fa98c2efadc54cf90614f1d0ea3cc Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 10:38:32 -0700 Subject: [PATCH 10/20] echo variables --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index de356b171..f3d2336a6 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -40,6 +40,14 @@ if [ -z $AGENT_RELEASE ]; then exit 1 fi +echo $AGENT_IMAGE_TAG_SUFFIX + +echo $AGENT_IMAGE_URI + +echo $AGENT_IMAGE_SAS + +echo "${AGENT_IMAGE_URI}" + echo "Downloading docker tarball image from $TARBALL_IMAGE_FILE_SAS" wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}?${AGENT_IMAGE_SAS}" From 385221fa01cd65b9528dfdef2438fdb92fe70edd Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 11:17:02 -0700 Subject: [PATCH 11/20] change blob uri --- .../ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json | 4 ++-- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json index 75b987075..b148233d8 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -23,11 +23,11 @@ }, { "find": "__CONTAINER_URI__", - "replaceWith": "$(StorageContainerUri)" + "replaceWith": "$(Storage.StorageContainerUri)" }, { "find": "__CONTAINER_SAS_TOKEN__", - "replaceWith": "$(StorageContainerSasToken)" + "replaceWith": "$(Storage.StorageContainerSasToken)" } ] diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index f3d2336a6..31684cf8a 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -49,7 +49,7 @@ echo $AGENT_IMAGE_SAS echo "${AGENT_IMAGE_URI}" echo "Downloading docker tarball image from $TARBALL_IMAGE_FILE_SAS" -wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}?${AGENT_IMAGE_SAS}" +wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${AGENT_IMAGE_TAG_SUFFIX}${AGENT_IMAGE_SAS}" ls From 6db9644991410e491375a386d87b96bbbcea953c Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 12:35:48 -0700 Subject: [PATCH 12/20] use release id for blob prefix --- .../ContainerInsights.Linux.Parameters.json | 4 ++++ .../ContainerInsights.Windows.Parameters.json | 4 ++++ .../ScopeBindings/Public.ScopeBindings.json | 6 +++++- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 13 ++++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json index 5ff0f9ad9..a5310734d 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -39,6 +39,10 @@ "name": "AGENT_IMAGE_TAR_FILE_NAME", "value": "agentimage.tar.gz" }, + { + "name": "RELEASE_ID", + "value": "__RELEASE_ID__" + }, { "name": "ACR_NAME", "value": "__ACR_NAME__" diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index 04c144feb..0c2032c6d 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -39,6 +39,10 @@ "name": "AGENT_IMAGE_TAR_FILE_NAME", "value": "agentimage.tar.gz" }, + { + "name": "RELEASE_ID", + "value": "__RELEASE_ID__" + }, { "name": "ACR_NAME", "value": "__ACR_NAME__" diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json index b148233d8..af65e96d4 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -16,7 +16,11 @@ { "find": "__AGENT_IMAGE_TAG_SUFFIX__", "replaceWith": "$(AgentImageTagSuffix)" - }, + }, + { + "find": "__RELEASE_ID__", + "replaceWith": "$(Release.ReleaseId)" + }, { "find": "__MANAGED_IDENTITY__", "replaceWith": "$(ManagedIdentity)" diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 31684cf8a..59cae1cb4 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -46,10 +46,11 @@ echo $AGENT_IMAGE_URI echo $AGENT_IMAGE_SAS -echo "${AGENT_IMAGE_URI}" +echo $RELEASE_ID + echo "Downloading docker tarball image from $TARBALL_IMAGE_FILE_SAS" -wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${AGENT_IMAGE_TAG_SUFFIX}${AGENT_IMAGE_SAS}" +wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${RELEASE_ID}${AGENT_IMAGE_SAS}" ls @@ -83,4 +84,10 @@ if [[ "$AGENT_IMAGE_TAR_FILE_NAME" == *"tar.zip"* ]]; then fi echo "Pushing file $TARBALL_IMAGE_FILE to $AGENT_IMAGE_FULL_PATH" -./crane push *.tar "$AGENT_IMAGE_FULL_PATH" \ No newline at end of file +./crane push *.tar "$AGENT_IMAGE_FULL_PATH" + +echo "Deleting agentimage copy from blob storage" + +az storage blob delete --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS + +echo "Deleted agentimate copy from blob storage" \ No newline at end of file From 89d1ab8d2aad26a4a37014119505937a312e6409 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 13:04:46 -0700 Subject: [PATCH 13/20] change to delete blob file --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 59cae1cb4..f8a79fe36 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -88,6 +88,8 @@ echo "Pushing file $TARBALL_IMAGE_FILE to $AGENT_IMAGE_FULL_PATH" echo "Deleting agentimage copy from blob storage" -az storage blob delete --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS +echo $RELEASE_ID + +az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" echo "Deleted agentimate copy from blob storage" \ No newline at end of file From 02a051b14f68ae53b679362b4e3ca371f185c1d9 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 13:40:40 -0700 Subject: [PATCH 14/20] add check for if blob storage file exists --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index f8a79fe36..39397d974 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -90,6 +90,12 @@ echo "Deleting agentimage copy from blob storage" echo $RELEASE_ID -az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" - -echo "Deleted agentimate copy from blob storage" \ No newline at end of file +$RESULT=$(az storage blob exists --container-name agent --name ${RELEASE_ID} --account-name cipipelinestorageev2 --sas-token ${AGENT_IMAGE_SAS}) +echo $RESULT + +if [[ -z $(az storage blob exists --container-name agent --name ${RELEASE_ID} --account-name cipipelinestorageev2 --sas-token ${AGENT_IMAGE_SAS}) ]]; then + az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" + echo "Deleted agentimate copy from blob storage" +else + echo "Agentimage has already been deleted from blob storage" +fi From b8f4bb78ee773dfc8f79faf7432d6f240e27c0f9 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 13:58:29 -0700 Subject: [PATCH 15/20] fix script errors --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 39397d974..2564847e7 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -90,10 +90,10 @@ echo "Deleting agentimage copy from blob storage" echo $RELEASE_ID -$RESULT=$(az storage blob exists --container-name agent --name ${RELEASE_ID} --account-name cipipelinestorageev2 --sas-token ${AGENT_IMAGE_SAS}) +RESULT=$(az storage blob exists --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS) echo $RESULT -if [[ -z $(az storage blob exists --container-name agent --name ${RELEASE_ID} --account-name cipipelinestorageev2 --sas-token ${AGENT_IMAGE_SAS}) ]]; then +if [[ -z $(az storage blob exists --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS) ]]; then az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" echo "Deleted agentimate copy from blob storage" else From eafc62c985047140f7da585852aa64936ae2d711 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 14:30:36 -0700 Subject: [PATCH 16/20] update check for file in storage --- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 2564847e7..022750135 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -90,10 +90,12 @@ echo "Deleting agentimage copy from blob storage" echo $RELEASE_ID -RESULT=$(az storage blob exists --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS) -echo $RESULT +BLOB_EXIST_RESULT=$(az storage blob exists --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS) +BLOB_EXIST=$(echo "$BLOB_EXIST_RESULT" | jq -r '.exists') +echo $BLOB_EXIST_RESULT +echo $BLOB_EXIST -if [[ -z $(az storage blob exists --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS) ]]; then +if [[ $BLOB_EXIST ]]; then az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" echo "Deleted agentimate copy from blob storage" else From 532259450c8cf7361ef8b843780e77410b573b9a Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 14:59:14 -0700 Subject: [PATCH 17/20] change true check --- .../agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 022750135..1a9b45db3 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -95,7 +95,7 @@ BLOB_EXIST=$(echo "$BLOB_EXIST_RESULT" | jq -r '.exists') echo $BLOB_EXIST_RESULT echo $BLOB_EXIST -if [[ $BLOB_EXIST ]]; then +if $BLOB_EXIST; then az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" echo "Deleted agentimate copy from blob storage" else From 05e9921360a1b49462a40959880d9976078e8782 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Tue, 7 Sep 2021 17:01:49 -0700 Subject: [PATCH 18/20] comments and change storage account info to pipeline variables --- .../ContainerInsights.Linux.Parameters.json | 8 +++ .../ContainerInsights.Windows.Parameters.json | 8 +++ .../RolloutSpecs/RolloutSpecs.json | 2 +- .../ScopeBindings/Public.ScopeBindings.json | 8 +++ .../Scripts/pushAgentToAcr.sh | 49 ++++--------------- 5 files changed, 35 insertions(+), 40 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json index a5310734d..1e1689c5e 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -35,6 +35,14 @@ "name": "AGENT_IMAGE_SAS", "value": "__CONTAINER_SAS_TOKEN__" }, + { + "name": "STORAGE_CONTAINER_NAME", + "value": "__STORAGE_CONTAINER_NAME__" + }, + { + "name": "STORAGE_ACCOUNT_NAME", + "value": "__STORAGE_ACCOUNT_NAME__" + }, { "name": "AGENT_IMAGE_TAR_FILE_NAME", "value": "agentimage.tar.gz" diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index 0c2032c6d..ace73ca18 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -35,6 +35,14 @@ "name": "AGENT_IMAGE_SAS", "value": "__CONTAINER_SAS_TOKEN__" }, + { + "name": "STORAGE_CONTAINER_NAME", + "value": "__STORAGE_CONTAINER_NAME__" + }, + { + "name": "STORAGE_ACCOUNT_NAME", + "value": "__STORAGE_ACCOUNT_NAME__" + }, { "name": "AGENT_IMAGE_TAR_FILE_NAME", "value": "agentimage.tar.gz" diff --git a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json index ae42a68f2..6899751f5 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json +++ b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -4,7 +4,7 @@ "RolloutMetadata": { "ServiceModelPath": "ServiceModels//Public.ServiceModel.json", "ScopeBindingsPath": "ScopeBindings//Public.ScopeBindings.json", - "Name": "ContainerInsightsExtension", + "Name": "ContainerInsightsAgent", "RolloutType": "Major", "BuildSource": { "Parameters": { diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json index af65e96d4..78c04e30d 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -32,6 +32,14 @@ { "find": "__CONTAINER_SAS_TOKEN__", "replaceWith": "$(Storage.StorageContainerSasToken)" + }, + { + "find": "__STORAGE_CONTAINER_NAME__", + "replaceWith": "$(StorageContainerName)" + }, + { + "find": "__STORAGE_ACCOUNT_NAME__", + "replaceWith": "$(StorageAccountName)" } ] diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 1a9b45db3..95b46af93 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -3,28 +3,6 @@ set -e # Note - This script used in the pipeline as inline script -# These are plain pipeline variable which can be modified anyone in the team -# AGENT_RELEASE=ciprod -# AGENT_IMAGE_TAG_SUFFIX=08202021 - -# LINUX_AGENT_IMAGE_FULL_PATH=${ACR_NAME}/public/azuremonitor/containerinsights/${AGENT_RELEASE}:${AGENT_RELEASE}${AGENT_IMAGE_TAG_SUFFIX} -# WINDOWS_AGENT_IMAGE_FULL_PATH=${ACR_NAME}/public/azuremonitor/containerinsights/${AGENT_RELEASE}:win-${AGENT_RELEASE}${AGENT_IMAGE_TAG_SUFFIX} - -# if [ -z ${AGENT_IMAGE_TAR_FILE_NAME+x} ]; then -# echo "AGENT_IMAGE_TAR_FILE_NAME is unset, unable to continue" -# exit 1; -# fi - -# CWD=$PWD -# echo "current working directory" -# echo $CWD - -# cd .. -# ls -# cd Scripts - - - if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty" exit 1 @@ -40,19 +18,10 @@ if [ -z $AGENT_RELEASE ]; then exit 1 fi -echo $AGENT_IMAGE_TAG_SUFFIX - -echo $AGENT_IMAGE_URI - -echo $AGENT_IMAGE_SAS - -echo $RELEASE_ID - - -echo "Downloading docker tarball image from $TARBALL_IMAGE_FILE_SAS" +#Download agentimage tarball from blob storage account +echo "Downloading tarball image from $AGENT_IMAGE_URI" wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${RELEASE_ID}${AGENT_IMAGE_SAS}" -ls if [ ! -f $AGENT_IMAGE_TAR_FILE_NAME ]; then echo "Agent tarfile: ${AGENT_IMAGE_TAR_FILE_NAME} does not exist, unable to continue" @@ -65,9 +34,10 @@ wget -O crane.tar.gz https://github.com/google/go-containerregistry/releases/dow tar xzvf crane.tar.gz echo "Installed crane" -#echo "Login cli using managed identity" -az login --identity +#Login to az cli and authenticate to acr +echo "Login cli using managed identity" +az login --identity echo "Getting acr credentials" TOKEN_QUERY_RES=$(az acr login -n "$ACR_NAME" -t) @@ -75,6 +45,7 @@ TOKEN=$(echo "$TOKEN_QUERY_RES" | jq -r '.accessToken') DESTINATION_ACR=$(echo "$TOKEN_QUERY_RES" | jq -r '.loginServer') ./crane auth login "$DESTINATION_ACR" -u "00000000-0000-0000-0000-000000000000" -p "$TOKEN" +#Prepare tarball and push to acr if [[ "$AGENT_IMAGE_TAR_FILE_NAME" == *"tar.gz"* ]]; then gunzip $AGENT_IMAGE_TAR_FILE_NAME fi @@ -86,17 +57,17 @@ fi echo "Pushing file $TARBALL_IMAGE_FILE to $AGENT_IMAGE_FULL_PATH" ./crane push *.tar "$AGENT_IMAGE_FULL_PATH" -echo "Deleting agentimage copy from blob storage" -echo $RELEASE_ID +#Delete agentimage tarball from blob storage to prevent future conflicts +echo "Deleting agentimage copy from blob storage" -BLOB_EXIST_RESULT=$(az storage blob exists --container-name agent --name $RELEASE_ID --account-name cipipelinestorageev2 --sas-token $AGENT_IMAGE_SAS) +BLOB_EXIST_RESULT=$(az storage blob exists --container-name $STORAGE_CONTAINER_NAME --name $RELEASE_ID --account-name $STORAGE_ACCOUNT_NAME --sas-token $AGENT_IMAGE_SAS) BLOB_EXIST=$(echo "$BLOB_EXIST_RESULT" | jq -r '.exists') echo $BLOB_EXIST_RESULT echo $BLOB_EXIST if $BLOB_EXIST; then - az storage blob delete --container-name "agent" --name "${RELEASE_ID}" --account-name "cipipelinestorageev2" --sas-token "${AGENT_IMAGE_SAS}" + az storage blob delete --container-name "${STORAGE_CONTAINER_NAME}" --name "${RELEASE_ID}" --account-name "${STORAGE_ACCOUNT_NAME}" --sas-token "${AGENT_IMAGE_SAS}" echo "Deleted agentimate copy from blob storage" else echo "Agentimage has already been deleted from blob storage" From 0bf65d540cc89e5eac44c44c0ceadd0c3eb519da Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 10 Sep 2021 15:47:43 -0700 Subject: [PATCH 19/20] Changes for windows tar file --- .../Parameters/ContainerInsights.Linux.Parameters.json | 4 ++++ .../Parameters/ContainerInsights.Windows.Parameters.json | 6 +++++- .../ServiceGroupRoot/Scripts/pushAgentToAcr.sh | 2 +- 3 files changed, 10 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 1e1689c5e..ed169f5a5 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -27,6 +27,10 @@ "pushAgentToAcr.sh" ], "environmentVariables": [ + { + "name": "WINDOWS", + "value": "" + }, { "name": "AGENT_IMAGE_URI", "value": "__CONTAINER_URI__" diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index ace73ca18..bca2302e4 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -27,6 +27,10 @@ "pushAgentToAcr.sh" ], "environmentVariables": [ + { + "name": "WINDOWS", + "value": "win-" + }, { "name": "AGENT_IMAGE_URI", "value": "__CONTAINER_URI__" @@ -45,7 +49,7 @@ }, { "name": "AGENT_IMAGE_TAR_FILE_NAME", - "value": "agentimage.tar.gz" + "value": "agentimage.tar.zip" }, { "name": "RELEASE_ID", diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 95b46af93..98bfa51e2 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -20,7 +20,7 @@ fi #Download agentimage tarball from blob storage account echo "Downloading tarball image from $AGENT_IMAGE_URI" -wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${RELEASE_ID}${AGENT_IMAGE_SAS}" +wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${WINDOWS}${RELEASE_ID}${AGENT_IMAGE_SAS}" if [ ! -f $AGENT_IMAGE_TAR_FILE_NAME ]; then From 043b4941af8ea7ab632c4b5ff87f0b8ee2376334 Mon Sep 17 00:00:00 2001 From: sarahpeiffer Date: Fri, 10 Sep 2021 16:32:23 -0700 Subject: [PATCH 20/20] PR changes --- .../ContainerInsights.Linux.Parameters.json | 3 +- .../ContainerInsights.Windows.Parameters.json | 3 +- .../RolloutSpecs/RolloutSpecs.json | 5 +- .../ScopeBindings/Public.ScopeBindings.json | 2 +- .../Scripts/pushAgentToAcr.sh | 54 +++++++++++++++---- .../ServiceModels/Public.ServiceModel.json | 3 +- 6 files changed, 51 insertions(+), 19 deletions(-) diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json index ed169f5a5..598ce9698 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -81,5 +81,4 @@ } } ] - } - \ No newline at end of file + } \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json index bca2302e4..9d208e0c6 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json +++ b/deployment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json @@ -81,5 +81,4 @@ } } ] - } - \ No newline at end of file + } \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json index 6899751f5..f015cf5d3 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json +++ b/deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -13,7 +13,7 @@ }, "Notification": { "Email": { - "To": "sarahpeiffer@microsoft.com" + "To": "omscontainers@microsoft.com" } } }, @@ -33,5 +33,4 @@ "dependsOn": [ ] } ] - } - \ No newline at end of file + } \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json index 78c04e30d..99acfb68e 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -45,4 +45,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh index 98bfa51e2..7e73a6230 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh +++ b/deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -4,22 +4,42 @@ set -e # Note - This script used in the pipeline as inline script if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then - echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty" + echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty. check release variables" exit 1 fi -if [ ${#AGENT_IMAGE_TAG_SUFFIX} -ne 8 ]; then - echo "-e error length of AGENT_IMAGE_TAG_SUFFIX should be 8. Make sure it is in MMDDYYYY format" +if [ -z $AGENT_RELEASE ]; then + echo "-e error AGENT_RELEASE shouldnt be empty. check release variables" exit 1 fi -if [ -z $AGENT_RELEASE ]; then - echo "-e error AGENT_RELEASE shouldnt be empty" +if [ -z $AGENT_IMAGE_URI ]; then + echo "-e error value of AGENT_IMAGE_URI shouldn't be empty. check output from file copy release task" + exit 1 +fi + +if [ -z $AGENT_IMAGE_SAS ]; then + echo "-e error value of AGENT_IMAGE_SAS shouldn't be empty. check output from file copy release task" + exit 1 +fi + +if [ -z $STORAGE_CONTAINER_NAME ]; then + echo "-e error value of STORAGE_CONTAINER_NAME shouldn't be empty. check release variables" + exit 1 +fi + +if [ -z $STORAGE_ACCOUNT_NAME ]; then + echo "-e error value of STORAGE_ACCOUNT_NAME shouldn't be empty. check release variables" + exit 1 +fi + +if [ -z $ACR_NAME ]; then + echo "-e error value of ACR_NAME shouldn't be empty. check release variables" exit 1 fi #Download agentimage tarball from blob storage account -echo "Downloading tarball image from $AGENT_IMAGE_URI" +echo "Downloading tarball image from $WINDOWS $AGENT_IMAGE_URI" wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${WINDOWS}${RELEASE_ID}${AGENT_IMAGE_SAS}" @@ -31,6 +51,12 @@ fi #Install crane echo "Installing crane" wget -O crane.tar.gz https://github.com/google/go-containerregistry/releases/download/v0.4.0/go-containerregistry_Linux_x86_64.tar.gz +if [ $? -eq 0 ]; then + echo "crane downloaded successfully" +else + echo "-e error crane download failed" + exit 1 +fi tar xzvf crane.tar.gz echo "Installed crane" @@ -42,7 +68,17 @@ az login --identity echo "Getting acr credentials" TOKEN_QUERY_RES=$(az acr login -n "$ACR_NAME" -t) TOKEN=$(echo "$TOKEN_QUERY_RES" | jq -r '.accessToken') +if [ -z $TOKEN ]; then + echo "-e error failed to get az acr login token" + exit 1 +fi + DESTINATION_ACR=$(echo "$TOKEN_QUERY_RES" | jq -r '.loginServer') +if [ -z $DESTINATION_ACR ]; then + echo "-e error value of DESTINATION_ACR shouldnt be empty" + exit 1 +fi + ./crane auth login "$DESTINATION_ACR" -u "00000000-0000-0000-0000-000000000000" -p "$TOKEN" #Prepare tarball and push to acr @@ -61,14 +97,14 @@ echo "Pushing file $TARBALL_IMAGE_FILE to $AGENT_IMAGE_FULL_PATH" #Delete agentimage tarball from blob storage to prevent future conflicts echo "Deleting agentimage copy from blob storage" -BLOB_EXIST_RESULT=$(az storage blob exists --container-name $STORAGE_CONTAINER_NAME --name $RELEASE_ID --account-name $STORAGE_ACCOUNT_NAME --sas-token $AGENT_IMAGE_SAS) +BLOB_EXIST_RESULT=$(az storage blob exists --container-name $STORAGE_CONTAINER_NAME --name $WINDOWS$RELEASE_ID --account-name $STORAGE_ACCOUNT_NAME --sas-token $AGENT_IMAGE_SAS) BLOB_EXIST=$(echo "$BLOB_EXIST_RESULT" | jq -r '.exists') echo $BLOB_EXIST_RESULT echo $BLOB_EXIST if $BLOB_EXIST; then - az storage blob delete --container-name "${STORAGE_CONTAINER_NAME}" --name "${RELEASE_ID}" --account-name "${STORAGE_ACCOUNT_NAME}" --sas-token "${AGENT_IMAGE_SAS}" + az storage blob delete --container-name "${STORAGE_CONTAINER_NAME}" --name "${WINDOWS}${RELEASE_ID}" --account-name "${STORAGE_ACCOUNT_NAME}" --sas-token "${AGENT_IMAGE_SAS}" echo "Deleted agentimate copy from blob storage" else echo "Agentimage has already been deleted from blob storage" -fi +fi \ No newline at end of file diff --git a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json index 5aab38959..b7bd4aa26 100644 --- a/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json +++ b/deployment/agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json @@ -53,5 +53,4 @@ ] } ] - } - \ No newline at end of file + } \ No newline at end of file