Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

ci: add storage account cleanup to VHD pipeline #589

Merged
merged 6 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions .pipelines/vhd-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ phases:
-e VHD_NAME=${VHD_NAME} \
${DEIS_GO_DEV_IMAGE} make az-copy
displayName: Copying resource to Classic Storage Account
condition: not(variables['DRY_RUN'])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ensures we only copy the disk to a classic storage account if DRY_RUN is set to False (True by default). That way, we won't clutter the classic SA for PR builds.

- script: |
SA_NAME="$(cat packer-output | grep "creating new storage account" | cut -d " " -f 5)" && \
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/aks-engine \
-w /go/src/github.com/Azure/aks-engine \
-e CLIENT_ID=${CLIENT_ID} \
-e CLIENT_SECRET="$(CLIENT_SECRET)" \
-e TENANT_ID=${TENANT_ID} \
-e SA_NAME=${SA_NAME} \
-e AZURE_RESOURCE_GROUP_NAME=${AZURE_RESOURCE_GROUP_NAME} \
${DEIS_GO_DEV_IMAGE} make delete-sa
displayName: Clean-up Storage Account
- script: |
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/aks-engine \
Expand Down
3 changes: 3 additions & 0 deletions packer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ run-packer: az-login
az-copy: az-login
azcopy --source "${OS_DISK_SAS}" --destination "${CLASSIC_BLOB}/${VHD_NAME}" --dest-sas "${CLASSIC_SAS_TOKEN}"

delete-sa: az-login
az storage account delete -n ${SA_NAME} -g ${AZURE_RESOURCE_GROUP_NAME} --yes

generate-sas: az-login
az storage container generate-sas --name vhds --permissions lr --connection-string "${CLASSIC_SA_CONNECTION_STRING}" --start ${START_DATE} --expiry ${EXPIRY_DATE} | tr -d '"' | tee -a vhd-sas && cat vhd-sas