FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[CI Environment] Do not delete tags that already exist on subscription level by ntaheij · Pull Request #3280 · Azure/ResourceModules · GitHub

[CI Environment] Do not delete tags that already exist on subscription level - #3280

Draft
Noah Taheij (ntaheij) wants to merge 2 commits into
Azure:mainfrom
ntaheij:main
Draft

[CI Environment] Do not delete tags that already exist on subscription level#3280
Noah Taheij (ntaheij) wants to merge 2 commits into
Azure:mainfrom
ntaheij:main

Conversation

Noah Taheij (ntaheij) commented May 26, 2023
edited
Loading

Copy link
Copy Markdown

Description

Currently, whenever the Microsoft.Resources/tags module is tested by the CI environment, it will delete the entire tags object, which in most cases, is not desirable.
This change gets all the previous tags from Azure and after deletion adds them back without the test tags.

Behaviour:

.\Invoke-ResourceRemoval -Type 'Microsoft.Resources/tags' -ResourceId '/subscriptions/6cc9c28f-2452-4c50-832d-187cad67447b/providers/Microsoft.Resources/tags'

Pipeline references

For module/pipeline changes, please create and attach the status badge of your successful run.

Pipeline

Type of Change

Please delete options that are not relevant.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (readme)
  • I did format my code

Noah Taheij (ntaheij) requested a review from a team as a code owner May 26, 2023 11:41

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

$currentTags = $(Get-AzTag -ResourceId /subscriptions/$subscriptionId).Properties

# Get the tags to remove
$tagsToRemove = @('Test', 'TestToo')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Tags provided by deployment validation tests are just for testing purposes and shouldn't be hardcoded in the CI environment utilities.

If the entire tags object gets deleted even if onlyUpdate is set to true, then I agree that an issue should be opened to address it. Noah Taheij (@ntaheij) could you please open a bug in the board explaining the actual and indended behavior?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the response. Currently, yes, onlyUpdate does delete all tags. Issue is that, when deploying the tests for the module, currently all tags are being deleted, which means tags for i.e. billing are not available. I will open a bug.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If there is any way to only delete the tags that are created, I'd be interested to use that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks Noah Taheij (@ntaheij)! I'm going to put the PR in draft for the moment and reference the PR in the issue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Note, I replied in the issue :)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[cat] pipelines category: pipelines [cat] testing category: testing enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL