Skip to content

Simplify tokenreplacement and variables in the repo #953

Closed

Description

Description

Written from the PoV of a contributor.

The following scenarios comes to mind:

  1. A contributor forks repo, sets up variables and token settings to deploy dependencies, validation and publishing resources. After making a new module or adjusting one, the contributors repo will either need to cherrypick or revert changes in their repo before doing a PR to the Azure/ResourceModules repo. These settings should maybe be moved to something that is not controlled in code?
  2. When using the solution to set up a fork for PoC and contribution, i update .\settings.json, .github\variables\global.variables.json and .azuredevops\pipelineVariables\global.variables.yml so it reflects my own setup or align with organization naming conventions. When I then run pipelines most pipelines fail as they are referring to a "hardcoded" rg for validation, validation-rg. This is not a true variable for the time being as it requires some search and replace if the RG variables are changed in the variable files.

There are many moving parts to configure a solution for variable management in the solution:

  • 3 files that need to change interdependently:
    • .\settings.json
    • .github\variables\global.variables.json
    • .azuredevops\pipelineVariables\global.variables.yml
  • A set of secrets for GH
  • A variable group + service connection for ADO

Could this be simpler where both the token replacer and variables are managed from a single place, which does not affect the content of the git repo, making also the contribution aspect easier?

Activity

  1. MariusStorhaug commented on Feb 1, 2022

    @MariusStorhaug
    ContributorAuthor

    Could it be all handled in a GitHub environment/secrets or ADO variable group? Keeping it all as a unified way to manage variables, token replacement, additionalParameters, and credentials similarly across the two platforms?

  2. added this to the milestone on Mar 3, 2022
  3. rahalan commented on Mar 3, 2022

    @rahalan
    Contributor

    Ahmad Abdalla (@ahmadabdalla) please arrange a brain-storming session to see how far you already are and if there are design decisions we need to revisit

  4. ahmadabdalla commented on Mar 10, 2022

    @ahmadabdalla
    Contributor

    (Point 2)

    Updates based on the brainstorming session + PoC

    • The concept in principle is good. As it does make it easier to configure things in a unique location (settings.json) However, we need to take into consideration the following:

      • User experience: Most users taking the platform will choose one tool (ADO or GitHub). So, they can simply delete the whole folder that contains the CI tool and configurations associated.
      • Native capability: Combining variables files into that is not for example YAML based, requires us to forgo a native capability in ADO to store variables (using a dedicated YAML file). Hence might not receive the best feedback from the community as there is an additional component that have to manage (i.e. a task with custom code that sets the variables)
    • For GitHub: It is easy to roll out a dedicated action that sets variables from a file that we can control the format of. So, we can investigate swapping the current marketplace action with a custom one and point it to the same global variable YAML that we use for ADO but writing the logic to consume this file.

    • Good to understand, who are we solving this problem for? Is it us as the maintainers who are supporting multiple platforms, or is it the end user who is likely to choose one?

    • For 'optional' features, we can still use them as variables for now. But we need to first have a concrete definition on what is a core feature, and what is optional, so we can build the right framework to support feature flags.

    Next Steps:

    • Understand if GHA is going to bring in the native support for variables through YAMLs like ADO.
    • See if we can change the PoC to get GHA to consume the same global variables YAML used in ADO.

    Cc: @MrMCake Rainer Halanek (@rahalan) Marius Storhaug (@MariusStorhaug) Erika Gressi (@eriqua) Margarita Sanz (@Msanzdelrio) Simone Bertaccini (@simonbMS)

  5. ahmadabdalla commented on Mar 16, 2022

    @ahmadabdalla
    Contributor

    Latest prototype:

    • GitHub actions now use the same file as ADO, by performing the following:
      • New Composite action, replacing the current marketplace one for translating variables into environment variables.
      • The action leverages a PowerShell module from the gallery that allows reading YAML files and converting them into hash table, which are then injected as environment variables.
    • Azure DevOps still uses the same native method (YAML) file as template for variables. However, the path will change given that the same file will be shared for both platforms.
    • Moved the global.variables.yml to the root so it can be used by both ADO and GitHub action
  6. removed this from the milestone on Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions