-
Notifications
You must be signed in to change notification settings - Fork 92
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
Improve subscription deployment's management group id detection #168
Comments
A possible solution using enumerator instead of boolean. This allows for different schemes in the future. #!/bin/bash
readarray -t dparts < <(echo "CanadaESLZ-poc/pubsec/LandingZones/DevTest/4f9f8765-911a-4a6d-af60-4bc0473268c0_generic-subscription_canadacentral.json" | tr "/" "\n")
generateSubscriptionManagementGroupIdUsing='FolderName'
#generateSubscriptionManagementGroupIdUsing='FolderHierarchy'
echo $generateSubscriptionManagementGroupIdUsing
case $generateSubscriptionManagementGroupIdUsing in
FolderName)
echo 'By folder name: ' ${dparts[@]:${#dparts[@]}-2:1}
;;
*)
echo 'By hierarchy: ' ${dparts[@]:1:${#dparts[@]}-2}
;;
esac
When:
|
@SenthuranSivananthan the script logic already handles flattening the structure - both pre and post MG hierarchy configuration improvements. Basically, it takes the folder elements from the full path between the base subscription config folder (config/subscriptions/DevOpsOrg-Branch), joins them together, and uses that as the target management group id. So for example, in our legacy structure where we specified only the MG id in To summarize, existing script logic supports either nested folder or flat folder locations for the subscription JSON config files, so I think we can close this issue without code changes unless I'm not understanding the ask. |
Converting to a documentation issue. |
I see your point. I think we can document as:
|
I'd like us to make the following points clear in the doc enhancements:
|
When subscriptions are configured through the
subscription-ci
pipeline, the management group id is inferred by the folder structure where the subscription's parameters JSON file is located.For example:
Notice that we've taken the relative path and removed the parent folder
CanadaESLZ-main/
, then removed the/
to create the management group id. We chose this path so that long folder paths does not hit any folder path limits.This approach works along as as customers use the management group id of the parent as the prefix. For example:
But it now longer works when the management group ids are customized to remove the prefixes. To support the scenario where the management group ids does not include the prefix of the parent management group, I propose the following changes:
Add a new parameter to
common.yml
:generateSubscriptionManagementGroupIdFromFolderHierarchy
with values of eithertrue
orfalse
. Default value =true
so respect the current implementation.Update
.pipelines/templates/jobs/deploy-subscription.yml
so that this flag is used when determining the management group.Example:
true
: current implementation. Output will bepubsecLandingZonesProd
false
: use the folder name of the subscription JSON. Output will beProd
The text was updated successfully, but these errors were encountered: