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

Downstream to Upstream Job Build Trigger doesn't work with Github Organization Jobs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • workflow-job-plugin
    • None
    • LTS 2.46.2

      This issue is best explained with an example:

      There is a github organization called 'infra' with two repos:

      • infra/testrepo
      • infra/testrepo2

      These 2 repos are indexed and running in the Github organization job. 

      There is also a normal pipeline job (pipeline-test) created that has 'Pipeline script from SCM' configured, pulling the Jenkinsfile from infra/testrepo2 (so it use the exact same configuration)

       

      infra/testrepo2/blob/master/Jenkinsfile
      properties([pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: 'infra/testrepo/master')])])
      
      node('mynode'){
        echo "foo"
      }
      

      Expected: When 'infra/testrepo/master' is ran, either manually or with SCM trigger in the Github Organization Job, this should trigger 'pipeline-test' and 'infra/testrepo2/master' because of the pipelineTrigger set in the Jenkinsfile above.

      **Note: testrepo2 is built at least once, to pull in the properties and have the trigger be set up, and I see this reflected when clicking 'View Configuration'. (attached build_triggers.jpeg shows that the correct build trigger is present in both pipeline-test and infra/testrepo2/master so the properties did get read in)

      Actual: Running 'infra/testrepo/master' only triggers 'pipeline-test' and not 'infra/testrepo2/master'

       

      in IRC jglick said this may be due to a missed call to 'Trigger.start' somewhere 

          [JENKINS-44218] Downstream to Upstream Job Build Trigger doesn't work with Github Organization Jobs

          Alvin Huang created issue -
          Alvin Huang made changes -
          Summary Original: Downstream to Upstream Job Build Trigger doesn't work with Github Organization Folders New: Downstream to Upstream Job Build Trigger doesn't work with Github Organization Jobs
          Alvin Huang made changes -
          Description Original: This issue is best explained with an example:

          There is a github organization called 'infra' with two repos:
           * infra/testrepo
           * infra/testrepo2

          These 2 repos are indexed and running in the Github organization job. 

          There is also a normal pipeline job (pipeline-test) created that has 'Pipeline script from SCM' configured, pulling the Jenkinsfile from infra/testrepo2 (so it use the exact same configuration)

           
          {code:java|title=infra/testrepo2/blob/master/Jenkinsfile}
          properties([pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: 'infra/testrepo/master')])])

          node('mynode'){
            echo "foo"
          }
          {code}
          *Expected:* When 'infra/testrepo/master' is ran, either manually or with SCM trigger in the Github Organization Job, this should trigger 'pipeline-test' and 'infra/testrepo2/master' because of the pipelineTrigger set in the Jenkinsfile above. Note: testrepo2 is built at least once, to pull in the properties and have the trigger be set up, and I see this reflected when clicking 'View Configuration'. 

          *Actual:* Running 'infra/testrepo/master' only triggers 'pipeline-test' and not 'infra/testrepo2/master'

           

          in IRC [~jglick] said this may be due to a missed call to 'Trigger.start' somewhere 
          New: This issue is best explained with an example:

          There is a github organization called 'infra' with two repos:
           * infra/testrepo
           * infra/testrepo2

          These 2 repos are indexed and running in the Github organization job. 

          There is also a normal pipeline job (pipeline-test) created that has 'Pipeline script from SCM' configured, pulling the Jenkinsfile from infra/testrepo2 (so it use the exact same configuration)

           
          {code:java|title=infra/testrepo2/blob/master/Jenkinsfile}
          properties([pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: 'infra/testrepo/master')])])

          node('mynode'){
            echo "foo"
          }
          {code}
          *Expected:* When 'infra/testrepo/master' is ran, either manually or with SCM trigger in the Github Organization Job, this should trigger 'pipeline-test' and 'infra/testrepo2/master' because of the pipelineTrigger set in the Jenkinsfile above.

          ***Note:* testrepo2 is built at least once, to pull in the properties and have the trigger be set up, and I see this reflected when clicking 'View Configuration'. 

          *Actual:* Running 'infra/testrepo/master' only triggers 'pipeline-test' and not 'infra/testrepo2/master'

           

          in IRC [~jglick] said this may be due to a missed call to 'Trigger.start' somewhere 
          Alvin Huang made changes -
          Attachment New: build_triggers.jpeg [ 37734 ]
          Description Original: This issue is best explained with an example:

          There is a github organization called 'infra' with two repos:
           * infra/testrepo
           * infra/testrepo2

          These 2 repos are indexed and running in the Github organization job. 

          There is also a normal pipeline job (pipeline-test) created that has 'Pipeline script from SCM' configured, pulling the Jenkinsfile from infra/testrepo2 (so it use the exact same configuration)

           
          {code:java|title=infra/testrepo2/blob/master/Jenkinsfile}
          properties([pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: 'infra/testrepo/master')])])

          node('mynode'){
            echo "foo"
          }
          {code}
          *Expected:* When 'infra/testrepo/master' is ran, either manually or with SCM trigger in the Github Organization Job, this should trigger 'pipeline-test' and 'infra/testrepo2/master' because of the pipelineTrigger set in the Jenkinsfile above.

          ***Note:* testrepo2 is built at least once, to pull in the properties and have the trigger be set up, and I see this reflected when clicking 'View Configuration'. 

          *Actual:* Running 'infra/testrepo/master' only triggers 'pipeline-test' and not 'infra/testrepo2/master'

           

          in IRC [~jglick] said this may be due to a missed call to 'Trigger.start' somewhere 
          New: This issue is best explained with an example:

          There is a github organization called 'infra' with two repos:
           * infra/testrepo
           * infra/testrepo2

          These 2 repos are indexed and running in the Github organization job. 

          There is also a normal pipeline job (pipeline-test) created that has 'Pipeline script from SCM' configured, pulling the Jenkinsfile from infra/testrepo2 (so it use the exact same configuration)

           
          {code:java|title=infra/testrepo2/blob/master/Jenkinsfile}
          properties([pipelineTriggers([upstream(threshold: hudson.model.Result.SUCCESS, upstreamProjects: 'infra/testrepo/master')])])

          node('mynode'){
            echo "foo"
          }
          {code}
          *Expected:* When 'infra/testrepo/master' is ran, either manually or with SCM trigger in the Github Organization Job, this should trigger 'pipeline-test' and 'infra/testrepo2/master' because of the pipelineTrigger set in the Jenkinsfile above.

          ***Note:* testrepo2 is built at least once, to pull in the properties and have the trigger be set up, and I see this reflected when clicking 'View Configuration'. (attached build_triggers.jpeg shows that the correct build trigger is present in both pipeline-test and infra/testrepo2/master so the properties did get read in)

          *Actual:* Running 'infra/testrepo/master' only triggers 'pipeline-test' and not 'infra/testrepo2/master'

           

          in IRC [~jglick] said this may be due to a missed call to 'Trigger.start' somewhere 

          Jesse Glick added a comment -

          Possibly related to JENKINS-42446.

          Jesse Glick added a comment - Possibly related to  JENKINS-42446 .
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-42446 [ JENKINS-42446 ]

          Jonathan Drapeau added a comment - - edited

          Still not working in Jenkins ver. 2.89.4 .

          I also see the same thing when looking at the branch configuration of my project B, that it should trigger after project A is successful.

          Jenkinsfile of project B attached.

           

          Jonathan Drapeau added a comment - - edited Still not working in  Jenkins ver. 2.89.4 . I also see the same thing when looking at the branch configuration of my project B, that it should trigger after project A is successful. Jenkinsfile of project B attached.  
          Jonathan Drapeau made changes -
          Attachment New: Jenkinsfile [ 43948 ]

          Could this be related to JENKINS-53148 ?

          Jonathan Drapeau added a comment - Could this be related to JENKINS-53148 ?

          Wen Jiang added a comment - - edited

          Sorry, I didn't see that you've built it before trigger.

          It seems that you need to build the pipeline that will be triggered once before you actually trigger it for the first time. The reason behind this is when you run the pipeline that is going to be triggered, jenkins will read your jenkins file and set the build triggers configuration for you. Hence, when you run the upstream, jenkins will know which pipeline to trigger.

          Wen Jiang added a comment - - edited Sorry, I didn't see that you've built it before trigger. It seems that you need to build the pipeline that will be triggered once before you actually trigger it for the first time. The reason behind this is when you run the pipeline that is going to be triggered, jenkins will read your jenkins file and set the build triggers configuration for you. Hence, when you run the upstream, jenkins will know which pipeline to trigger.

            Unassigned Unassigned
            ahuang Alvin Huang
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: