-
Notifications
You must be signed in to change notification settings - Fork 115
Sarah/ev2 #640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Sarah/ev2 #640
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8d0537c
ev2 artifacts for release pipeline
sarahpeiffer be8a4c7
update parameters reference
sarahpeiffer e50e3fe
add artifacts tar file
sarahpeiffer 2f7c0d0
changes to rollout and service model
sarahpeiffer 349d1ba
change agentimage path
sarahpeiffer b1f8982
adding agentimage to artifact script
sarahpeiffer 089abeb
removing charts from tarball
sarahpeiffer aff2439
change script to use blob storage
sarahpeiffer 3a27e73
change blob variables
sarahpeiffer 3e0208b
echo variables
sarahpeiffer 385221f
change blob uri
sarahpeiffer 6db9644
use release id for blob prefix
sarahpeiffer 89d1ab8
change to delete blob file
sarahpeiffer 02a051b
add check for if blob storage file exists
sarahpeiffer b8f4bb7
fix script errors
sarahpeiffer eafc62c
update check for file in storage
sarahpeiffer 5322594
change true check
sarahpeiffer 05e9921
comments and change storage account info to pipeline variables
sarahpeiffer 0bf65d5
Changes for windows tar file
sarahpeiffer 043b494
PR changes
sarahpeiffer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...ment/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "$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": "WINDOWS", | ||
| "value": "" | ||
| }, | ||
| { | ||
| "name": "AGENT_IMAGE_URI", | ||
| "value": "__CONTAINER_URI__" | ||
| }, | ||
| { | ||
| "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" | ||
| }, | ||
| { | ||
| "name": "RELEASE_ID", | ||
| "value": "__RELEASE_ID__" | ||
| }, | ||
| { | ||
| "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__" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
84 changes: 84 additions & 0 deletions
84
...nt/agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Windows.Parameters.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "$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": "WINDOWS", | ||
| "value": "win-" | ||
| }, | ||
| { | ||
| "name": "AGENT_IMAGE_URI", | ||
| "value": "__CONTAINER_URI__" | ||
| }, | ||
| { | ||
| "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.zip" | ||
| }, | ||
| { | ||
| "name": "RELEASE_ID", | ||
| "value": "__RELEASE_ID__" | ||
| }, | ||
| { | ||
| "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__" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } |
36 changes: 36 additions & 0 deletions
36
deployment/agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "$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": "ContainerInsightsAgent", | ||
| "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": [ ] | ||
| } | ||
| ] | ||
| } |
48 changes: 48 additions & 0 deletions
48
deployment/agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| { | ||
| "$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": "__RELEASE_ID__", | ||
| "replaceWith": "$(Release.ReleaseId)" | ||
| }, | ||
| { | ||
| "find": "__MANAGED_IDENTITY__", | ||
| "replaceWith": "$(ManagedIdentity)" | ||
| }, | ||
| { | ||
| "find": "__CONTAINER_URI__", | ||
| "replaceWith": "$(Storage.StorageContainerUri)" | ||
| }, | ||
| { | ||
| "find": "__CONTAINER_SAS_TOKEN__", | ||
| "replaceWith": "$(Storage.StorageContainerSasToken)" | ||
| }, | ||
| { | ||
| "find": "__STORAGE_CONTAINER_NAME__", | ||
| "replaceWith": "$(StorageContainerName)" | ||
| }, | ||
| { | ||
| "find": "__STORAGE_ACCOUNT_NAME__", | ||
| "replaceWith": "$(StorageAccountName)" | ||
| } | ||
|
|
||
| ] | ||
| } | ||
| ] | ||
| } |
110 changes: 110 additions & 0 deletions
110
deployment/agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/bin/bash | ||
| 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. check release variables" | ||
| 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_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 $WINDOWS $AGENT_IMAGE_URI" | ||
| wget -O $AGENT_IMAGE_TAR_FILE_NAME "${AGENT_IMAGE_URI}${WINDOWS}${RELEASE_ID}${AGENT_IMAGE_SAS}" | ||
|
|
||
|
|
||
| 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 | ||
ganga1980 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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" | ||
|
|
||
|
|
||
| #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) | ||
| 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') | ||
ganga1980 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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" | ||
sarahpeiffer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #Prepare tarball and push to acr | ||
| 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" | ||
|
|
||
|
|
||
| #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 $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 "${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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.