e82.eric
e82.eric

Reputation: 313

Jenkins Git Plugin Repository Url Variable

Is it possible to use a variable in the repository url for the jenkins git plugin?

https://${GIT_USER}@github.com/e82eric/Prompts.git

When I try it looks like ${GIT_USER} is passed instead of the substitution.

Upvotes: 12

Views: 7510

Answers (3)

BEST SOLUTION - 100% works

First place the entire Repository url with no variables under Environment variables. Example: Let's say i want to put https://[email protected]/ero/myProject under Repostiory Url in Pipeline from scm Dashboard -> Manage Jenkins -> Configure the System -> Environment variables Click on Add

[

Now go to the Repository Url and place ${RepoUrl} there

Finally (Important step) Uncheck the Lightweight checkout at the bottom

Build It -> Success

Upvotes: 2

Gonen
Gonen

Reputation: 4075

According to the Jenkins Git-Plugin page, this should be working by now (Feb-2015).

Among the issues that were resolved:

  • JENKINS-14276 - Git SCM-polling doesn't work when using a parametrized branch-name
  • JENKINS-20427 - Build Parameter variable in branch name causes polling to detect false changes in GIT
  • JENKINS-23675 - The git plugin is not working correctly when the repository url has job parameter and any repository credentials
  • JENKINS-24786 - Since 2.2.6, environment variables are not expanded in git publisher

Upvotes: 2

Paul Sweatte
Paul Sweatte

Reputation: 24617

As noted above:

It looks like this issue has been filed many times over the course of the past few years and they never "accepted" a fix. There have been fixes but the admins closed the issue as "Won't fix".

References

Upvotes: 0

Related Questions