[JIRA] [git-plugin] (JENKINS-27508) Cannot used ENV Variable for repository url in GIT-Plugin in GIT Publisher

62 views
Skip to first unread message

D.Bahadir@GMX.de (JIRA)

unread,
Jul 2, 2015, 1:38:02 PM7/2/15
to jenkinsc...@googlegroups.com
Deniz Bahadir commented on Bug JENKINS-27508
 
Re: Cannot used ENV Variable for repository url in GIT-Plugin in GIT Publisher

There are also other form-fields where successfull variable-substitution would make sense.

For example I stumbled about the missing substitution-feature for the Path field of the Sparse Checkout path option.
However, variable-substitution works e.g. for the Local subdirectory for repo field of the Check out to a sub-directory option.

I would suggest this plugin supports (environment) variable-substitution in all form-fields.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

dcarreir@harris.com (JIRA)

unread,
Jul 27, 2018, 12:12:01 PM7/27/18
to jenkinsc...@googlegroups.com

believe I see a related issue when used with a pipeline. In this case I have a parameterized build, I use the parameter for the branch name but it doesn't get expanded.  If I do the same think in a freestyle job it works.

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

Aaron.Marasco@BIA-Boeing.com (JIRA)

unread,
Jul 30, 2018, 9:18:01 AM7/30/18
to jenkinsc...@googlegroups.com

Daniel Carreira your problem sounds like the groovy didn't properly interpret the string; is it double quoted?

dcarreir@harris.com (JIRA)

unread,
Jul 30, 2018, 9:26:01 AM7/30/18
to jenkinsc...@googlegroups.com

dcarreir@harris.com (JIRA)

unread,
Jul 30, 2018, 9:28:02 AM7/30/18
to jenkinsc...@googlegroups.com

dcarreir@harris.com (JIRA)

unread,
Jul 30, 2018, 9:33:01 AM7/30/18
to jenkinsc...@googlegroups.com

dcarreir@harris.com (JIRA)

unread,
Jul 30, 2018, 9:33:03 AM7/30/18
to jenkinsc...@googlegroups.com
Daniel Carreira commented on Bug JENKINS-27508
 
Re: Cannot used ENV Variable for repository url in GIT-Plugin in GIT Publisher

Below is the console log from the job.

MY_BRANCH is a string parameter (I've also tried it as a branch parameter with the same results).

I then try to use the variable via the git plug-in in a Pipeline script in SCM job. (I just tried adding double quotes around the ${MY_BRANCH} same results except the log show the double quotes.

 

 

hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress origin +refs/heads/${MY_BRANCH}:refs/remotes/origin/${MY_BRANCH} --prune" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/${MY_BRANCH}

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1715)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:99)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:59)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:263)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Finished: FAILURE

Aaron.Marasco@BIA-Boeing.com (JIRA)

unread,
Jul 30, 2018, 9:38:02 AM7/30/18
to jenkinsc...@googlegroups.com

Daniel Carreira sorry, I meant in the groovy code, assuming MY_BRANCH was an input; otherwise, yeah, this sounds like the same problem since it's at the UI-level.

dcarreir@harris.com (JIRA)

unread,
Jul 30, 2018, 9:43:02 AM7/30/18
to jenkinsc...@googlegroups.com

jielpe-cblv38@protonmail.com (JIRA)

unread,
Aug 17, 2018, 3:04:02 AM8/17/18
to jenkinsc...@googlegroups.com
jlpinardon updated an issue
 
Change By: jlpinardon
Attachment: image-2018-08-17-07-02-20-124.png

jielpe-cblv38@protonmail.com (JIRA)

unread,
Aug 17, 2018, 3:14:02 AM8/17/18
to jenkinsc...@googlegroups.com
jlpinardon commented on Bug JENKINS-27508
 
Re: Cannot used ENV Variable for repository url in GIT-Plugin in GIT Publisher

I confirm that this problem is realy annoying !
I'd like to use a build parameter named branchName as the name of the branch from which the pipeline script is extracted.

I tried this :

  • with and without quotes
  • with branchName defined as a build parameter
  • with branchName defined in the prepare an environment for the rnu
  • with branchName defined as a global environment variable

