Bogi
Bogi

Reputation: 2598

Jenkins - publish version number for each build

We are testing an embedded system which is a Linux image with several components in it. When a new image is released, it gets a version, e.g. Image 1.0.1 and in it each component in it has its own version. e.g. component1-2.0.3, component2-4.1.22 etc. Image generation is done externally (I don't know how).

We are automating testing of our system, so now our testing looks like this:

The end goal of Jenkins testing would be generation of reports for each image version. E.g.

Image 1.0.1
Testing results
Component1-2.0.3, passing 100, failing 20, etc.
Component2-4.1.22, passing 34, failing 3, etc.

I don't know how to do this automatically, so please help. I need information about:

Any experiences, plugins and information are welcome.

Upvotes: 1

Views: 729

Answers (3)

Vitalii Elenhaupt
Vitalii Elenhaupt

Reputation: 7326

My suggestion is to match needed information in the build log and set build description with Groovy Postbuild Plugin:

image = manager.getLogMatcher(/Image ([\d.]+).*/).group(1)
comp1 = manager.getLogMatcher(/Component1-([\d.]+).*/).group(1)
comp2 = manager.getLogMatcher(/Component2-([\d.]+).*/).group(1)

manager.build.description = "<b>Image:</b> ${image} <b>Comp1:</b> ${comp1} <b>Comp2:</b> ${comp2}"

As a result you will have versions of your components for each build description:

enter image description here

Upvotes: 1

Anni S
Anni S

Reputation: 2026

As you said, you can see the versions in the log so just use a regular expression in an email body:

Component1 Version: ${BUILD_LOG_REGEX, regex="^Component1-", showTruncatedLines=false, substText=""}
Component2 Version: ${BUILD_LOG_REGEX, regex="^Component2-", showTruncatedLines=false, substText=""}

BUILD_LOG_REGEX uses following regular expression: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

Upvotes: 1

kazerm
kazerm

Reputation: 529

You can use the text finder plugin to search for a specific text in the build log - you can user regular expression for that. Then you can echo the result to a file that will include all the components and add it to the build summary

Upvotes: 1

Related Questions