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

Improve heuristic for detection of ARM Resource References #3832

Merged
merged 8 commits into from
Mar 1, 2024

Conversation

theunrepentantgeek
Copy link
Member

What this PR does / why we need it:

As detailed in #3772 we have a few properties that are ARM Resource References, but had slipped through both our heuristic and our manual checks.

This PR improves our heuristic to try and prevent future issues.

Closes #3772

How does this PR make you feel:
gif

@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.39%. Comparing base (d9d55f8) to head (ecb29c2).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3832      +/-   ##
==========================================
- Coverage   53.40%   53.39%   -0.02%     
==========================================
  Files        1510     1510              
  Lines      545857   545863       +6     
==========================================
- Hits       291532   291471      -61     
- Misses     209396   209461      +65     
- Partials    44929    44931       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"github.com/go-logr/logr"
"github.com/pkg/errors"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"regexp"
Copy link
Member

Choose a reason for hiding this comment

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

minor: stdlib, goes at the top

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@@ -20,7 +20,7 @@ import (
// TransformCrossResourceReferencesStageID is the unique identifier for this pipeline stage
const TransformCrossResourceReferencesStageID = "transformCrossResourceReferences"

var armIDDescriptionRegex = regexp.MustCompile("(?i)(.*/subscriptions/.*?/resourceGroups/.*|ARM ID|Resource ID|resourceId)")
Copy link
Member

Choose a reason for hiding this comment

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

minor: Consider either colocating this regex in the pipeline stage, or putting the new regex you added in the pipeline stage here?

It feels like the armIDDescriptionRegex and the armIDNameRegex should be together.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved.

@theunrepentantgeek theunrepentantgeek added this pull request to the merge queue Feb 29, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 1, 2024
@theunrepentantgeek theunrepentantgeek added this pull request to the merge queue Mar 1, 2024
Merged via the queue into main with commit 297e096 Mar 1, 2024
8 checks passed
@theunrepentantgeek theunrepentantgeek deleted the improve/resource-id-heuristic branch March 1, 2024 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Bug: MySQL Flexible Server property sourceServerResourceId has wrong type
3 participants