Set a Jenkins variable after reading console log line / value --OR-- using the variables used by scripts / commands what Jenkins calls -


i dont need following:

  1. how set jenkins env variable or
  2. how use environment variables in jenkins / windows shell / ant / etc scripts.

what need opposite of that.

summary: 1. have jenkins job: abc_build 2. job calls .bat file (which calls ant code / target packaging / building build). creating build, job know what's new build label name , ant storing in variable called "new.build.label". file used build.xml.

(a note novice users: if want call many windows commands (.bat / .cmd or commands creates windows shell) then, should call using "call
script.bat -dparam1 -dparam2...." way).

  1. now, job calls .bat file (which calls ant code /target) , uses 1 of parameter value gets generated first .bat file / ant package target call (i.e. "new.build.label"). separate .bat command call call new session of ant code/target, need pass value of "new.build.label" during call of step. file used here deploy.xml.

  2. basically, i'm trying see how can set variable in jenkins, either using: a. reading console output of jenkins job i'm echoing value of new build label in standard output / console output. b. other way, can set jenkins variable using "new.build.label" ant variable (once first .bat / ant package target finished) , i'm ready call 2nd .bat / .cmd / ant call doing deployment. unfortunately, can't both package / deploy @ same time.

    i'm not interested in knowing why can't call target deploy first ant session when know value of "new.build.label" main request is:

    how set jenkins variable using "variable" used 1 of scripts (ant/jelly/groovy/maven/etc) jenkins called.

you can pass environment variables among jenkins build steps via envinject plugin. in particular case following best way:

  1. the first ant should echo new.build.label properties file can read envinject plugin, e.g.:

    <echo message="new.build.label=${new.build.label}" file="envars.props" /> 
  2. create inject environment variables build step , set "properties file path" envars.props (make sure dealing paths correctly). new.build.label available environment variable rest of build steps.

by way, think not practice call ant batch files in jenkins. use ant build step instead.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -