[JIRA] (JENKINS-60697) readTrusted does not honor the refspec on Pipeline script from SCM GIT

13 views
Skip to first unread message

weltfahr@gmail.com (JIRA)

unread,
Jan 8, 2020, 10:24:02 AM1/8/20
to jenkinsc...@googlegroups.com
Welt Fahr created an issue
 
Jenkins / Bug JENKINS-60697
readTrusted does not honor the refspec on Pipeline script from SCM GIT
Issue Type: Bug Bug
Assignee: Unassigned
Components: git-plugin
Created: 2020-01-08 15:23
Environment: OS: Alpine Linux 3.8.4 x64
Open JDK 8
Jenkins 2.176.1
Labels: pipeline git
Priority: Major Major
Reporter: Welt Fahr

In a pipeline script from SCM, using a git repository with Refspec, readTrusted is not using the refsspec are fails with error "Couldn't find remote ref".

Example

Pipeline job wftest created and configured as Pipeline script from SCM with the following parameters:

  • SCM: Git
  • Repository URL: g...@git.serv.d.net:ts-source.git
  • Refspec: +refs/heads/:refs/remotes/origin/ +refs/changes/:refs/remotes/origin/
  • Branch Specifier: 4eedb3b
  • Script Path: .jenkins/test.groovy

.jenkins/test.groovy

println readTrusted(".jenkins/test.groovy")

Build log

{{}}

Checking out git g...@git.serv.d.net:ts-source.git into /var/lib/jenkins/jobs/wftest/workspace@script to read .jenkins/test.groovyNo credentials specified > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url g...@git.serv.d.net:ts-source.git # timeout=10Fetching upstream changes from g...@git.serv.d.net:ts-source.git > git --version # timeout=10 > git fetch --tags --progress g...@git.serv.d.net:ts-source.git +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/* > git rev-parse 4eedb3b^{commit} # timeout=10Checking out Revision 4eedb3baaa6d528d22180784e0001d99d618bda9 (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 4eedb3baaa6d528d22180784e0001d99d618bda9Commit message: ".jenkins: make the jobseed job running in sandbox" > git rev-list --no-walk 3c75ef69338675fe751d97af3173c206aef58d94 # timeout=10Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] readTrusted[Pipeline] End of Pipelinehudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" returned status code 128:fatal: Couldn't find remote ref refs/heads/4eedb3bfatal: The remote end hung up unexpectedly     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)     at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:101)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)     at hudson.security.ACL.impersonate(ACL.java:290)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)     at java.lang.Thread.run(Thread.java:748) Finished: FAILURE

 

The expected behavior is that readTrusted results in "git fetch -tags -progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b +refs/config/4eedb3b:refs/remotes/origin/4eedb3b --prune". However 

"git fetch -tags progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b -prune" is used.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

weltfahr@gmail.com (JIRA)

unread,
Jan 8, 2020, 10:32:03 AM1/8/20
to jenkinsc...@googlegroups.com
Welt Fahr updated an issue
Change By: Welt Fahr
In a pipeline script from SCM, using a git repository with Refspec, readTrusted is not using the refsspec are fails with error "Couldn't find remote ref".

h4. Example

