Creating a Formatted Version Number in a config block?

387 views
Skip to first unread message

Gregg Lowrimore

unread,
Jul 8, 2015, 12:01:15 PM7/8/15
to job-dsl...@googlegroups.com
I have a block that passes the Groovy compilation stage, and produces XML in the underlying config.xml output file, but when Jenkins views this job configuration, the version string is not "turned on" or enabled with any of the information posted in the DSL.

Here's my block:

// Setup release number
configure { project ->
    project / wrappers << 'org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder' {
        versionNumberString('${BUILD_ID}')
        projectStartDate('1970-01-01 00:00:00.0 UTC')
        environmentVariableName('BUILD_VERSION')
        oBuildsToday(-1)
        oBuildsThisMonth(-1)
        oBuildsThisYear(-1)
        oBuildsAllTime(-1)
        skipFailedBuilds(true)
        useAsBuildDisplayName(true)
    }
 }

Are there any obvious mistakes in this block? Can anyone correct this into working properly?

Gregg Lowrimore

unread,
Jul 8, 2015, 4:09:01 PM7/8/15
to job-dsl...@googlegroups.com
I got this one working now too!

All of this worked once I changed the "project / wrappers" to  "project / buildWrappers" (I don't know how many iterations of trying different build wrappers spellings I tried, but evidently I missed the bumpy-case one. Go figure!)

Gregg Lowrimore

unread,
Jul 8, 2015, 4:10:33 PM7/8/15
to job-dsl...@googlegroups.com
Here's the working block:


    // Setup release number
    configure { project ->
        project / buildWrappers << 'org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder' {

            versionNumberString('${BUILD_ID}')
            projectStartDate('1970-01-01 00:00:00.0 UTC')
            environmentVariableName('BUILD_VERSION')
            oBuildsToday(-1)
            oBuildsThisMonth(-1)
            oBuildsThisYear(-1)
            oBuildsAllTime(-1)
            skipFailedBuilds(true)
            useAsBuildDisplayName(true)
        }
    }

On Wednesday, July 8, 2015 at 10:01:15 AM UTC-6, Gregg Lowrimore wrote:
Reply all
Reply to author
Forward
0 new messages