When using Jenkins X we have build packs with Jenkisnfiles using `agent` labels for pod templates and kubernetes plugins like this:

       

      e.g. our build packs use Jenkinsfiles like this:

      https://github.com/jenkins-x/draft-packs/blob/2.1/packs/maven/Jenkinsfile#L2 vs

       

      with 

      agent {   
        label "jenkins-maven"    
      } 

       

      for serverless jenkins we had to create a branch in the build pack like this:

      https://github.com/jenkins-x/draft-packs/blob/prow/packs/maven/Jenkinsfile#L2

       

      using 

          agent any 

       

      It would be awesome to have a CLI argument or environment variable that basically ignores the `agent` setting! Then we won't need to have a separate set of build packs for serverless

       

       

          [JENKINS-54542] allow the `agent` block to be ignored

          Jesse Glick added a comment -

          I do not think you need any help from JFR. In your CasC, just write

          jenkins:
            labelString: jenkins-maven
          

          That should make the master node be treated as having that label.

          In general ignoring the agent block is not a good idea because it can have all sorts of configuration, like a Dockerfile reference or a pod specification. A build run in serverless mode is fundamentally different and you cannot assume that a single Jenkinsfile will work for both modes.

          Jesse Glick added a comment - I do not think you need any help from JFR. In your CasC, just write jenkins: labelString: jenkins-maven That should make the master node be treated as having that label. In general ignoring the agent block is not a good idea because it can have all sorts of configuration, like a Dockerfile reference or a pod specification. A build run in serverless mode is fundamentally different and you cannot assume that a single Jenkinsfile will work for both modes.

          jstrachan could you confirm if adding the label to the Jenkins instance through CasC works for you? Thanks!

          Evaristo Gutierrez added a comment - jstrachan could you confirm if adding the label to the Jenkins instance through CasC works for you? Thanks!

            Unassigned Unassigned
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: