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

Add template to merge multiple subscription configurations #1560

Merged
merged 2 commits into from
Apr 19, 2021
Merged

Add template to merge multiple subscription configurations #1560

merged 2 commits into from
Apr 19, 2021

Conversation

benbp
Copy link
Member

@benbp benbp commented Apr 15, 2021

This PR adds a new step that will merge multiple subscription configuration objects (initially sourced as json from keyvault via devops variable groups), and output a single object as a devops variable. This will allow service owners to manage additional subscription configurations independent of the ones we maintain. For example, the communication service has the need for their own config to store strings that vary per-cloud (e.g. static testing phone number assets and connection strings), but that also must be combined with our base configs. Right now we have to keep a separate config that, since it contains our testing principal, only the azure sdk engsys team has access to. Making it easier to maintain multiple configurations will reduce our config duplication, and also lay groundwork for keeping access credential configs separate from cloud configs for environment variables and arm template parameters.

The usage in the live.tests.yml files changes slightly to:

      - template: /eng/common/TestResources/build-test-resource-config.yml
        parameters:
          SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}

      - template: /eng/common/TestResources/deploy-test-resources.yml
        parameters:
          ${{ if or(parameters.Location, parameters.CloudConfig.Location) }}:
            Location: ${{ coalesce(parameters.Location, parameters.CloudConfig.Location) }}
          ServiceDirectory: '${{ parameters.ServiceDirectory }}'
          SubscriptionConfiguration: $(SubscriptionConfiguration)
          ArmTemplateParameters: $(ArmTemplateParameters)

      ... test job stuff ...

      - template: /eng/common/TestResources/remove-test-resources.yml
        parameters:
          ServiceDirectory: '${{ parameters.ServiceDirectory }}'
          SubscriptionConfiguration: $(SubscriptionConfiguration)

The usage for a service owner tests.yml file looks like below, showing an example of both single and multiple subscription configurations for a cloud:

parameters:
  CloudConfig:
    Public:
      SubscriptionConfigurations:
        - $(sub-config-azure-test-resources)
        - $(sub-config-myservice-test-resources)
    PreProd:
      SubscriptionConfiguration: $(sub-config-myservice-preprod-test-resources)

@benbp benbp self-assigned this Apr 15, 2021
@benbp benbp added the Central-EngSys This issue is owned by the Engineering System team. label Apr 15, 2021
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@benbp
Copy link
Member Author

benbp commented Apr 16, 2021

Passing test with normal SubscriptionConfiguration (i.e. regression against no config changes): https://dev.azure.com/azure-sdk/internal/_build/results?buildId=847788&view=logs&j=68082d65-ebf7-5f3f-494d-d3fd09e80dd6

Test using new config merging: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=847902&view=results

'@ | ConvertFrom-Json -AsHashtable

foreach ($pair in $addToConfig.GetEnumerator()) {
if ($pair.Value -is [Hashtable]) {
Copy link
Member

Choose a reason for hiding this comment

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

This assumes only one level of nesting is that safe to assume?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically, someone could update a config they manage to contain more levels of nesting, but it would be ignored by all our scripts anyway, since we explicitly only look for EnvironmentVariablers and ArmTemplateParameters.

It may be helpful to publish a json schema somewhere for authors of subscription configs. I'm planning on writing a big doc next week to map out all aspects of configuring multi-cloud tests, so I'll include some config schema guidance as well.

Copy link
Member

@weshaggard weshaggard left a comment

Choose a reason for hiding this comment

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

Left a couple comments but otherwise looks reasonable. I assume you will integrate this into use as part of another PR as I don't see those changes here.

@benbp
Copy link
Member Author

benbp commented Apr 16, 2021

@weshaggard yep, usage of this goes into the live.tests.yml files in the language repos. It will include the addition of the template:

      - template: /eng/common/TestResources/build-test-resource-config.yml
        parameters:
          SubscriptionConfiguration: ${{ parameters.CloudConfig.SubscriptionConfiguration }}
          SubscriptionConfigurations: ${{ parameters.CloudConfig.SubscriptionConfigurations }}

As well as changing references to ${{ parameters.CloudConfig.SubscriptionConfiguration }} downstream of the template to $(SubscriptionConfiguration).

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@ghost
Copy link

ghost commented Apr 19, 2021

Hello @azure-sdk!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@benbp
Copy link
Member Author

benbp commented Apr 19, 2021

/check-enforcer override

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants