[JENKINS-26886] Variables not being substituted in github URLs for $JOB_NAME
The release notes for 1.10 github plugin mention that it now supports variable substitution.
But that seems not to work, at least for the value of "JOB_NAME"
We name our Jenkins projects based on the github project name, and that allows us to setup a template with the following url for the project on github:
https://github.com/mycompany/$JOB_NAME/
But, when you click on the GitHub link in the left hand notification, the link is still to /$JOB_NAME/ – not the actual substituted name of the job.
Originally reported by gregcovertsmith, imported from: Variables not being substituted in github URLs for $JOB_NAME
- status: Reopened
- priority: Major
- component(s): github-plugin
- label(s): github
- resolution: Unresolved
- votes: 1
- watchers: 3
- imported: 2025-12-08
Raw content of original issue
The release notes for 1.10 github plugin mention that it now supports variable substitution.
But that seems not to work, at least for the value of "JOB_NAME"
We name our Jenkins projects based on the github project name, and that allows us to setup a template with the following url for the project on github:
https://github.com/mycompany/$JOB_NAME/
But, when you click on the GitHub link in the left hand notification, the link is still to /$JOB_NAME/ – not the actual substituted name of the job.
- environment:
Jenkins1.594, GitHub plugin 1.10
integer:
- Original comment link
Raw content of original comment:
Have you tried
${JOB_NAME}?
Have you tried
${JOB_NAME}
?
lanwen:
- Original comment link
Raw content of original comment:
This var substitution works only in some context with environment. This context is usually build. So when there is no any context, variable substitution can't work. I can think about replacing some of variables, but it will be not all of defined in build scope
This var substitution works only in some context with environment. This context is usually build. So when there is no any context, variable substitution can't work. I can think about replacing some of variables, but it will be not all of defined in build scope
integer:
- Original comment link
Raw content of original comment:
No replies - closing.
No replies - closing.
lautou:
- Original comment link
Raw content of original comment:
I reopen this issue because i have a similar problem with GitHub plugin 1.25.1 / Jenkins 2.32.1 I create a Jenkins variable environment on System configuration screen: GITHUB_BASE_URL = https://mygihubentrepriseurl.com
On Project Url field in my job i enter this value : ${GITHUB_BASE_URL}/MyOrg/MyProject
Result : On the left pane of job page the GitHub button points to the job page URL instead of pointing to GitHub URL i mentionned on the Project URL field.
What's wrong?
I reopen this issue because i have a similar problem with GitHub plugin 1.25.1 / Jenkins 2.32.1
I create a Jenkins variable environment on System configuration screen:
GITHUB_BASE_URL = https://mygihubentrepriseurl.com
On Project Url field in my job i enter this value :
${GITHUB_BASE_URL}/MyOrg/MyProject
Result : On the left pane of job page the GitHub button points to the job page URL instead of pointing to GitHub URL i mentionned on the Project URL field.
What's wrong?
lanwen:
- Original comment link
Raw content of original comment:
Now it knows nothing about env vars of jenkins. It should be implemented.
Now it knows nothing about env vars of jenkins. It should be implemented.
lautou:
- Original comment link
Raw content of original comment:
The problem persists with $JOB_NAME. I also tried ${JOB_NAME}, substitution is not done. It is difficult to define a job template without using variables.
The problem persists with $JOB_NAME. I also tried ${JOB_NAME}, substitution is not done.
It is difficult to define a job template without using variables.
integer:
- Original comment link
Raw content of original comment:
When triggering works it knows nothing about environment variables, env vars exists only in build context while polling works outside of build context.
When triggering works it knows nothing about environment variables, env vars exists only in build context while polling works outside of build context.
integer:
- Original comment link
Raw content of original comment:
About what templates are you talking? It pretty simple to generate full url with job-dsl-plugin.
About what templates are you talking? It pretty simple to generate full url with job-dsl-plugin.
lautou:
- Original comment link
Raw content of original comment:
integer : You said "env vars exists only in build context" -> I now understand that. What i would like is to avoid configuration duplication between jobs. All the jobs have the same base GitHub URL -> Having the GitHub base URL in a variable can help to reduce the maintenance effort if i have to change the GitHub host URL on hundred jobs. Moreover it avoid to duplicate the base URL in the same job because the URL is the same on SCM configuration section.
According to you the best solution is to generate the jobs using dsl plugin to avoid such overhead?
integer : You said "env vars exists only in build context" -> I now understand that.
What i would like is to avoid configuration duplication between jobs.
All the jobs have the same base GitHub URL -> Having the GitHub base URL in a variable can help to reduce the maintenance effort if i have to change the GitHub host URL on hundred jobs.
Moreover it avoid to duplicate the base URL in the same job because the URL is the same on SCM configuration section.
According to you the best solution is to generate the jobs using dsl plugin to avoid such overhead?