Issue 0039
- Summary
- JENKINS_URL is wrong until after user configuration of Jenkins
- Owner
- Tim
- Reporter
- Tim
- Status
- closed
- Priority
- high
Description [edit section]
Lots of environment variables ending in _URL don't show up in the environment of jobs (or have invalid values) until after the user specifically saves the configuration of Jenkins.Specifically, the following are not present in the environment of a job (or are wrong):
- JOB_URL - doesn't show up
- BUILD_URL - doesn't show up
- HUDSON_URL - doesn't show up
- JENKINS_URL - doesn't show up
- JOB_DISPLAY_URL - has invalid URL
- RUN_CHANGES_DISPLAY_URL - has invalid URL
- RUN_DISPLAY_URL - has invalid URL
This can be fixed if someone goes to:
- Manage Jenkins ->
- Configure System -> (notes or sets the value in "Jenkins URL"), then clicks "Save".
This creates the file /var/lib/jenkins/jenkins.model.JenkinsLocationConfiguration.xml with the following contents:
<?xml version='1.0' encoding='UTF-8'?> <jenkins.model.JenkinsLocationConfiguration> <adminAddress>address not configured yet <nobody@nowhere></adminAddress> <jenkinsUrl>http://localhost:8080/fuego/</jenkinsUrl> </jenkins.model.JenkinsLocationConfiguration>
Until this file exists, nothing can use the URLs. Indeed, JOB_DISPLAY_URL is present in the job environment, but it has a value like the following:
JOB_DISPLAY_URL=http://unconfigured-jenkins-location/job/bbb.default.Functional.hello_world/display/redirect
Jenkins developers do not consider this a bug. See this issue report: https://issues.jenkins-ci.org/browse/JENKINS-28466
Because of this, the function abort_job in engine/scripts/common.sh uses a hardcoded URL instead of JENKINS_URL. This should be changed. There should be a way to configure the server with the correct URL on startup.
This has the side effect of making Fuego code dependent on a static port number, which means that you can't easily change the port number of Jenkins in case it conflicts with another program (using port 8080 - like another instance of Jenkins). Changing the Jenkins port will cause abort_job to fail.
Notes [edit section]
This was fixed in fuego and fuego core by the following commits:- https://bitbucket.org/fuegotest/fuego/commits/1d53f95a2a753f2aa9d521f4108c4fa712f6210a?at=master
- https://bitbucket.org/fuegotest/fuego-core/commits/d449a0a8ed0e1851c29c5895fee0162da59777de
- backlink