Jump to content

Creating trigger when a label is applied

label trigger

  • Please log in to reply
2 replies to this topic

#1 mojodev



  • Members
  • Pip
  • 1 posts

Posted 03 May 2018 - 05:26 AM

We have a requirement of triggering a deployment Jenkins job whenever a label is applied on a branch.

The naming convention of the label doesnt help identify the branch neither there seems to be any command which would help to find out,  which files are part of the label.

Can anyone suggest any other way to tackle this problem? I am not sure if I am missing a command which gives details of the files which are part of the label but havent had any luck yet.

#2 P4Reg


    Advanced Member

  • Staff Moderators
  • 105 posts

Posted 03 May 2018 - 03:11 PM

> a command which gives details of the files which are part of the label but haven't had any luck yet

p4 files @labelname

The output has extra information e.g.

p4 files @jam-2.1.0-mac-export
//depot/Jam/MAIN/src/Build.com#6 - edit change 289 (text)
//depot/Jam/MAIN/src/Jambase#123 - edit change 308 (text)
//depot/Jam/MAIN/src/Jambase.5#24 - edit change 182 (text)

To output just the file#rev you can use the -F formatting option e.g.:

p4 -ztag -F "%depotFile%#%rev%" files @=jam-2.1.0-mac-export

You can read more about the -F option here in the following blog post https://www.perforce.../fun-formatting and in this Knowledge Base article Formatting p4 command output using the -F global option with examples

#3 Sambwise


    Advanced Member

  • Members
  • PipPipPip
  • 1192 posts

Posted 03 May 2018 - 04:32 PM

The -F flag also works with standard messages (which means you don't have to manually format the #rev yourself OR remember to specify -ztag):

C:\Perforce\test>p4 -F %depotFile%%depotRev% files @label

Also tagged with one or more of these keywords: label, trigger

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users