Skip to content

[Feature Request] BREAKING change: Protect namePrefix value to further mitigate pipeline failures due to existing globally unique names #1440

Closed

Description

@eriqua

Description

Context

Managing the namePrefix token through the settings.json mitigated the risk of losing ownership on the globally unique resource names such as keyvaults.
It turns out that it is not enough since those names keep on being used by others, most likely carml users who forget to change the namePrefix value before running the pipelines. That is causing related pipelines to fail in the CARML testing environment due to resource names being already taken.
We currently need to change those names and further regenerate readmes containing 1:1 module samples to solve corresponding pipelines failures.
This is expected to get worse with the increase of the CARML usage and with the introduction of the new dependencies approach, since also dependencies will be removed and the number of failing pipelines is likely to increase.

Suggestion

  • Create a new GH secret/ADO variable to host the namePrefix
  • Keep the possibility to manage the token via the settings.json
  • Implement a logic to give priority to the settings.json token if set, default to the secret otherwise
  • In CARML comment out the namePrefix token in the settings.json and remove our value for the CI environment to leverage the env variable.
  • Update the test module locally scripts accordingly
  • Update documentation

cc: Ahmad Abdalla (@ahmadabdalla), @MrMCake

Activity

  1. added
    enhancement
    [cat] pipelines
    [cat] testing
    on May 26, 2022
  2. AlexanderSehr commented on May 26, 2022

    @AlexanderSehr
    Contributor

    I approve this message.

  3. ahmadabdalla commented on May 27, 2022

    @ahmadabdalla
    Contributor

    Happy to support with this feature 😃

  4. ahmadabdalla commented on May 31, 2022

    @ahmadabdalla
    Contributor

    Erika Gressi (@eriqua) @MrMCake Thinking about this

    • If we default to the file unless a GitHub Secret namePrefix exists, we do not have to comment out the settings and rely on the secret instead.

    Options

    Option 1

    Add the namePrefix token as a GitHub secret to be available as an environment variable. Add it on each workflow, and modify the actions to create an exception for the namePrefix token to be processed differently when the local tokens are being searched like the below:

    if(($token.name -eq 'namePrefix') -and '${{ env.NAMEPREFIX }}'){
       $token.value = '${{ env.NAMEPREFIX }}'
    }
    • quickest option but is not scalable as we have to do a similar thing for other use cases (if they ever come up, so maybe if they do we develop option2?)

    Option 2

    Add the namePrefix token as a GitHub secret to be available as an environment variable. Migrate tokens and config to the global variables YAML, if it gets provided in the YAML, then it supersedes the one coming in from the GitHub Secret. This uses the existing setEnvironmentVariables

    • A lot more work involved, and needs proper testing as well

    CC: Marius Storhaug (@MariusStorhaug)

  5. ahmadabdalla commented on Jun 1, 2022

    @ahmadabdalla
    Contributor

    Marius Storhaug (@MariusStorhaug) Erika Gressi (@eriqua) @MrMCake need your inputs please on the proposal/options above.

  6. MariusStorhaug commented on Jun 6, 2022

    @MariusStorhaug
    Contributor

    I vote option 2, with the added value of achieving what originally intended in the issue (#953) regarding simplifying settings and variables.

  7. changed the title [-][Feature Request]: Protect namePrefix value to further mitigate pipeline failures due to existing globally unique names[/-] [+][Feature Request]: Protect `namePrefix` value to further mitigate pipeline failures due to existing globally unique names[/+] on Jun 6, 2022
  8. ahmadabdalla commented on Jun 9, 2022

    @ahmadabdalla
    Contributor

    @MrMCake Erika Gressi (@eriqua) Marius Storhaug (@MariusStorhaug)

    Just some updates. The following PoC works from a 'pipeline' perspective:

    • Removed the validateModuleDeployment dependency on the settings.json and embedded its content into the globalvariables.yml.
    • Supported the namePrefix token to be prioritized from a GitHub secret IF provided, otherwise will default to the local one.

    Network: ApplicationSecurityGroups

    Some complications:

    • Our global tests Pester depends on the settings.json to perform the tokens parameter file tests (i.e. if someone didn't replace a token in their parameter file these tests detect it). Replacing this mechanism needs more work as we need to rely on the convert YAML to object script to perform a similar function, or need to think of a better way to achieve this.
    • Our test module locally wrapper also depends on the settings.json. Similar to the above.

    I'm keen to demo the PoC soon and get some feedback.

    image

  9. MariusStorhaug commented on Jun 26, 2022

    @MariusStorhaug
    Contributor

    I left my update on the matter in the other issue that Ahmad has (#1363):

    #1363 (comment)

  10. changed the title [-][Feature Request]: Protect `namePrefix` value to further mitigate pipeline failures due to existing globally unique names[/-] [+][Feature Request]: BREAKING change: Protect `namePrefix` value to further mitigate pipeline failures due to existing globally unique names[/+] on Jul 25, 2022
  11. changed the title [-][Feature Request]: BREAKING change: Protect `namePrefix` value to further mitigate pipeline failures due to existing globally unique names[/-] [+][Feature Request] BREAKING change: Protect `namePrefix` value to further mitigate pipeline failures due to existing globally unique names[/+] on Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[cat] pipelines[cat] testingenhancement

Type

No type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions