fix: Ensure exemption list of ecosystem is not overwritten#216
fix: Ensure exemption list of ecosystem is not overwritten#216jmeridth merged 6 commits intogithub:mainfrom
Conversation
|
@hkadakia thank you for catching this. Would you be willing to add a test? I see your manual testing. Thank you for that. Gave great context. |
Sure. I'll work on it as soon as I can. |
|
@jmeridth Added the unit test. In order to ensure we correctly test/exercise the code, moved the copy from the calling function to within the function. Please let me know if any more changes. |
|
@hkadakia some linting errors. once fixed I'm good with merging this. Thank you very much for the contribution including tests. |
|
Wow! Big learning opportunity for me here. Thanks for finding and fixing this. I'm adding "overwriting env data when passing and returning to functions" to my personal code review checklist as I think this is something I could easily do again if I'm not careful about it. |
Pull Request
Proposed Changes
Currently we pass in the env variable directly when building a dependabot config file. When iterating through multiple repos, there is a possibility that if one of the previous repos has an existing dependabot config, we land up adding those to the exemption list in order to not add that config again to the dependabot.yml file. We land up using the same exempt_ecosystem for all the foll. repos resulting in skipping of creating that dependabot.yml.
This fix always passes in a copy of the original
exempt_ecosystemsenvironment variable ensuring the original data is not over written.In the example above, the first repo
hello-gh-actionsalready has a dependabot.yml file with gomod, docker & github-actions package manager. Thetestrepo on the other hand does not have anydependabot.ymlfile and the expectation is for evergreen to create a pull request but as you see from the example it assumes the same ecosystems are added to the exempt list and skips adding the pull request.Below is my evergreen.yml config:
Readiness Checklist
Author/Contributor
make lintand fix any issues that you have introducedmake testand ensure you have test coverage for the lines you are introducing@jeffrey-luszczReviewer
fix,documentation,enhancement,infrastructure,maintenanceorbreaking