Skip to content

environment variable substitution for config files in /usr/share/jenkins/ref/ #448

@jpraet

Description

@jpraet

It would be nice if environment variables (or another placeholder replacement mechanism) could be used for the config files in /usr/share/jenkins/ref/. For example:

hudson.tasks.Mailer.xml:

<?xml version='1.0' encoding='UTF-8'?>
<hudson.tasks.Mailer_-DescriptorImpl plugin="mailer@1.19">
  <hudsonUrl>http://jenkins.example.com/</hudsonUrl>
  <smtpHost>smtp.example.com</smtpHost>
  <useSsl>false</useSsl>
  <charset>UTF-8</charset>
</hudson.tasks.Mailer_-DescriptorImpl>

jenkins.model.JenkinsLocationConfiguration.xml:

<?xml version='1.0' encoding='UTF-8'?>
<jenkins.model.JenkinsLocationConfiguration>
  <adminAddress>no-reply-jenkins@example.com</adminAddress>
  <jenkinsUrl>http://jenkins.example.com/</jenkinsUrl>
</jenkins.model.JenkinsLocationConfiguration>

I would like to provide these default configuration files in /usr/share/jenkins/ref/, but the http://jenkins.example.com/ should be specified dynamically when running the container (e.g. for another instance in a test environment).

So I'd like to be able to write something like
<jenkinsUrl>${JENKINS_URL}</jenkinsUrl>
or maybe with a default value
<jenkinsUrl>${JENKINS_URL-http://jenkins.example.com/}</jenkinsUrl>

and then specify a value at runtime with
docker run -e "JENKINS_URL=http://jenkins-test.example.com/"

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions