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

fix: Improved resiliency of removal logic #3006

Merged
merged 8 commits into from
Aug 12, 2024

Conversation

AlexanderSehr
Copy link
Contributor

@AlexanderSehr AlexanderSehr commented Aug 8, 2024

Description

  • Updated removal order as image templates must be removed before e.g., permissions are revoked
  • Updated 'alreadyProcessed' logic to not accidently exclude resources that contain a name as a substring, aber are an actual sub-resource
  • Updated logic to fetch deployment operations as the previous logic did also include 'existing' resources in specific situations. It's now using REST and filters those out (i.e., 'read' Operations)
  • Enabled the removal logic to deal with cases where no resources are deployed (e.g., later utl modules)
  • The logic now differentiates in between 'I can not find a deployment' and 'I can find a deployment, but it has no resources linked' (before it was only the former)
  • Finally, the logic was slightly altered to not give up as soon as no deployment is found, but instead try and find as many as possible and only throw an exception after the removal logic ran end to end.

Pipeline Reference

Pipeline
avm.ptn.aca-lza.hosting-environment
avm.ptn.ai-platform.baseline
avm.ptn.authorization.policy-assignment
avm.ptn.authorization.resource-role-assignment
avm.ptn.authorization.role-assignment
avm.ptn.deployment-script.import-image-to-acr
avm.ptn.finops-toolkit.finops-hub
avm.ptn.lz.sub-vending
avm.ptn.network.private-link-private-dns-zones
avm.ptn.policy-insights.remediation
avm.ptn.security.security-center
avm.res.aad.domain-service
avm.res.alerts-management.action-rule
avm.res.analysis-services.server
avm.res.api-management.service
avm.res.app-configuration.configuration-store
avm.res.app.container-app
avm.res.app.job
avm.res.app.managed-environment
avm.res.automation.automation-account
avm.res.batch.batch-account
avm.res.cache.redis
avm.res.cdn.profile
avm.res.cognitive-services.account
avm.res.communication.communication-service
avm.res.communication.email-service
avm.res.compute.availability-set
avm.res.compute.disk-encryption-set
avm.res.compute.disk
avm.res.compute.gallery
avm.res.compute.image
avm.res.compute.proximity-placement-group
avm.res.compute.ssh-public-key
avm.res.compute.virtual-machine-scale-set
avm.res.compute.virtual-machine
avm.res.consumption.budget
avm.res.container-instance.container-group (unrelated)
avm.res.container-registry.registry
avm.res.container-service.managed-cluster
avm.res.data-factory.factory
avm.res.data-protection.backup-vault
avm.res.databricks.access-connector
avm.res.databricks.workspace
avm.res.db-for-my-sql.flexible-server
avm.res.db-for-postgre-sql.flexible-server
avm.res.desktop-virtualization.application-group
avm.res.desktop-virtualization.host-pool
avm.res.desktop-virtualization.scaling-plan
avm.res.desktop-virtualization.workspace
avm.res.dev-test-lab.lab
avm.res.digital-twins.digital-twins-instance (unrelated)
avm.res.document-db.database-account
avm.res.event-grid.domain
avm.res.event-grid.namespace
avm.res.event-grid.system-topic
avm.res.event-grid.topic
avm.res.event-hub.namespace
avm.res.health-bot.health-bot
avm.res.healthcare-apis.workspace
avm.res.hybrid-compute.machine
avm.res.insights.action-group
avm.res.insights.activity-log-alert
avm.res.insights.component
avm.res.insights.data-collection-endpoint
avm.res.insights.data-collection-rule
avm.res.insights.diagnostic-setting
avm.res.insights.metric-alert
avm.res.insights.private-link-scope
avm.res.insights.scheduled-query-rule
avm.res.insights.webtest
avm.res.key-vault.vault
avm.res.kubernetes-configuration.extension
avm.res.kubernetes-configuration.flux-configuration
avm.res.kusto.cluster
avm.res.load-test-service.load-test
avm.res.logic.workflow
avm.res.machine-learning-services.workspace
avm.res.maintenance.maintenance-configuration
avm.res.managed-identity.user-assigned-identity
avm.res.managed-services.registration-definition
avm.res.management.management-group
avm.res.net-app.net-app-account
avm.res.network.application-gateway-web-application-firewall-policy
avm.res.network.application-gateway
avm.res.network.application-security-group
avm.res.network.azure-firewall
avm.res.network.bastion-host
avm.res.network.connection
avm.res.network.ddos-protection-plan
avm.res.network.dns-forwarding-ruleset
avm.res.network.dns-resolver
avm.res.network.dns-zone
avm.res.network.express-route-circuit
avm.res.network.express-route-gateway
avm.res.network.firewall-policy
avm.res.network.front-door-web-application-firewall-policy
avm.res.network.front-door
avm.res.network.ip-group
avm.res.network.load-balancer
avm.res.network.local-network-gateway
avm.res.network.nat-gateway
avm.res.network.network-interface
avm.res.network.network-manager
avm.res.network.network-security-group
avm.res.network.network-watcher
avm.res.network.private-dns-zone
avm.res.network.private-endpoint
avm.res.network.private-link-service
avm.res.network.public-ip-address
avm.res.network.public-ip-prefix
avm.res.network.route-table
avm.res.network.service-endpoint-policy
avm.res.network.trafficmanagerprofile
avm.res.network.virtual-hub
avm.res.network.virtual-network-gateway
avm.res.network.virtual-network
avm.res.network.virtual-wan
avm.res.network.vpn-gateway
avm.res.network.vpn-site
avm.res.operational-insights.workspace
avm.res.operations-management.solution
avm.res.portal.dashboard
avm.res.power-bi-dedicated.capacity (unrelated)
avm.res.purview.account
avm.res.recovery-services.vault
avm.res.relay.namespace
avm.res.resource-graph.query
avm.res.resources.deployment-script
avm.res.resources.resource-group
avm.res.search.search-service
avm.res.service-bus.namespace
avm.res.service-fabric.cluster
avm.res.signal-r-service.signal-r
avm.res.signal-r-service.web-pub-sub
avm.res.sql.instance-pool
avm.res.sql.managed-instance
avm.res.sql.server
avm.res.storage.storage-account
avm.res.synapse.private-link-hub
avm.res.synapse.workspace
avm.res.virtual-machine-images.image-template
avm.res.web.connection
avm.res.web.hosting-environment (unrelated)
avm.res.web.serverfarm
avm.res.web.site
avm.res.web.static-site

