Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions java/spring/container/Scripts/promote-groups.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#!/bin/sh
# Delete old deprecated resource groups before setting current prod to deprecated.
./delete-groups-by-tag.sh Environment=deprecated
echo "Querying for production resource groups."
groups=$(az group list --tag Environment=production --query "[].name" --output tsv)
for name in $groups
do
echo "Updating tags for resource group:" $name
az group update --name $name --tags Environment=deprecated
./update-group-tag-by-name.sh $name Environment=deprecated
done
echo "Querying for pre production resource groups."
echo "Querying for pre-production resource groups."
groups=$(az group list --tag Environment=pre-production --query "[].name" --output tsv)
for name in $groups
do
echo "Updating tags for resource group:" $name
az group update --name $name --tags Environment=production
done
./update-group-tag-by-name.sh $name Environment=production
done
# Output production group list to file.
mkdir -p logs/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might also be helpful to write out a timestamp here so we know when this was last run. I'm thinking about the case where you run it multiple times in the same directory -- and you want the output to be appended so you don't lose the last output.

destdir=logs/promotion-list
echo "Saving list of updated resource groups to logs/promotion-list"
echo "$groups" > "$destdir"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you wanting to keep appending to logs/promotion-list or to overwrite it? You probably want >> here.