Bug 1400002 - Trigger info doesn't show up for pipeline build if the build is triggered on jenkins
Summary: Trigger info doesn't show up for pipeline build if the build is triggered on ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Build
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 3.x
Assignee: Jimmi Dyson
QA Contact: Wang Haoran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-30 09:11 UTC by Yanping Zhang
Modified: 2017-05-30 12:51 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Trigger info for pipeline builds was not properly set when the build was triggered by jenkins. Consequence: It is not clear what triggered the build. Fix: Trigger info will correctly reflect that jenkins triggered the build. Result: Trigger info for pipeline builds that were triggered from jenkins will reflect that information.
Clone Of:
Environment:
Last Closed: 2017-05-30 12:51:07 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Yanping Zhang 2016-11-30 09:11:22 UTC
Description of problem:
Trigger a pipeline build from jenkins console, then check the pipeline build, there is no trigger info shown for it.

Version-Release number of selected component (if applicable):
# openshift version
openshift v1.5.0-alpha.0+cb9f8d6-116
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0


How reproducible:
Always

Steps to Reproduce:
1.Create Jenkins Pipeline BC
$ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/jenkins-ephemeral-template.json
$ oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.json
$ oc start-build sample-pipeline

2.Check the pipeline build info.
3.Trigger a new pipeline build from jenkins console.
4.Check the new pipeline build info.

Actual results:
2.There is trigger info: Triggered By: Manual build
4.There is no trigger info for the build:
    type: JenkinsPipeline
  triggeredBy: []

Expected results:
4. Should have such info: "Triggered By: Jenkins"

Additional info:

Comment 1 Ben Parees 2016-11-30 19:06:39 UTC
The builds that will get "triggered by jenkins" added are builds that are explicitly launched by the build step from the openshift jenkins plugin.

There's probably an argument that builds created through the flow you've described (which really means builds created by the sync plugin) could/should have that indication as well, but it's not part of the currently expected behavior.

I'm going to assign this to Jimmi but marking upcoming release as it's definitely not a blocker for 3.4.

Comment 2 Jimmi Dyson 2016-12-02 13:30:31 UTC
@bparees Do you think this requires a new `BuildTriggerCause` field or enough to just add a cause with message of `Manually triggered by user in Jenkins` or something?

Comment 3 Ben Parees 2016-12-02 14:41:55 UTC
@jimmi there is a TriggeredBy field on build objects today, here's how we populate it for builds that were triggered by a step in a jenkins job:

   triggeredBy:
    - message: 'Jenkins job URI: https://jenkins-myproject.10.13.137.191.xip.io/job/asdf/1/'

Now that's a bit different from this scenario which is the case where the sync plugin is creating the build because the user requested to run a pipeline job in jenkins (or perhaps because the job definition in jenkins was triggered by something else), it probably makes sense for it to just say something like:

   triggeredBy:
    - message: 'Corresponding Jenkins job was run'


And if you want to know exactly why the correspodning jenkins job was run, you'd have to go look at the job URI (which is already annotated on the build object, as i recall) and see who/what started the job.

Does that seem reasonable?

Comment 4 Jimmi Dyson 2016-12-05 16:14:05 UTC
Fixed in sync plugin v0.1.6. @bparees Shall I assign to @tdawson when it's synced? Assume you're OK to get this in to 3.4 as it's such a tiny update?

Comment 5 Ben Parees 2016-12-05 16:18:59 UTC
Honestly i'd rather just wait for 3.4.1 to produce a new image since QE just finished regression testing on the jenkins image and i don't want to rock the boat.

So it should still get assigned to Troy but the message to Troy is to not worry about packaging this plugin+rebuilding the image for 3.4.

Comment 6 Jimmi Dyson 2016-12-05 19:30:19 UTC
@tdawson Over to you for packaging - no hurry as @bparees explained above, this is for 3.4.1.

Comment 7 Troy Dawson 2017-01-19 23:08:18 UTC
rpm updated:
  jenkins-plugin-openshift-sync-0.1.7-1.el7
images made:
  openshift3/jenkins-1-rhel7:1.651.2-47
  openshift3/jenkins-2-rhel7:2.19-14
rpm is in the 3.4 testing repos
images are in the testing registries.

Comment 8 Ben Parees 2017-01-20 00:07:29 UTC
Troy, when you build the new 3.4 jenkins image, what changes did you pick up?  I'm hoping you only changed the sync plugin...

Comment 9 Yanping Zhang 2017-01-20 06:30:59 UTC
Checked on OCP 3.4.1.0:
jenkins-plugin-openshift-sync-0.1.7-1.el7.x86_64
registry.ops.openshift.com/openshift3/jenkins-2-rhel7              <none>              5119d00f1c73        12 hours ago        678.8 MB

Now there is trigger info when pipeline is triggered by jenkins:
Triggered By:
    Triggered by Jenkins job at https://jenkins-prozyp.0120-5mz.qe.rhcloud.com/job/prozyp-sample-pipeline/

The bug has been fixed, so move it to Verified.


Note You need to log in before you can comment on or make changes to this bug.