p4tag: P4 Tag

Jenkins can tag builds automatically when the build completes. The Tags are stored in the Perforce Helix Core Server as Automatic Labels with the label view based on the workspace at the time of tagging.

Example p4tag: P4Tag configuration

Image of example p4tag: P4 Tag

Example generated script for p4tag: P4 Tag

The form above generates the following script snippet:

p4tag(
    rawLabelDesc: 'Jenkins post-build label.',
    rawLabelName: 'jenkins-Swarm'
)

Paste the script snippet into a basic script

Example: the script snippet above has been pasted into a basic script:

pipeline {
    agent any 
    stages {
        stage('Tag') {
			steps() {
				// tag build when complete
				p4tag(
					rawLabelDesc: 'Jenkins post-build label.',
					rawLabelName: 'jenkins-Swarm'
				)
			}
        }
    }
}		

Configure a p4tag: P4Tag script

To create a P4Tag script, select p4tag: P4 Tag from the Sample Step dropdown

  • Label Name: Enter the label name in the field.
  • Description: Enter a description for the label,

Generate Pipeline Script

To generate the pipeline script, click Generate Pipeline Script. The script is generated in the text box below the button.

Copy the generated script and paste it into the Script box on the Jenkins Pipeline Script page.