java - Jenkins execute shell on job's executor during CONFIGURATION time (and access workspace) -


i create simple jenkins plugin.

basically custom build step (builder extension) dropdown list. trick want fill dropdown list result of shell script/command executed during configuration time.

here method stub.

    public listboxmodel dofill...items(@ancestorinpath abstractproject project) {         // determine workspace         // project.getsomeworkspace() or project.getsomeworkspace().getremote()         ...         // invoke shell commands         string[] results = ...          listboxmodel items = new listboxmodel();         (string item : results) {             items.add(item);         }         return items;     }     

my questions following:

  1. if there slaves too, jenkins maintain 2 workspaces (so freshest source code exist both locations?
    understanding (after first build) there 2 workspaces: on master there meta informations (and source code too?), on slave there source code , build intermediates, information, artifacts. (unless extract artifacts or use copy-to-slave-plugin)

  2. where workspace project.getsomeworkspace() or project.getsomeworkspace().getremote()? (master/slave?)

  3. how can invoke shell command on machine execute build? or @ least there way choose master / 1 of slaves particularly? (suppose configured label on group of machines want run job.)
    don't have access abstractbuild, buildlistener , launcher (since don't exist yet...)

  4. how can find out properties can @ancestorinpath.
    understand shorthand, injection staplerrequest invoked jenkins? how can see request?

it important execution of shell command takes place, if there 2 identical workspaces on master , slave. in case there may windows master (in future) , osx slave. need osx run commands. (currently there master on osx.)

edit:

here example, part of trying do. created simple xcode project in swift (jenkinsswift). in terminal project's directory can issue following command: xcodebuild -project jenkinsswift.xcodeproj -list

and following response:

targets:     jenkinsswift     jenkinsswifttests  build configurations:     debug     release  if no build configuration specified , -scheme not passed "release" used.  schemes:     jenkinsswift 

during configuration time want navigate project workspace on os x machine want issue previous command. way parse response , allow users choose target / configuration / scheme during configuration. (of course can done manually bash scripts, wanted make easier.)

  1. this works differently, there no workspace job default. 1 allocated build run on build machine (be master or slave). there can number of workspaces given job based on , how many times job run. though, there no guarantee there on master. not confuse terms workspace (living on build machine) , build result directory on master.
  2. project#getsomeworkspace(), gives workspace used some past build. note, done on purely best effort bases there might none.
  3. there no way know build run @ configuration time unless tie job 1 particular machine. see hudson.model.node#createlauncher(tasklistener) on how run processes in jenkins grid.
  4. @ancestorinpath allows inject of domain object ware traversed stapler during url binding. should not try inject might not part of url. there no way known me inject request, stapler uses 1 initiated action method invocation.

the bottom line try sounds highly unusual. perhaps there easier way solve original problem.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -