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

[JENKINS-70021] fix tests when gpg signing is enabled #1353

Merged

Conversation

olamy
Copy link
Member

@olamy olamy commented Nov 6, 2022

JENKINS-70021 - fix tests when gpg signing is enabled

if git global config gpg-sign activated e.g git config --global commit.gpgsign true.

unit test of git-plugin fail

cli

Caused by: hudson.plugins.git.GitException: Command "git commit -F /Volumes/workspace/dev/sources/jenkins/git-plugin/target/tmp/junit11293633318696642182/junit5698144647230035770@tmp/jenkins-gitclient-gitcommit4252944134817268881.txt" returned status code 128:stdout: stderr: error: gpg failed to sign the datafatal: failed to write commit object
{{ at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)}}{{ at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2601)}}

jgit

{}Caused by: org.eclipse.jgit.api.errors.ServiceUnavailableException: Signing service is not available{{ at org.eclipse.jgit.api.CommitCommand.sign(CommitCommand.java:290)}}{{ at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:247)}}

same when using GitSampleRepoRule

{}Initialized empty Git repository in /Volumes/workspace/dev/sources/jenkins/cloudbees-analytics-plugin/plugin/target/tmp/junit3925781698945114105/junit839357165607123398/.git/[junit839357165607123398] $ git add file[junit839357165607123398] $ git config user.name "Git SampleRepoRule"[junit839357165607123398] $ git config user.email gits@mplereporule[junit839357165607123398] $ git commit --message=initerror: gpg failed to sign the datafatal: failed to write commit object   1.341 [id=802] INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Stopping Jenkins   1.511 [id=802] INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Jenkins stopped

there are different options to use:

cli env var GIT_CONFIG_NOSYSTEM
jgit SystemReader.getInstance().getUserConfig().clear();

to reproduce the failures before those changes.
Just activate gpgsigning

git config --global commit.gpgsign true

Checklist

  • I have read the CONTRIBUTING doc
  • I have referenced the Jira issue related to my changes in one or more commit messages
  • I have added tests that verify my changes
  • Unit tests pass locally with my changes
  • I have added documentation as necessary
  • No Javadoc warnings were introduced with my changes
  • No spotbugs warnings were introduced with my changes
  • Documentation in README has been updated as necessary
  • Online help has been added and reviewed for any new or modified fields
  • I have interactively tested my changes
  • Any dependent changes have been merged and published in upstream modules (like git-client-plugin)

Types of changes

  • Dependency or infrastructure update

…re failing and projects using GitSampleRepoRule have non expected failures
@olamy olamy added the bugfix Fixes a bug - used by Release Drafter label Nov 6, 2022
@github-actions github-actions bot added the test label Nov 6, 2022
@olamy olamy requested a review from MarkEWaite November 6, 2022 22:16
EnvVars envVars = new EnvVars();


EnvVars envVars = GitUtilsTest.getConfigNoSystemEnvsVars();
Copy link
Member Author

Choose a reason for hiding this comment

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

well the code here use tabs whereas I'm using spaces :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I adjusted it to reduce white space diffs as mentioned in the contributing guide. Thanks very much for the fixes!

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks.
fair enough. but it's not really convenient to have files using tabs and files using spaces within the same project.
Intellij doesn't have a per file configuration feature :)

@github-actions github-actions bot added the dependencies Dependency related change label Nov 7, 2022
@MarkEWaite MarkEWaite changed the title [JENKINS-70021] if gpg signing is activated (global or local) tests are failing and projects using GitSampleRepoRule have non expected failures [JENKINS-70021] fix tests when gpg signing is activated Nov 7, 2022
@MarkEWaite MarkEWaite removed bugfix Fixes a bug - used by Release Drafter dependencies Dependency related change labels Nov 7, 2022
@MarkEWaite MarkEWaite changed the title [JENKINS-70021] fix tests when gpg signing is activated [JENKINS-70021] fix tests when gpg signing is enabled Nov 7, 2022
@MarkEWaite MarkEWaite merged commit 5662df3 into master Nov 7, 2022
@MarkEWaite MarkEWaite deleted the JENKINS-70021-fix-fail-with-gpgsignin-global-activated branch November 7, 2022 03:19
@olamy
Copy link
Member Author

olamy commented Nov 15, 2022

any chance to release it soon? thanks

@MarkEWaite
Copy link
Contributor

any chance to release it soon? thanks

Likely before the end of this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants