Jump to content


Creating trigger when a label is applied

label trigger

  • Please log in to reply
2 replies to this topic

#1 mojodev

mojodev

    Newbie

  • 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

P4Reg

    Advanced Member

  • Staff Moderators
  • 98 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
//depot/Jam/MAIN/src/Build.com#6
//depot/Jam/MAIN/src/Jambase#123
//depot/Jam/MAIN/src/Jambase.5#24


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

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 928 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
//stream/main/0.f1#3
//stream/main/1.15#4
//stream/main/1.16#1
//stream/main/1.17#1
//stream/main/1.18#2
//stream/main/2.f1#5
//stream/main/2.f2#4
//stream/main/anewfile#1
//stream/main/anothernewfile#1
//stream/main/bar#2
//stream/main/boo#2
//stream/main/far#2
//stream/main/foo#2
//stream/main/itest.pl#1
//stream/main/itest.txt#1






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