jenkinsci / jenkinsci/git-plugin

[JENKINS-18876] Provide a retry option when GitPublisher fails to push a tag

Open
#2,302 0 comments 0 reactions 0 assignees View on GitHub
component:git-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

We periodically get Jenkins test failures, because GitPublisher is not able to push the passing build's tag to github.

From time to time when github rejects the connection and causes the push to fail. A subsequent rebuild tends to go through.

It might be nice to have an option to allow for retrying a push after some amount of delay.

Here is an example of a failed push.



Pushing tag ci_157 to repo origin

ERROR: Failed to push tag ci_157 to origin

hudson.plugins.git.GitException: Command "git push origin ci_157" returned status code 128:

stdout:

stderr: ssh_exchange_identification: Connection closed by remote host

fatal: The remote end hung up unexpectedly

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:772)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:738)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.push(CliGitAPIImpl.java:790)

at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:303)

at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:265)

at hudson.FilePath.act(FilePath.java:865)

at hudson.FilePath.act(FilePath.java:838)

at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:265)

at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)

at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)

at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786)

at hudson.model.Build$BuildExecution.post2(Build.java:183)

at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733)

at hudson.model.Run.execute(Run.java:1593)

at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)

at hudson.model.ResourceController.execute(ResourceController.java:88)

at hudson.model.Executor.run(Executor.java:237)

Build step 'Git Publisher' changed build result to FAILURE

Build step 'Git Publisher' marked build as failure

A manual run a few minutes after this failure passes (on the same jenkins server)



Pushing tag ci_158 to repo origin

Email was triggered for: Success

---
Originally reported by zev, imported from: Provide a retry option when GitPublisher fails to push a tag


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • label(s): GitSCMExtension, git-publisher
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02

Raw content of original issue

We periodically get Jenkins test failures, because GitPublisher is not able to push the passing build's tag to github.
From time to time when github rejects the connection and causes the push to fail. A subsequent rebuild tends to go through.
It might be nice to have an option to allow for retrying a push after some amount of delay.

Here is an example of a failed push.
<pre>
Pushing tag ci_157 to repo origin
ERROR: Failed to push tag ci_157 to origin
hudson.plugins.git.GitException: Command "git push origin ci_157" returned status code 128:
stdout:
stderr: ssh_exchange_identification: Connection closed by remote host
fatal: The remote end hung up unexpectedly

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:772)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:738)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.push(CliGitAPIImpl.java:790)
at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:303)
at hudson.plugins.git.GitPublisher$3.invoke(GitPublisher.java:265)
at hudson.FilePath.act(FilePath.java:865)
at hudson.FilePath.act(FilePath.java:838)
at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:265)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733)
at hudson.model.Run.execute(Run.java:1593)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:237)
Build step 'Git Publisher' changed build result to FAILURE
Build step 'Git Publisher' marked build as failure
</pre>

A manual run a few minutes after this failure passes (on the same jenkins server)
<pre>
Pushing tag ci_158 to repo origin
Email was triggered for: Success
</pre>

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.