Hi,

I'm just experimenting with Groovy (newbie) to enhance/ease functionality 
on our Jenkins server.
I have NO experience with Java.

What I want to do is to create a parametrized job that receives a job name 
and a build number and some other information
as parameters to access some data of that build and use the groovypostbuild 
plugin to add a badge/text/..

The problem is that this job MUST run much later than the postbuild phase 
of the job. Kind of second-postbuild-much-later-than-postbuild.

The problem I have is: The job I want to access is NOT running/the current 
job.
How to bind the groovypostbuild manager variable to that job?

What I have is:

import org.jvnet.hudson.plugins.groovypostbuild.*;

/**
 * VARIABLES
 */

def params = new HashMap()

// specified variables (in Jenkins job)

def thr = Thread.currentThread()
def build = thr?.executable


def parameters = build?.actions.find{ it instanceof ParametersAction 
}?.parameters
parameters.each {
    params.put(${it.name},${it.value}) 
}

required = ['JOB_NAME', 'JOB_BUILD_NO', 'INFO2ADD']
required.each { key ->
    if (!parameters.containsKey(key)) {
        out.printf "ERROR: Mandatory parameter %s is empty or missing!\n", 
key
        System.exit     
   }
   else {
        out.printf "%s = %s\n", key, parameters.get(key)
   }
}


def releaseBuildJob = 
hudson.model.Hudson.instance.getItem(params.get('JOB_NAME'));
def releaseBuild = 
releaseBuildJob.getBuildByNumber(params.get('JOB_BUILD_NO').toInteger());

// >>>>>>    Missing:  <<<<<<<<<<<<<<

// ???? Bind groovypostbuild manager to releaseBuild ??? 

xxxx.manager.addShortText(params.get('INFO2ADD'))


Any hints/explanations are welcome!

Thanks,
 Axel




 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to