Type of Change

  • Update to CI Environment or utilities (Non-module affecting changes)
  • Azure Verified Module updates:
    • Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in version.json:
      • Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description.
      • The bug was found by the module author, and no one has opened an issue to report it yet.
    • Feature update backwards compatible feature updates, and I have bumped the MINOR version in version.json.
    • Breaking changes and I have bumped the MAJOR version in version.json.
    • Update to documentation

@AlexanderSehr AlexanderSehr self-assigned this Aug 8, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 Maintainers need to triage still label Aug 8, 2024
@AlexanderSehr AlexanderSehr added Needs: Core Team 🧞 This item needs the AVM Core Team to review it Type: CI 🚀 This issue is related to the AVM CI and removed Needs: Triage 🔍 Maintainers need to triage still labels Aug 8, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue label Aug 8, 2024
@AlexanderSehr AlexanderSehr marked this pull request as ready for review August 8, 2024 15:27
@AlexanderSehr AlexanderSehr requested a review from a team as a code owner August 8, 2024 15:27
@AlexanderSehr AlexanderSehr enabled auto-merge (squash) August 8, 2024 15:27
@AlexanderSehr AlexanderSehr disabled auto-merge August 8, 2024 15:27
@AlexanderSehr AlexanderSehr marked this pull request as draft August 8, 2024 15:44
@AlexanderSehr AlexanderSehr marked this pull request as ready for review August 8, 2024 20:53
segraef
segraef previously approved these changes Aug 8, 2024
Copy link
Contributor

@segraef segraef left a comment

Choose a reason for hiding this comment

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

good work mate

@AlexanderSehr AlexanderSehr marked this pull request as draft August 9, 2024 06:27
@AlexanderSehr AlexanderSehr marked this pull request as ready for review August 9, 2024 06:51
@jtracey93 jtracey93 merged commit 72b4d0c into main Aug 12, 2024
4 checks passed
@jtracey93 jtracey93 deleted the users/alsehr/removalResiliency branch August 12, 2024 15:18
AlexanderSehr added a commit that referenced this pull request Sep 13, 2024
…/azure-image-builder` (#3005)

## Description

This PR introduces the Azure Image Builder pattern to AVM

Depends on
- #3006 
- #3007 
- #2992 
- #2756

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.ptn.virtual-machine-images.azure-image-builder](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.ptn.virtual-machine-images.azure-image-builder.yml/badge.svg?branch=users%2Falsehr%2FaibPattern)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.ptn.virtual-machine-images.azure-image-builder.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation

---------

Co-authored-by: Maher Aldineh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Core Team 🧞 This item needs the AVM Core Team to review it Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Type: CI 🚀 This issue is related to the AVM CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants