Ecr fetcher to collect repositories by region#293
Conversation
|
This pull request is now in conflicts. Could you fix it? 🙏 |
|
This pull request does not have a backport label. Could you fix it @ofiriro3? 🙏
|
# Conflicts: # resources/fetchers/ecr_fetcher.go # resources/fetchers/ecr_fetcher_test.go
| "^my-account\\.dkr\\.ecr\\.([-\\w]+)\\.amazonaws\\.com\\/([-\\w\\.\\/]+)[:,@]?", | ||
| "public\\.ecr\\.aws\\/\\w+\\/([-\\w\\.\\/]+)\\:?", |
There was a problem hiding this comment.
can you please add some documentation about this regex, what are we expecting it to parse, and an example string or something?
| PrivateRepoRegexTemplate = "^%s\\.dkr\\.ecr\\.([-\\w]+)\\.amazonaws\\.com\\/([-\\w\\.\\/]+)[:,@]?" | ||
| PublicRepoRegex = "public\\.ecr\\.aws\\/\\w+\\/([-\\w\\.\\/]+)\\:?" |
There was a problem hiding this comment.
can you please add some documentation about this regex, what are we expecting it to parse, and an example string or something?
| describedRepo, err := describer.Provider.DescribeRepositories(ctx, f.awsConfig, repositories, region) | ||
| if err != nil { | ||
| f.log.Errorf("could not retrieve pod's aws repositories for region %s: %w", region, err) | ||
| } | ||
| awsRepositories = append(awsRepositories, describedRepo.Repositories...) |
There was a problem hiding this comment.
if there's an error it will still add the decribedRepo into awsRepositories. Is this by design?
| } | ||
|
|
||
| f.log.Debugf("sending pods to ecrProviders: %v", repositories) | ||
| return "" |
There was a problem hiding this comment.
error instead? we will get no indication if something went wrong here
There was a problem hiding this comment.
I looked at other text manipulation examples (for example regex.FindString) and I saw that when there is no match, the method should return an empty string "".
But this case is a bit different, so I am not sure.
Whatever you think - I am ok with both options
Co-authored-by: Oren Zohar <85433724+oren-zohar@users.noreply.github.com>
oren-zohar
left a comment
There was a problem hiding this comment.
the coverage report shows a decrease in coverage for the ecr files, can you give it a look?
| // public.ecr.aws/<aws-alias>/<repository> | ||
| PublicRepoRegex = "public\\.ecr\\.aws\\/\\w+\\/([-\\w\\.\\/]+)\\:?" |
There was a problem hiding this comment.
if this is the expected format, using regex to extract the repo seems like overkill, right?
There was a problem hiding this comment.
I am using the regex for two things:
- Validating the format of the image so I can be sure it's an ECR image.
- Extract the repository name out of the format.
Do you have another suggestion?
I looked at the coverage report, it seems to me that the coverage in the provider was decreased. The provider code is a wrapper for AWS original provider, and it will be a bit complex (if possible at all) to test it. |
Cloudbeat CI 🤖Allure Report: http://csp-allure-reports.s3.amazonaws.com/allure_reports/cloudbeat/prs/293/index.html |

Uh oh!
There was an error while loading. Please reload this page.