Skip to end of metadata
Go to start of metadata

Plugin Information

View export dynamic job data on the plugin site for more information.

Adds a build step that exports runtime parameters into a properties file (e.g who triggered the build, what is her email address...). This information can be read by other build steps.

 job-exporter plugin

Enabling

To use it, edit the configuration of a particular job, go to "Build" and click "Add build step", in the list select "Export Job runtime parameters", this will create the files at the point in the build where this step is executed.

Details

This plugin exports Jenkins (runtime) job parameters into a ".properties" file. So other build steps (e.g. ant scripts) can read those parameters and work with them. For example: send some information via email to the user who triggered a job.

The property file is named "hudsonBuild.properties" and will be created in the project workspace. This file contains the following informations:

Property

Meaning

build.jobName

Name of running job.

build.id

Build ID.

build.number

Number of running job.

build.host

Job runs on this host.

build.slave

Job runs on this slave.

build.result

Job result til this build step.

build.started

Job started at this time.

build.elapsedTime

Milliseconds the job is already running.

build.duration

Human readable elapsed time.

build.executor

Executor number.

build.cvsBranch

CVS branch, if configured.

build.svnRevision

SVN revision, if configured.

build.gitBranch

GIT branch, if configured.

build.user.id

ID of user that triggered this job. Has value of "null" for anonymous user. Only filled if the build was triggered by an user.

build.user.name

User that triggered this job. Only filled if the build was triggered by an user.

build.user.fullName

Full name of user that triggered this job. Mostly identical with value of "build.user.name" (if ID is not null).

build.user.emailAddress

Email address of user that triggered this job. If no user with email address was found, the admin email address stands here.

build.upstream.number

Number of upstream job that triggered this job. Only filled if the build was triggered by an upstream project.

build.upstream.project

Upstream project that triggered this job.

build.remote.host

Remote host that triggered this job. Only filled if the build was triggered by a remote host.

build.remote.note

Host note for remotely triggered job.

build.admin.emailAddress

This is the current administrator email address.

build.summary

Build summary like "Executor #3 for master : executing MyJob #28"

build.hudson.version

Running Jenkins version.

 Version History

Version 0.4 (27 Jan 2012)

  • Now working with current Jenkins version again.
  • Some more properties are exported.

Version 0.3.1 (22 Mar 2011)

  • Rerelease 0.3 to properly set required core version.

Version 0.3 (31 Jan 2011)

  • This is just a bugfix release that should work as described before.

Version 0.2 (29 Jan 2011)

  • User triggered build now has correct user email address again
  • Upstream and remote build causes also provide some informations

Version 0.1 (01 Dec 2009)

  • Initial release

8 Comments

  1. For me this is a really useful plugin, thank you ... but could you perhaps set an additional property, namely the build cause. With this extra information one could use the output in hudsonBuild.properties to inform the user that triggered the job or determine the upstream job and find the user in that properties file.

    1. Hello Hendryk,

      the next release (0.2) should give you that information.

      Greetings, Michael

  2. I used this plugin with Jenkins v1.426 and it worked fine. But yesterday I upgraded Jenkins to the latest version (1.433) and now, the plugin doesn't fill each variable in the properties file. If a user start a job the output is like this:

    #created by com.meyling.hudson.plugin.job_exporter.ExporterBuilder
    #Thu Oct 06 14:06:55 CEST 2011
    build.summary=Executor #3 for master \: executing xxxxxxxxxxxxx #48
    build.number=48
    build.id=2011-10-06_14-06-33
    build.hudson.version=1.433
    build.admin.emailAddress=address not configured yet <nobody@nowhere>
    build.jobName=xxxxxxxxxxxxxxx
    build.cvsBranch=

    so the build.user.name parameter (and some other) is missing.

    I wrote bug report about this: https://issues.jenkins-ci.org/browse/JENKINS-11244

  3. I suggest you should provide the ability to export variables with a url. You could look at the EnvInject Jenkins plugin that provides this feature for injected environment variables.

    1. Thank you for your suggestion. Is it not possible to retrieve the resulting file from the workspace? Something like http://my.org/jenkins/view/All/job/myJob/ws/hudsonBuild.properties/*view*/ should do the trick.

  4. Would it be possible to add the Git revision to the properties?

    It would be very useful to trigger downstream jobs using the exact same revision of the initial build. :)

    Thanks!

  5. I am using 0.4 with Jenkins 1.509.4 (latest LTS version)

    I am missing quite a lot of attributes, but in particular i need build.user.emailAddress

    Seems like it works as regular build step, but doesn't work when ran from Promoted Builds. This used to work fine for both before

    This is what i see in the build step:###################################################################
    job-exporter plugin started
    hudson.version: 1.509.2
    host: ****
    id: 2013-10-11_14-52-21
    duration: 1.4 sec
    slave:
    started: 2013-10-11T14:52:21
    result: SUCCESS
    result: SUCCESS
    summary: Executor #2 for master : executing GB API Trunk Build » promotion » 2 - Deploy to DEV #1
    executor: 2
    elapsedTime: 1484
    number: 1
    jobName: GB-API-Trunk-Build/promotion/2 - Deploy to DEV
    we have 1 build cause:
    Cause.UserCause Started by user slavd
    new file written: ****\jobs\GB-API-Trunk-Build\workspace\hudsonBuild.properties
    job-exporter plugin finished. That's All Folks!
    ###################################################################

    And this is what i see in the file:#created by com.meyling.hudson.plugin.job_exporter.ExporterBuilder
    #Fri Oct 11 14:52:22 EDT 2013
    build.result=SUCCESS
    build.host=****
    build.slave=
    build.hudson.version=1.509.2
    build.jobName=GB-API-Trunk-Build/promotion/2 - Deploy to DEV
    build.elapsedTime=1484
    build.number=1
    build.executor=2
    build.started=2013-10-11T14\:52\:21
    build.duration=1.4 sec
    build.summary=Executor #2 for master \: executing GB API Trunk Build \u00BB promotion \u00BB 2 - Deploy to DEV #1
    build.admin.emailAddress=*****
    build.id=2013-10-11_14-52-21

  6. Is this still maintained?

    I still cannot get user email address when triggered through "Promoted Builds"