How to get the job name on a groovy dynamic parameter in Jenkins -
i need name job in example, have code previous value of build parameter code
jenkins.model.jenkins.instance.getitem("nameofjob").lastbuild.getbuildvariables().get("nameofparameter");
the name of job hard coded, need name name of current job, how can't do?
thank you
groovy dynamic parameters not have access usual environment variables rest of jenkins job privy to.
here working hack job name:
def build = thread.currentthread().tostring() def regexp= ".+?/job/([^/]+)/.*" def match = build =~ regexp def jobname = match[0][1]
Comments
Post a Comment