jenkinsci / jenkinsci/git-plugin

[JENKINS-69875] Feature: abort job while performing scm checkout cause retry instead of aborting it

Open
#3,759 1 comment 0 reactions 0 assignees View on GitHub
component:git-client-plugin component:git-plugin component:scm-api-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

If you increase  SCM checkout retry, and you abort a job while it performing scm checkout, it will not detect that the job has been aborted and it will retry the job instead of aborting it. see log:

Started by user BLABLA

Obtained Jenkinsfile from c123456789101112131415
[Pipeline] Start of Pipeline
[Pipeline] library
Loading library pipeline-library@​master
Attempting to resolve my-branch from remote references...
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
using GIT_ASKPASS to set credentials 
 > git ls-remote -h -- https://bitbucket.org/account_name/repo_name.git # timeout=10
Found match: refs/heads/my-branch revision 164e4f446c6fb83a07a71f6f657c3ec1b5c35779
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential my-token
Wiping out workspace first.
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://bitbucket.org/account_name/repo_name.git
 > git init /var/jenkins_home/workspace/_repos_my-repo_master@​libs/c123456789101112131415 # timeout=10
Fetching upstream changes from https://bitbucket.org/account_name/repo_name.git
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
using GIT_ASKPASS to set credentials 
 > git fetch --no-tags --force --progress -- https://bitbucket.org/account_name/repo_name.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Aborted by BLABLA
ERROR: Checkout failed
java.lang.NullPointerException
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2702)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2111)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:852)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1229)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1312)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.lambda$doRetrieve$1(SCMSourceRetriever.java:201)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrySCMOperation(SCMSourceRetriever.java:148)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.doRetrieve(SCMSourceRetriever.java:200)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:137)
    at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:260)
    at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:229)
    at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:157)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    at hudson.security.ACL.impersonate2(ACL.java:451)
    at hudson.security.ACL.impersonate(ACL.java:463)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Retrying after 10 seconds
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential my-token
Wiping out workspace first.
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://bitbucket.org/account_name/repo_name.git

 

 

 

How to reproduce

Create new jenkins pipeline that has scm checkout step (enabled by default) & has shared libs in it

Go to Configure System --> and increase SCM checkout retry count to 2

Then, try to abort the job while it performing scm checkout

 

Note: I wasn't sure if this is related to the git plugin or to pipeline scm step plugin, sorry if I got it wrong

---
Originally reported by dordor, imported from: Feature: abort job while performing scm checkout cause retry instead of aborting it


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

Raw content of original issue

If you increase  SCM checkout retry, and you abort a job while it performing scm checkout, it will not detect that the job has been aborted and it will retry the job instead of aborting it. see log:



Started by user BLABLA

Obtained Jenkinsfile from c123456789101112131415
[Pipeline] Start of Pipeline
[Pipeline] library
Loading library pipeline-library@master
Attempting to resolve my-branch from remote references...
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
using GIT_ASKPASS to set credentials 
 > git ls-remote -h -- https://bitbucket.org/account_name/repo_name.git # timeout=10
Found match: refs/heads/my-branch revision 164e4f446c6fb83a07a71f6f657c3ec1b5c35779
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential my-token
Wiping out workspace first.
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://bitbucket.org/account_name/repo_name.git
 > git init /var/jenkins_home/workspace/_repos_my-repo_master@libs/c123456789101112131415 # timeout=10
Fetching upstream changes from https://bitbucket.org/account_name/repo_name.git
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
using GIT_ASKPASS to set credentials 
 > git fetch --no-tags --force --progress -- https://bitbucket.org/account_name/repo_name.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Aborted by BLABLA
ERROR: Checkout failed
java.lang.NullPointerException
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2702)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2111)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:852)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1229)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1312)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.lambda$doRetrieve$1(SCMSourceRetriever.java:201)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrySCMOperation(SCMSourceRetriever.java:148)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.doRetrieve(SCMSourceRetriever.java:200)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:137)
    at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:260)
    at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:229)
    at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:157)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    at hudson.security.ACL.impersonate2(ACL.java:451)
    at hudson.security.ACL.impersonate(ACL.java:463)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Retrying after 10 seconds
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential my-token
Wiping out workspace first.
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://bitbucket.org/account_name/repo_name.git


 

 

 

How to reproduce

Create new jenkins pipeline that has scm checkout step (enabled by default) & has shared libs in it

Go to Configure System --> and increase SCM checkout retry count to 2

Then, try to abort the job while it performing scm checkout

 

Note: I wasn't sure if this is related to the git plugin or to pipeline scm step plugin, sorry if I got it wrong

environment

```
Jenkins 2.361.2

Git client plugin 3.12.1

Git plugin 4.12.1

Pipeline: SCM Step 400.v6b_89a_1317c9a_

SCM API Plugin 621.vda_a_b_055e58f7
```

1 attachment

- [image-2022-10-17-13-56-56-055.png](https://issues.jenkins.io/secure/attachment/59280/image-2022-10-17-13-56-56-055.png)
> ![image-2022-10-17-13-56-56-055.png](https://issues.jenkins.io/secure/attachment/59280/image-2022-10-17-13-56-56-055.png)

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.