In each and every cases, the result is exactly the same. The exact term "${branchName}" is used rather than the value :

[BFA] Done. 0s
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/"${branchName}":refs/remotes/origin/"${branchName}" --prune" returned status code 128:
{{stdout: }}
stderr: fatal: Couldn't find remote ref refs/heads/"${branchName}"

 

This is really annoying and this does not help for pipeline adoption.

jielpe-cblv38@protonmail.com (JIRA)

unread,
Aug 17, 2018, 3:22:01 AM8/17/18
to jenkinsc...@googlegroups.com
jlpinardon edited a comment on Bug JENKINS-27508
I confirm that this problem is realy annoying !
I'd like to use a build parameter named branchName as the name of the branch from which the pipeline script is extracted.

!image-2018-08-17-07- 02- 20- 124 30-640 .png!



I tried this :
* with and without quotes
* with branchName defined as a build parameter
* with branchName defined in the prepare an environment for the rnu
* with branchName defined as a global environment variable


In each and every cases, the result is exactly the same. The exact term "${branchName}" is used rather than the value :

{{[BFA] Done. 0s}}
{{hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/"${branchName}":refs/remotes/origin/"${branchName}" --prune" returned status code 128:}}
\ {{stdout: }}
{{stderr: fatal: Couldn't find remote ref refs/heads/"${branchName}"}}

 

This is really annoying and this does not help for pipeline adoption.

jielpe-cblv38@protonmail.com (JIRA)

unread,
Aug 17, 2018, 3:25:01 AM8/17/18
to jenkinsc...@googlegroups.com
jlpinardon edited a comment on Bug JENKINS-27508
I confirm that this problem is realy annoying !
I'd like to use a build parameter named branchName as the name of the branch from which the pipeline script is extracted.

!image-2018-08-17-07-20-30-640.png!


I tried this :
* with and without quotes
* with branchName defined as a build parameter
* with branchName defined in the prepare an environment for the rnu
* with branchName defined as a global environment variable

In each and every cases, the result is exactly the same. The exact term "${branchName}" is used rather than the value :

{{[BFA] Done. 0s}}
{{hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/"${branchName}":refs/remotes/origin/"${branchName}" --prune" returned status code 128:}}
\{{stdout: }}
{{stderr: fatal: Couldn't find remote ref refs/heads/"${branchName}"}}

 

This _This is really annoying and this does not help for pipeline adoption adoption_ . Besides, this bug is classified as *critical*, so could we have an idea of a date for its resolution ?

jielpe-cblv38@protonmail.com (JIRA)

unread,
Aug 17, 2018, 4:00:02 AM8/17/18
to jenkinsc...@googlegroups.com
jlpinardon edited a comment on Bug JENKINS-27508
I confirm that this problem is realy annoying !
I'd like to use a build parameter named branchName as the name of the branch from which the pipeline script is extracted.

!image-2018-08-17-07-20-30-640.png!

I tried this :
* with and without quotes
* with branchName defined as a build parameter
* with branchName defined in the prepare an environment for the rnu
* with branchName defined as a global environment variable

In each and every cases, the result is exactly the same. The exact term "${branchName}" is used rather than the value :

{{[BFA] Done. 0s}}
{{hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/"${branchName}":refs/remotes/origin/"${branchName}" --prune" returned status code 128:}}
\{{stdout: }}
{{stderr: fatal: Couldn't find remote ref refs/heads/"${branchName}"}}

  Note that the quite complete help associated with the field states that an environment variable can be used !

_This is really annoying and this does not help for pipeline adoption_. Besides, this bug is classified as *critical*, so could we have an idea of a date for its resolution ?

maxvir.malpa@gmail.com (JIRA)

unread,
Nov 7, 2018, 3:35:04 AM11/7/18
to jenkinsc...@googlegroups.com

The workaround I've discovered is to disable lightweight checkout. Then the envionment variable is correctly picked-up without any need for quotes

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

nicolas.deloof@gmail.com (JIRA)

unread,
Apr 24, 2019, 10:30:11 AM4/24/19
to jenkinsc...@googlegroups.com

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

unread,
Jan 19, 2020, 10:07:04 PM1/19/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite
Priority: Critical Minor
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages