-
Notifications
You must be signed in to change notification settings - Fork 387
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
Tolerate default commit signing with SSH in tests #1124
Tolerate default commit signing with SSH in tests #1124
Conversation
8f792ad
to
b964feb
Compare
If the current git setup has SSH based code signing enabled (gpg.format=ssh)[1] then the tests fail (even though not signing) as jgit fails to parse the config with an error like: ``` java.lang.IllegalArgumentException: Invalid value: gpg.format=ssh at org.eclipse.jgit.lib.DefaultTypedConfigGetter.getEnum(DefaultTypedConfigGetter.java:103) at org.eclipse.jgit.lib.Config.getEnum(Config.java:454) at org.eclipse.jgit.lib.GpgConfig.<init>(GpgConfig.java:86) at org.eclipse.jgit.api.CommitCommand.processOptions(CommitCommand.java:662) at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:189) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.commit(JGitAPIImpl.java:487) at org.jenkinsci.plugins.gitclient.GitClientMaintenanceTest.commitFile(GitClientMaintenanceTest.java:230) at org.jenkinsci.plugins.gitclient.GitClientMaintenanceTest.commitOneFile(GitClientMaintenanceTest.java:224) at org.jenkinsci.plugins.gitclient.GitClientMaintenanceTest.commitSeveralFiles(GitClientMaintenanceTest.java:218) at org.jenkinsci.plugins.gitclient.GitClientMaintenanceTest.test_gc_maintenance(GitClientMaintenanceTest.java:333) at java.base/java.lang.reflect.Method.invoke(Method.java:566) ``` [1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgformat
b964feb
to
f7e2c3c
Compare
Only write local git config if in local repo Update source formatting Wrap the comment
@jtnord I pushed changes that allow the pull request to pass tests in my environments (Linux, Windows, FreeBSD, etc.) and should pass tests on ci.jenkins.io. Could you test the most recent changes on your Windows environment? |
The `--local` argument will cause command line git to fail if the command is not performed inside a valid repository. That is a good thing because the tests should avoid changing global configuration where ever possible.
@jtnord I'm out of office for the next week but may have time for further reviews and changes. I see a pattern of repeating code in those tests that I would like to fix, if you're OK with me using this draft pull request to improve the tests. I would need you to tell me if the tests that I've modified still pass on your Windows computer. |
@MarkEWaite all[1] tests pass, however something is still missing the after running tests my clone has the following new config options ->
Which is unrelated to the tolleration of [1] with the exception of |
Thanks. I've previously accepted persistent changes in the configuration of the working repository to support tests, but this may be the ideal time to fix that poor behavior. |
Move workspace initialization into WorkspaceWithRepo
@MarkEWaite pklease |
@jtnord I've fixed the duplications that I had created in the tests. I've run the tests successfully on my Linux machine from a user configuration that has GPG signing enabled globally and I've run them successfully on my Linux and Windows machines where GPG signing is not enabled. Could you check them as well? @olamy I don't want to disrupt your work on the switch from trilead to Apache Mina. Once this has been reviewed and verified by @jtnord, I'm happy to wait until your work on the switch from trilead to Apache Mina is complete If you find that these changes won't disrupt your work on the switch from trilead to Apache Mina, they can be merged as soon as they are confirmed to pass tests in all the desired configurations. Thanks again to both of you! |
@MarkEWaite no worries at all. the changes in this PR are different from my current work from now |
tests all pass locally with the exception of the known However it is still modifying my local config.
|
Thanks. I saw that in my local development but didn't fix it in this pull request. Will fix it in a future pull request. |
yup confirmed as well. |
Tolerate default commit signing with SSH in tests
work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=581483
If the current git setup has SSH based code signing enabled (gpg.format=ssh)[1] then the tests fail (even though not signing) as jgit fails to parse the config with an error like:
[1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgformat
This has only been tested on my local windows development environment. before this change, tests failed as above.
After this change the only failing test is
which is a lie, but somewhat expected as this installation of the official git client did not install ssh or any mysys tools.
Checklist
Types of changes
What types of changes does your code introduce?