Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51581

Add option to override tool config for slave nodes created by EC2 plugin

      When creating Jenkins slave nodes via /jenkins/computer one has the option to override environment variables and tool configurations (i.e. the path to the executable) for the slave. If one does not do this the configuration of the master will be used. 

      The Amazon EC2 Plugin does create slave nodes automatically if none are present at the time a job requests one. But it does so by creating them without overrides, so the master's settings are used. As our AWS slaves are commonly configured differently than our master it is quite annyoing to have to edit the created nodes by hand every time a new one is started. Otherwise Jenkins won't be able to execute the tools as the path is different. 

      Example: tool git
      Master config: /somepath/git/bin/git
      Actual slave location: /usr/bin/git

       

      The same options which are present in the slave node's config (/jenkins/computer/slave-name/config) "Node properties" should be available in the EC2 plugin's AMI section as the paths should usually not differ when using the same AMI. 

          [JENKINS-51581] Add option to override tool config for slave nodes created by EC2 plugin

          George Cimpoies added a comment - - edited

          This is a show-stopper for us as we want to rely solely on aws for our build agents, but we can't define global tool locations since we have many different jobs and configurations on Jenkins.

          With hardware nodes we use swarm plugin + a script like this:

          "$($env:JDK8_PATH)\bin\java.exe" `
              -cp "$($env:USERPROFILE)\slave.jar" `
              -jar "$($env:USERPROFILE)\swarm-client.jar" `
              -fsroot "$($env:USERPROFILE)" `
              -description "$($env:JENKINS_NODE_DESCRIPTION)" `
              -master "$($env:JENKINS_MASTER)" `
              -executors "$($env:JENKINS_NUMBER_OF_EXECUTORS)" `
              -labels "$($env:JENKINS_NODE_LABELS)" `
              --toolLocation "jdk7=$($env:JDK7_PATH)" `
              --toolLocation "jdk8=$($env:JDK8_PATH)" `
              --toolLocation "jdk9=$($env:JDK9_PATH)" `
              --toolLocation "jdk10=$($env:JDK10_PATH)" `
              --toolLocation "jdk11=$($env:JDK11_PATH)" `
          

          to add the tool locations on the node that's connecting to Jenkins.

          George Cimpoies added a comment - - edited This is a show-stopper for us as we want to rely solely on aws for our build agents, but we can't define global tool locations since we have many different jobs and configurations on Jenkins. With hardware nodes we use swarm plugin + a script like this: "$($env:JDK8_PATH)\bin\java.exe" ` -cp "$($env:USERPROFILE)\slave.jar" ` -jar "$($env:USERPROFILE)\swarm-client.jar" ` -fsroot "$($env:USERPROFILE)" ` -description "$($env:JENKINS_NODE_DESCRIPTION)" ` -master "$($env:JENKINS_MASTER)" ` -executors "$($env:JENKINS_NUMBER_OF_EXECUTORS)" ` -labels "$($env:JENKINS_NODE_LABELS)" ` --toolLocation "jdk7=$($env:JDK7_PATH)" ` --toolLocation "jdk8=$($env:JDK8_PATH)" ` --toolLocation "jdk9=$($env:JDK9_PATH)" ` --toolLocation "jdk10=$($env:JDK10_PATH)" ` --toolLocation "jdk11=$($env:JDK11_PATH)" ` to add the tool locations on the node that's connecting to Jenkins.

          George Cimpoies added a comment - Pull request created:  https://github.com/jenkinsci/ec2-plugin/pull/410

            francisu Francis Upton
            skare69 Dominik Heimstädt
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: