-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat: fixes and tests for autoreplace support for replacements #17467
feat: fixes and tests for autoreplace support for replacements #17467
Conversation
I tested this after merging with develop. Currently without merging the tests are working when started separately, but all at once run out of memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please start a fresh PR and target main instead.
Don't do refactorings in this feature PR. extract required refactorings to a seperate PR, which should merged before this feature.
it('handles already replaced', async () => { | ||
const dockerfile = 'FROM library/ubuntu:20.04'; | ||
upgrade.manager = 'dockerfile'; | ||
upgrade.updateType = 'replacement'; | ||
upgrade.depName = 'library/alpine'; | ||
upgrade.newName = 'library/ubuntu'; | ||
upgrade.packageFile = 'Dockerfile'; | ||
const res = await doReplacementAutoReplace( | ||
upgrade, | ||
dockerfile, | ||
reuseExistingBranch | ||
); | ||
expect(res).toBe(dockerfile); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this case is removed?
expect(res).toBe(hcl.replace(upgrade.depName, upgrade.newName)); | ||
}); | ||
|
||
it('fails with old name in depname', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this no longer fail?
upgrade = { | ||
...JSON.parse(JSON.stringify(defaultConfig)), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upgrade = { | |
...JSON.parse(JSON.stringify(defaultConfig)), | |
}; | |
upgrade = getConfig(); |
getConfig
will always return a fresh config
you should start fresh from main, then the memory issue should be gone |
Ok so just that I understand you correctly, you just want me to create a new PR with this changes to main? Just because I started from @JamieMagee 's PR and refactored/fixed his work, and I did not want to just create one and make it seem like I did this all on my own. |
no problem @JamieMagee is very busy, so i 'm pretty sure he's happy when somebody finish his work. |
@t-kulmburg thanks for opening this. It looks like you opened #17476 targeting |
As we are also interested in the replace feature, I had a look at the proposed code changes.
To make my changes more clear, I am creating this PR against @JamieMagee's PR
I hope this is also alright with you @JamieMagee.
After fixing building errors I added the name-replacement into the doAutoReplace function as they share most of their logic.
If you have any good ideas for better structure, I can refactor the code further.
I also crated a gitlab demo-repo containing a dependency for all managers listed in the PR of @JamieMagee.
As can be seen in the repo README and the Renovate created merge requests, more then half of them are already working with my rather minimal changes.
I also added a brief description of the problems the other managers currently have.
To test the feature even further I added unit tests for Managers that worked in the demo-repo.
My question now would be how you would like to proceed with this topic in general.
Getting the feature to work for all supported managers will probably require a lot more work,
but supporting only the currently working ones will require a detailed documentation on the current status.
I am willing to spend some more time on this in the next days/weeks, so reviews would be appreciated.