Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing information in builds specified in a run parameter [Hudson]

Day 1 with using Hudson for our CI build. Slowly but surely getting up to speed.

My question is about run parameters. I've seen that I can use them to reference a particular run of a particular project - that's all fine.

What I don't understand (and can't find any documentation on - there's nothing at Parameterized Build) is how I refer to anything in the run defined by the run parameter.
Essentially I want to reference the %BUILD_NUMBER% and %SVN_REVISION% of the run that is selected in the run parameter.

How can I do that?

like image 489
jamiet Avatar asked Nov 05 '22 10:11

jamiet


1 Answers

Do you really need to add extra property values, extra parameters for your job?

Since BUILD_NUMBER and SVN_REVISION are already defined as environment variables (see Building a software project), you can use those in your job.

When a Hudson job executes, it sets some environment variables that you may use in your shell script, batch command, or Ant script

Shell Script

or:

Ant Script

illustrates you already have those values at your disposal.
You can then use them to define other environment variables/properties within your shell or ant script.


When it comes to pass a variable value from one job to another, the Parameterized Trigger Plugin should do the trick:

The parameters section can contain a combination of one or more of the following:

Build parameters

  • a set of predefined properties
  • properties from a properties file read from the workspace of the triggering build
  • the parameters of the current build
  • "Subversion revision": makes sure the triggered projects are built with the same revision(s) of the triggering build.
    You still have to make sure those projects are actually configured to checkout the right Subversion URLs.

Note: there might be an issue with the Join Plugin, which might not work when the Parameterized Trigger is in action.

like image 161
VonC Avatar answered Dec 03 '22 01:12

VonC