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

Downstream job not displaying in logs after upstream job is promoted

      When a downstream job is triggered from an upstream promotion via the `Promote builds when... -> Actions -> Trigger parameterized build on other projects`, the name of the triggered downstream job is not displayed in the logs or UI. This makes it hard for users to find the triggered job.

      Steps to reproduce:
      1. Install `promoted-builds` and `parameterized-trigger` plugins
      2. Create a freestyle project
      3. Check `Promote builds when...` in the General section
      4. Set any name, icon, criteria
      5. Add action `Trigger parameterized build on other projects` and select an existing `Project to build`
      6. Save and run the project
      7. After the project is promoted, check the promotion logs under `Promotions Status -> log`
      8. See that nothing is logged about what job was triggered. It only logs `build hudson.plugins.parameterizedtrigger.BuildTrigger`

      Expected Behavior:
      A line in the promotion logs saying what jobs were triggered. Ideally, each job name would be a clickable link that takes you to the job page. Something like: `scheduling build for <JOB_NAME>`

      Actual Behavior:
      Downstream job is successfully triggered, but there is no mention of what job was triggered in the logs or UI. All that is printed to the logs is `build hudson.plugins.parameterizedtrigger.BuildTrigger`.

      Workaround:
      The workaround I came up with is very manual and requires updates if the job name or URL changes:

      • Add a second Action on the promotion of type `Execute Shell`
      • Set the command to be something like `echo "Triggering downstream job: <JOB_NAME> <URL_TO_JOB>"`
      • This will then print the name and URL to the triggered job so the users can find it in the promotion logs for the upstream build

          [JENKINS-54761] Downstream job not displaying in logs after upstream job is promoted

          Devin Nusbaum added a comment -

          As far as I can tell, a line like you are requesting with a URL should be printed out by parameterized-trigger if the build really does get triggered by this code. However, given the weird job hierarchy used in the promoted-builds plugin it might be getting printed to a log of the promotion status or something strange that is hard to find.

          What is the URL for the log that says build hudson.plugins.parameterizedtrigger.BuildTrigger? That might help narrow down the classes that could be producing that message.

          I am happy to help review any changes to implement this improvement, but I do not plan to work on it myself.

          Devin Nusbaum added a comment - As far as I can tell, a line like you are requesting with a URL should be printed out by parameterized-trigger if the build really does get triggered by this code . However, given the weird job hierarchy used in the promoted-builds plugin it might be getting printed to a log of the promotion status or something strange that is hard to find. What is the URL for the log that says build hudson.plugins.parameterizedtrigger.BuildTrigger ? That might help narrow down the classes that could be producing that message. I am happy to help review any changes to implement this improvement, but I do not plan to work on it myself.

          dnusbaum

          The log is located here: http://<JENKINS_MASTER>/job/upstream-job/13/promotion/promtion%202/lastSuccessful/

          This is the full console output:

          Started by user ddewhurst
          Building remotely on shared-ssh-agent (shared docker-cloud ssh docker) in workspace /home/jenkins/ad29aa2f/workspace/upstream-job
          Promoting upstream-job #13
          [upstream-job] $ /bin/sh -xe /tmp/jenkins8487037222432658541.sh
          + echo promotion 2
          promotion 2
          build hudson.tasks.Shell@ce28f6 SUCCESS
          build hudson.plugins.parameterizedtrigger.BuildTrigger@62bd6e03 SUCCESS
          Finished: SUCCESS
          

          Dylan Dewhurst added a comment - dnusbaum The log is located here: http://<JENKINS_MASTER>/job/upstream-job/13/promotion/promtion%202/lastSuccessful/ This is the full console output: Started by user ddewhurst Building remotely on shared-ssh-agent (shared docker-cloud ssh docker) in workspace /home/jenkins/ad29aa2f/workspace/upstream-job Promoting upstream-job #13 [upstream-job] $ /bin/sh -xe /tmp/jenkins8487037222432658541.sh + echo promotion 2 promotion 2 build hudson.tasks.Shell@ce28f6 SUCCESS build hudson.plugins.parameterizedtrigger.BuildTrigger@62bd6e03 SUCCESS Finished: SUCCESS

          Devin Nusbaum added a comment -

          It looks like the message comes from Promotion$RunnerImpl#build. It's not obvious to me why the logs from running the promotions do not show up in the promotion log itself (are they available anywhere?!), and those log lines showing the BuildStep class name and instance are pretty terrible. It looks like the Jenkins core non-parameterized build trigger action is special-cased to print a hyperlink to the build, but we couldn't easily do the same for parameterized-trigger without introducing a circular dependency.

          Devin Nusbaum added a comment - It looks like the message comes from Promotion$RunnerImpl#build . It's not obvious to me why the logs from running the promotions do not show up in the promotion log itself (are they available anywhere?!), and those log lines showing the BuildStep class name and instance are pretty terrible. It looks like the Jenkins core non-parameterized build trigger action is special-cased to print a hyperlink to the build, but we couldn't easily do the same for parameterized-trigger without introducing a circular dependency.

            Unassigned Unassigned
            ddewhurst Dylan Dewhurst
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: