[JIRA] (JENKINS-57458) Trigger job by creation of new p4 labels

14 views
Skip to first unread message

jenkins.io@matthew-dews.com (JIRA)

unread,
May 14, 2019, 10:20:02 AM5/14/19
to jenkinsc...@googlegroups.com
Matthew Dews created an issue
 
Jenkins / New Feature JENKINS-57458
Trigger job by creation of new p4 labels
Issue Type: New Feature New Feature
Assignee: Unassigned
Components: p4-plugin
Created: 2019-05-14 14:19
Priority: Minor Minor
Reporter: Matthew Dews

I'd like to accomplish the following:

  • Create a new label in Helix
  • Jenkins job picks up that a new label was created and does a build at that label/changelist
  • Other submissions do not trigger the job to run

As far as I can tell there's no way to accomplish this with the current features of P4 Jenkins. Is that correct or is there something I'm missing?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kwirth@perforce.com (JIRA)

unread,
May 14, 2019, 11:27:02 AM5/14/19
to jenkinsc...@googlegroups.com
Karl Wirth commented on New Feature JENKINS-57458
 
Re: Trigger job by creation of new p4 labels

Hi Matthew Dews. You could possibly do this with a paramaterized job and Perforce command triggers.

(1) Create  a Jenkins job that takes label as a parameter and builds at that label.

(2) Create a post command trigger on 'tag' and 'label' that fires starts the job passing the label as the paramater.

Note: The difficult part of this solution is deciding what paths to build. If your the label contains the exact paths to build you could use that to build up the workspace.

More on Perforce command triggers can be found here:

   https://www.perforce.com/manuals/p4sag/Content/P4SAG/scripting.triggers.order.html

And below is a really simple script I have used in the past to fire a Jenkins job:

$ cat /scripts/fire_jenkins_job.py 
import jenkins
import sys
url = 'JenkinsServer:8080'
job = 'Freestyle_Paramaterized'
j = jenkins.Jenkins(url)
j.build_job(job, parameters={'LABEL':'label1'})

kwirth@perforce.com (JIRA)

unread,
May 14, 2019, 11:27:02 AM5/14/19
to jenkinsc...@googlegroups.com
Karl Wirth assigned an issue to Karl Wirth
 
Change By: Karl Wirth
Assignee: Karl Wirth

kwirth@perforce.com (JIRA)

unread,
May 14, 2019, 11:30:02 AM5/14/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Labels: P4_SUPPORT

kwirth@perforce.com (JIRA)

unread,
May 21, 2019, 7:53:01 AM5/21/19
to jenkinsc...@googlegroups.com
 
Re: Trigger job by creation of new p4 labels

Hi Matthew Dews - Were you able to test this. Did it work?

jenkins.io@matthew-dews.com (JIRA)

unread,
May 21, 2019, 10:24:01 AM5/21/19
to jenkinsc...@googlegroups.com

Hi Karl Wirth, I have not had a chance to try this out yet and based on current priorities don't have plans to. This feature request came out of someone migrating their build process to Jenkins and asking if a "label, then build" workflow was possible. I think a "build, then label" workflow which p4 Jenkins already supports is a better fit for us since it is less maintence for our Helix/Perforce admins.

kwirth@perforce.com (JIRA)

unread,
May 22, 2019, 12:02:02 PM5/22/19
to jenkinsc...@googlegroups.com
Karl Wirth updated an issue
Change By: Karl Wirth
Labels: P4_SUPPORT P4_BACKLOG

kwirth@perforce.com (JIRA)

unread,
May 22, 2019, 12:02:02 PM5/22/19
to jenkinsc...@googlegroups.com
Karl Wirth commented on New Feature JENKINS-57458
 
Re: Trigger job by creation of new p4 labels

Hi Matthew Dews, Thanks for the feedback. I agree that build then label is the use case we regularly see. I will pass this onto the devs to record the request.

kwirth@perforce.com (JIRA)

unread,
May 22, 2019, 12:02:02 PM5/22/19
to jenkinsc...@googlegroups.com
Karl Wirth assigned an issue to Unassigned
 
Change By: Karl Wirth
Assignee: Karl Wirth
Reply all
Reply to author
Forward
0 new messages