71136

Jenkins pipeline not honoring agent specification

Question:

At the pipeline level I specify the agent and node (with both the label and custom workspace). When the pipeline kicks off it runs on the specified node, but when it hits the 'build job' picks the first available node. I tried playing with the NodeLabel plugin, but that didn't work either.

This is my Jenkinsfile:

pipeline { agent { node { label "Make Build Server" customWorkspace "$Workspace" } } options { skipDefaultCheckout() } stages { stage('PreBuild'){ steps{ input 'Did you authenticate the server through all the firewalls?' } } stage('Housekeeping'){ steps{ build job: 'Housekeeping' } } } }

Answer1:

When you use the build instruction in a Jenkinsfile, it's telling jenkins you want to build a completely separate job. It is <em>that other job</em> that will need to specify on what agent it will build. If it's a job based on a Jenkinsfile, then that other Jenkinsfile will indicate the agent. If it is a freestyle job, likewise. So the thing you were expecting--that the other job build on the agent you specified in the "parent Jenkinsfile"--is reasonable, but is not the way it works.

Hope this helps!

Recommend

  • post equivalent in scripted pipeline?
  • Job DSL to create “Pipeline” type job
  • Passing 'build with parameters' to Jenkinsfile from scm in pipeline
  • Jenkins Multibranch Pipeline workspace configuration
  • What determines the default startup project?
  • Can I use a variable on the same line it is declared in this factory in C++?
  • Generating random unique data takes too long and eats 100% CPU
  • Deploying Tizen app to Gear S2: Non trusted certificate is used
  • lein uberjar doesn't pack the jar file under resource into the final jar
  • Gradle test fails with NullPointerException
  • How to import Navit into Eclipse and use it in own android project
  • Build Matrix of Comparisons in SQl Server
  • Mapping two workspace folders to the same working directory
  • Any nice way to generate a timeline view of commits from subversion?
  • python: forcing relative imports to search from script file
  • Jenkins Grails plugin does not list lastest versions of Grails
  • Synchronize windows folders
  • Django model for a Postgres view
  • Iron Router: How do I send data to the layout?
  • How can I get the full list of running processes on a Mac from a python app
  • Defined variables not working in javascript files when I use getScript
  • Trouble saving JSON data for use by multiple UIViews [duplicate]
  • How to generate and display a QR Code in ionic 2
  • Connect .sks to skscene.h
  • Record samples being played with OpenAL
  • MongoDB in PHP using aggregate to group by _id is null not working
  • CSS Linear-gradient formatting issue accross different browsers
  • Why is an OPTIONS request sent to the server?
  • Spring security and special characters
  • Deleting and Updating values from a cusrsor adapter
  • How would I use PHP exceptions to define a redirect?
  • Modifying destination and filename of gulp-svg-sprite
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Do create extension work in single-user mode in postgres?
  • R: gsub and capture
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • Comma separated Values
  • retrieve vertices with no linked edge in arangodb
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How to load view controller without button in storyboard?