Skip to content
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

Auto upgrade firewall #2942

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FEATURES:
ENHANCEMENTS:
* Remove Porter's Docker mixin as it's not in use ([#2889](https://github.com/microsoft/AzureTRE/pull/2889))
* Support template version update ([#2908](https://github.com/microsoft/AzureTRE/pull/2908))
* Support updating the firewall when installing via makefile/CICD ([#2942](https://github.com/microsoft/AzureTRE/pull/2942))

BUG FIXES:
* Private endpoints for AppInsights are now provisioning successfully and consistently ([#2841](https://github.com/microsoft/AzureTRE/pull/2841))
Expand Down
44 changes: 28 additions & 16 deletions devops/scripts/deploy_shared_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ fi
deployed_shared_service=$(echo "${get_shared_services_result}" \
| jq -r ".sharedServices[] | select(.templateName == \"${template_name}\" and (.deploymentStatus != \"deleted\" or .deploymentStatus != \"deployment_failed\"))")

is_update=0
if [[ -n "${deployed_shared_service}" ]]; then
# Get template version of the service already deployed
deployed_version=$(echo "${deployed_shared_service}" | jq -r ".templateVersion")
Expand All @@ -59,22 +60,23 @@ if [[ -n "${deployed_shared_service}" ]]; then
echo "Shared service ${template_name} of version ${template_version} has already been deployed"
exit 0
else
echo "Resource upgrade isn't currently implemented. See https://github.com/microsoft/AzureTRE/issues/141"
exit 0
is_update=1
fi
fi

# Add additional properties to the payload JSON string
additional_props=""
for index in "${!property_names[@]}"; do
name=${property_names[$index]}
value=${property_values[$index]}
additional_props="$additional_props, \"$name\": \"$value\""
done
if [[ "${is_update}" -eq 0 ]]; then

# Add additional properties to the payload JSON string
additional_props=""
for index in "${!property_names[@]}"; do
name=${property_names[$index]}
value=${property_values[$index]}
additional_props="$additional_props, \"$name\": \"$value\""
done

echo "Not currently deployed - deploying..."
display_name="${template_name#tre-shared-service-}"
if ! deploy_result=$(cat << EOF | tre shared-services new --definition-file -
echo "Not currently deployed - deploying..."
display_name="${template_name#tre-shared-service-}"
if ! deploy_result=$(cat << EOF | tre shared-services new --definition-file -
tamirkamara marked this conversation as resolved.
Show resolved Hide resolved
{
"templateName": "${template_name}",
"properties": {
Expand All @@ -84,9 +86,19 @@ if ! deploy_result=$(cat << EOF | tre shared-services new --definition-file -
}
}
EOF
); then
echo "Failed to deploy shared service:"
echo "${deploy_result}"
exit 1
); then
echo "Failed to deploy shared service:"
echo "${deploy_result}"
exit 1
fi

else

echo "An older version is already deloyed. Trying to update..."
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo in deployed

deployed_id=$(echo "${deployed_shared_service}" | jq -r ".id")
deployed_etag=$(echo "${deployed_shared_service}" | jq -r "._etag")
tre shared-service "${deployed_id}" update --etag "${deployed_etag}" --definition "{\"templateVersion\": \"${template_version}\"}"

fi

echo "Deployed shared service ""${template_name}"""