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

Regression in pipeline job features.

    Details

    • Similar Issues:

      Description

      In order to run pipeline scripts from a remote point one could write a script like this:

      curl -X POST "https://jenkins.host/job/my_cool_job/build"
      

      triggering a job on the jenkins server.
      For some good reasons this does not work without autorization, so jenkins returns "Authentication required" which is expected.

      Some time ago it was possible to add an authenticationToken to a pipelineJob, so this would essentially become

      curl -X POST "https://jenkins.host/job/my_cool_job/build" --data "token=MySuperSecretToken"
      

      So everyone in our department could trigger the job by invoking a simple script.
      There is one job for every computer in our department doing some management and thus these jobs change frequently.
      Because of this we are using jobDSL to update and configure all of those jobs. Since the token (and with it scm and concurrentBuild) are deprecated for pipelineJobs now, our infrastructure falls apart.

      So it would be nice if you could redirect us to the appropriate migration paths or reintroduce these features.

        Attachments

          Issue Links

            Activity

            Hide
            jtaboada Jose Blas Camacho Taboada added a comment -

            Hi Markus Baur,

              I am working in this issue, and I'm able to use the curl call to trigger the job nicely.

              Could you confirm the following:

            • the Jenkins version
            • if your instance has security active (Jenkins / Manage Jenkins / Configure Global Security -> enable security checkbox)
            • The Jobs has the Trigger builds remotely active with the same token you are using (Jenkins -> your_job -> Configure -> Build Triggers)
            Show
            jtaboada Jose Blas Camacho Taboada added a comment - Hi Markus Baur ,   I am working in this issue, and I'm able to use the curl  call to trigger the job nicely.   Could you confirm the following: the Jenkins version if your instance has security active (Jenkins / Manage Jenkins / Configure Global Security -> enable security checkbox) The Jobs has the  Trigger builds remotely  active with the same token you are using (Jenkins -> your_job -> Configure -> Build Triggers)
            Hide
            svanoort Sam Van Oort added a comment -

            I've marked this one as "cannot reproduce" because it sounds like the issue is not reproducible, but we can re-open it if you can provide the information to reproduce it and confirm that Jose's information did not resolve it for you. Thanks!

            Show
            svanoort Sam Van Oort added a comment - I've marked this one as "cannot reproduce" because it sounds like the issue is not reproducible, but we can re-open it if you can provide the information to reproduce it and confirm that Jose's information did not resolve it for you. Thanks!
            Hide
            markus_b_b Markus Baur added a comment -

            After some more research I found this issue which also shows my problems. A 1.71 release is highly appreciated.

            Show
            markus_b_b Markus Baur added a comment - After some more research I found this issue which also shows my problems. A 1.71 release is highly appreciated.
            Hide
            jtaboada Jose Blas Camacho Taboada added a comment -

            Hi Markus Baur

             I think you reported this issue, could you please take a look into the comment above regarding configuration and versions?

            Show
            jtaboada Jose Blas Camacho Taboada added a comment - Hi Markus Baur ,   I think you reported this issue, could you please take a look into the comment above regarding configuration and versions?
            Hide
            markus_b_b Markus Baur added a comment - - edited

            Yes of course, but it's already addressed somewhere else.
            jenkins 2.138.1
            Job DSL 1.70

            Error:
            [Pipeline] jobDsl
            Processing DSL script jobs.groovy
            Warning: (jobs.groovy, line 12) concurrentBuild is deprecated
            Warning: (jobs.groovy, line 21) authenticationToken is deprecated
            Warning: (jobs.groovy, line 23) scm is deprecated

            Code:

            
            def job = readFileFromWorkspace('jenkins_jobs/ansible-job-template.groovy')
            
            hosts.each { name ->
                pipelineJob("ansible-${name}") {
                    concurrentBuild(false) // There should never be 2 ansible runs on the same host at the same time
            
                    definition {
                        cps {
                            script(String.format(job, name))    // use the template from above as the script
                            sandbox()                           // run in the groovy sandbox
                        }
                    }
            
                    authenticationToken("super secret token") // Allows the job to be triggered remotely 
            
                    scm {
                        git("ssh://git@***", "develop")
                    }
                }
            }
            
            Show
            markus_b_b Markus Baur added a comment - - edited Yes of course, but it's already addressed somewhere else. jenkins 2.138.1 Job DSL 1.70 Error: [Pipeline] jobDsl Processing DSL script jobs.groovy Warning: (jobs.groovy, line 12) concurrentBuild is deprecated Warning: (jobs.groovy, line 21) authenticationToken is deprecated Warning: (jobs.groovy, line 23) scm is deprecated Code: def job = readFileFromWorkspace( 'jenkins_jobs/ansible-job-template.groovy' ) hosts.each { name -> pipelineJob( "ansible-${name}" ) { concurrentBuild( false ) // There should never be 2 ansible runs on the same host at the same time definition { cps { script( String .format(job, name)) // use the template from above as the script sandbox() // run in the groovy sandbox } } authenticationToken( " super secret token" ) // Allows the job to be triggered remotely scm { git( "ssh: //git@***" , "develop" ) } } }

              People

              • Assignee:
                jtaboada Jose Blas Camacho Taboada
                Reporter:
                markus_b_b Markus Baur
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: