Helix Plugin for Jenkins Guide (1.11.x)

p4approve: P4 ApproveImpl Review

Helix Swarm required. Used to set the Swarm review state when the build completes.

Example p4approve: P4ApproveImpl Review configuration

Image of example Snippet Generator p4approve: P4 ApproveImpl Review

Example generated script for p4approve: P4 ApproveImpl Review

The form above generates the following script snippet:

p4approve( 
    credential: 'publicperforcecom1666', 
    description: 'Updated by Jenkins. Build: ${BUILD_URL}', 
    review: '${P4_REVIEW}', 
    status: 'REVIEW'
)
Tip

If you manually edit your script, remember to keep the single quotes that the snippet generator puts around the variables. Replacing them with full quotes " will expand the variables early and the script will fail. For more information about this, see Variable Expansion.

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('SetReview') {
			steps() {
				// set review state to Needs Review when build complete
				p4approve( 
					credential: 'publicperforcecom1666', 
					description: 'Updated by Jenkins. Build: ${BUILD_URL}', 
					review: '${P4_REVIEW}', 
					status: 'REVIEW'
				)
			}
        }
    }
}		

Configure a p4approve: P4ApproveImpl Review script

  1. To create a p4approve: P4 ApproveImpl Review script, select p4approve: P4 ApproveImpl Review from the Sample Step dropdown
  2. Select the credentials for the project from the Perforce credentials dropdown.

  • Perforce Credentials: Select the credentials for Swarm from the Perforce credentials dropdown.
  • Swarm Review: When the build is complete the status of this Swarm review is set according to the value in the Approve Status field. Enter the Swarm review ID number or a custom environment variable ${VAR}. For more information about environment variables, see Variable Expansion.
  • Approve Status: Select the status to set the Swarm review to when the build completes, options are: Needs Review, Needs Revision, Approve, Approve and Commit, Reject, Archive, Vote Up, or Vote Down.
  • Description: Enter the text to add to the Swarm review when its review status is changed. This is usually a mix of common text and one or more environment variables ${VAR}. For more information about environment variables, see Variable Expansion.

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.