Pipeline job
wftest created and configured as Pipeline script from SCM with the following parameters:
* SCM: Git
* Repository URL: 
{{ g...@git.serv.d.net:ts-source.git }}
* Refspec: 
{{ +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/* }}
* Branch Specifier: 4eedb3b
* Script Path: .jenkins/test.groovy

.jenkins/test.groovy
{code:
java groovy }
println readTrusted(".jenkins/test.groovy"){code}

h4. Build log
{
{}}
{
code: java text }
Checking out git g...@git.serv.d.net:ts-source.git into /var/lib/jenkins/jobs/wftest/workspace@script to read .jenkins/test.
groovyNo groovy
No
 credentials specified
 > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository
 > git config remote.origin.url g...@git.serv.d.net:ts-source.git # timeout=10Fetching upstream changes from g...@git.serv.d.net:ts-source.git
 > git --version # timeout=10
 > git fetch --tags --progress g...@git.serv.d.net:ts-source.git +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/*
 > git rev-parse 4eedb3b^{commit} # timeout=10Checking out Revision 4eedb3baaa6d528d22180784e0001d99d618bda9 (detached) > git config core.sparsecheckout # timeout=10
 > git checkout -f 4eedb3baaa6d528d22180784e0001d99d618bda9Commit message: ".jenkins: make the jobseed job running in sandbox"
 > git rev-list --no-walk 3c75ef69338675fe751d97af3173c206aef58d94 # timeout= 10Running 10
Running
 in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] readTrusted
[Pipeline] End of  Pipelinehudson Pipeline
hudson
.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" returned status code 128:
fatal: Couldn't find remote ref refs/heads/ 4eedb3bfatal 4eedb3b
fatal
: The remote end hung up unexpectedly

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)     at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:101)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)     at hudson.security.ACL.impersonate(ACL.java:290)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)     at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
{code}
 
h4. {color:#172b4d} The expected behavior is that readTrusted results in "git fetch --tags --progress origin {color}{color:#172b4d}  +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b {color}{color:#172b4d}  +refs/config/4eedb3b:refs/remotes/origin/4eedb3b --prune". However  {color}
"git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" is used.

weltfahr@gmail.com (JIRA)

unread,
Jan 8, 2020, 10:36:01 AM1/8/20
to jenkinsc...@googlegroups.com
Welt Fahr updated an issue
In a pipeline script from SCM, using a git repository with Refspec, readTrusted is not using the refsspec are fails with error "Couldn't find remote ref".

h4. Example

Pipeline job created and configured as Pipeline script from SCM with the following parameters:

* SCM: Git
* Repository URL: {{g...@git.serv.d.net:ts-source.git}}
* Refspec: {{+refs/heads/ \ *:refs/remotes/origin/ \ * +refs/changes/ \ *:refs/remotes/origin/ \ *}}

* Branch Specifier: 4eedb3b
* Script Path: .jenkins/test.groovy

.jenkins/test.groovy
{code:groovy}
println readTrusted(".jenkins/test.groovy")

{code}

h4. Build log
{code:
text none }

Checking out git g...@git.serv.d.net:ts-source.git into /var/lib/jenkins/jobs/wftest/workspace@script to read .jenkins/test.groovy
No credentials specified
 > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository
 > git config remote.origin.url g...@git.serv.d.net:ts-source.git # timeout=10Fetching upstream changes from g...@git.serv.d.net:ts-source.git
 > git --version # timeout=10
 > git fetch --tags --progress g...@git.serv.d.net:ts-source.git +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/*
 > git rev-parse 4eedb3b^{commit} # timeout=10Checking out Revision 4eedb3baaa6d528d22180784e0001d99d618bda9 (detached) > git config core.sparsecheckout # timeout=10
 > git checkout -f 4eedb3baaa6d528d22180784e0001d99d618bda9Commit message: ".jenkins: make the jobseed job running in sandbox"
 > git rev-list --no-walk 3c75ef69338675fe751d97af3173c206aef58d94 # timeout=10
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] readTrusted
[Pipeline] End of Pipeline
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" returned status code 128:

fatal: Couldn't find remote ref refs/heads/4eedb3b
fatal: The remote end hung up unexpectedly

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)     at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:101)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)     at hudson.security.ACL.impersonate(ACL.java:290)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)     at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
{code}
 
The expected behavior is that readTrusted results in "git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b +refs/config/4eedb3b:refs/remotes/origin/4eedb3b --prune". However

"git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" is used.

weltfahr@gmail.com (JIRA)

unread,
Jan 8, 2020, 10:37:03 AM1/8/20
to jenkinsc...@googlegroups.com
Welt Fahr updated an issue
In a pipeline script from SCM, using a git repository with Refspec, readTrusted is not using the refsspec are fails with error "Couldn't find remote ref".

h4. Example

Pipeline job created and configured as Pipeline script from SCM with the following parameters:
* SCM: Git
* Repository URL: {{g...@git.serv.d.net:ts-source.git}}
* Refspec: {{+refs/heads/\*:refs/remotes/origin/\* +refs/changes/\*:refs/remotes/origin/\*}}
* Branch Specifier: 4eedb3b
* Script Path: .jenkins/test.groovy

.jenkins/test.groovy
{code:groovy}
println readTrusted(".jenkins/test.groovy")
{code}

h4. Build log
{code:none}

Checking out git g...@git.serv.d.net:ts-source.git into /var/lib/jenkins/jobs/wftest/workspace@script to read .jenkins/test.groovy
No credentials specified
 > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository
 > git config remote.origin.url g...@git.serv.d.net:ts-source.git # timeout=10Fetching upstream changes from g...@git.serv.d.net:ts-source.git
 > git --version # timeout=10
 > git fetch --tags --progress g...@git.serv.d.net:ts-source.git +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/*
 > git rev-parse 4eedb3b^{commit} # timeout=10Checking out Revision 4eedb3baaa6d528d22180784e0001d99d618bda9 (detached) > git config core.sparsecheckout # timeout=10
 > git checkout -f 4eedb3baaa6d528d22180784e0001d99d618bda9Commit message: ".jenkins: make the jobseed job running in sandbox"
 > git rev-list --no-walk 3c75ef69338675fe751d97af3173c206aef58d94 # timeout=10
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] readTrusted
[Pipeline] End of Pipeline
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" returned status code 128:
fatal: Couldn't find remote ref refs/heads/4eedb3b
fatal: The remote end hung up unexpectedly

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)     at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)     at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198)     at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:101)     at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)     at hudson.security.ACL.impersonate(ACL.java:290)     at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)     at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
{code}
 
The expected behavior is that readTrusted results in
{{ "git fetch  \ --tags  \ --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b +refs/config/4eedb3b:refs/remotes/origin/4eedb3b \ --prune" }} . However
{{ "git fetch  \ --tags  \ --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b  \ --prune" }} is used.

weltfahr@gmail.com (JIRA)

unread,
Jan 9, 2020, 2:04:03 AM1/9/20
to jenkinsc...@googlegroups.com
{ {" code:groovy}
git fetch \--tags \--progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b +refs/config/4eedb3b:refs/remotes/origin/4eedb3b \--prune "

{code
} }.

However

{ {" code:groovy}
git fetch \--tags \--progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b \--prune "

{code
} }

is used.

weltfahr@gmail.com (JIRA)

unread,
Jan 9, 2020, 2:06:03 AM1/9/20
to jenkinsc...@googlegroups.com
--progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b +refs/config/4eedb3b:refs/remotes/origin/4eedb3b --prune
{code}

However

{code:groovy}
git fetch
  --tags   --progress   origin   +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b   --prune
{code}

is used.

weltfahr@gmail.com (JIRA)

unread,
Jan 9, 2020, 2:06:03 AM1/9/20
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 12, 2020, 4:48:03 PM2/12/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite
Component/s: workflow-multibranch-plugin
Component/s: git-plugin
Reply all
Reply to author
Forward
0 new messages