Skip to content

[Pipelines] Added scheduled pipelines for Subcription & Management-Group Deployment removals - #2305

Closed
Alexander Sehr (AlexanderSehr) wants to merge 31 commits into
Azure:mainfrom
alsehr:main
Closed

Alexander Sehr (AlexanderSehr) wants to merge 31 commits into
Azure:mainfrom
alsehr:main

Conversation

@AlexanderSehr

@AlexanderSehr Alexander Sehr (AlexanderSehr) commented Nov 9, 2022 •

Copy link
Copy Markdown
Contributor

Description

  • Added scheduled pipelines for Subcription & Management-Group Deployment removals
    • Excludes any deployment that is running/failed unless they're older than 14 days (new setting in settings.yml)
  • Updated docs
  • Implemented for both Azure DevOps & GitHub
  • Updated 'get pipeline inputs' composite actions to be 'generic' and updated all pipelines using it

Pipeline references

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

Pipeline
AnalysisServices: Servers
Build Status
.Platform: Remove Deployments

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

@AlexanderSehr Alexander Sehr (AlexanderSehr) added enhancement New feature or request [cat] pipelines category: pipelines [cat] github category: GitHub [cat] azure devops category: Azure DevOps [cat] utilities category: utilities labels Nov 9, 2022
@AlexanderSehr Alexander Sehr (AlexanderSehr) added the documentation Improvements or additions to documentation label Nov 9, 2022
@AlexanderSehr
Alexander Sehr (AlexanderSehr) marked this pull request as ready for review November 9, 2022 18:22
Comment thread settings.yml Outdated
Comment on lines +36 to +37
# Deployments are only moved if they are not running or failed - AND - if they are not older than the below threshold
daysToKeepDeploymentsFor: 14

@eriqua Erika Gressi (eriqua) Nov 9, 2022 •

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.

This may be misleading for 2 reasons:

  1. It is not clear we're talking about a dedicated pipeline and not about the removal step of the module validation pipeline
  2. The variable name suggests we're keeping all deployments unless older than 14 days. If I understood correctly, it would be
Suggested change
# Deployments are only moved if they are not running or failed - AND - if they are not older than the below threshold
daysToKeepDeploymentsFor: 14
# A scheduled pipeline deletes subscription and (optionally) management group level deployments which are neither in a running nor in a failed state. I addition, failed deployments are also removed if they are older than the below threshold
daysToKeepFailedDeploymentsFor: 14

@AlexanderSehr Alexander Sehr (AlexanderSehr) Nov 9, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes and no. We decided to keep 'running' & 'failed' deployments. There could potentially be more states (e.g. canceled, creating, deleting, failed, succeeded, updating) and the function would allow you to specify them.
I get your point with the ask for a more meaningful name, but would suggest to not include any specifics like that. Maybe we can turn it on its head and use something like maxDeploymentRetentionInDays? What I try to express is, that beyond this point deployments are always deleted. Not 'just' failed ones, but all.

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.

I agree, neither are correct. Your latest suggestion is going in the right direction though. What I'd like to avoid is the wrong message for which we're deleting all deployments as part of the module validation pipeline and only after 14 days, which is what I would think by looking at the current name. To clarify which pipeline the setting is for, what would you think about adding different sections, e.g., general settings (if shared by all), module validation pipeline settings, platform maintenance settings?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess we somewhat have these 'sections' already indicated by prefixes like Publish: xzy for a section header. I guess the fundamental 2 sections are Common & Azure DevOps only and I guess we should keep that. So whatever we do - it would be subsections and at least for me it would be fine to continue using these prefixes in the 'correct' order. Currently for example validation followed by removal and eventuall publish. Creative ideas are welcome :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I now introduced a section 'Platform pipeline settings'. What do you think? Figured 'removal' is probably a bit misleading as it could be mixed up with the module removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[cat] azure devops category: Azure DevOps [cat] github category: GitHub [cat] pipelines category: pipelines [cat] utilities category: utilities documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request]: Automate management group scope deployment clean up

2 participants