Create a workflow

In this section, we create an example workflow.

  • P4 Code Review workflows can be created by any P4 Code Review user.
  • Shared P4 Code Review workflows can be viewed by any P4 Code Review user.
  • Shared P4 Code Review workflows can be applied to a project or project branch by any P4 Code Review user that is authorized to edit the project.
  • The global workflow can be viewed by any P4 Code Review user but can only be edited by a P4 Code Review user with super or admin privileges, or users that have been made an owner.

Add the example workflow

  1. On the P4 Code Review Workflows page, click the + Add Workflow button.
  2. Enter a name for the workflow:
  3. Optional: provide a description for the workflow.
  4. Image of an example workflow settings page
  5. Rules: Set the workflow rules as follows:

    • On commit without a review set to: Reject.
    • On commit with a review set to: Reject unless approved.
    • On update of a review in an end state set to: Reject.
      The protected end states are globally set by your P4 Code Review administrator, and the default protected end states are Archived, Rejected, and Approve:Commit.
    • Count votes up from set to: Members.
    • Automatically approve reviews set to: Based on vote count.
      The Minimum up vote value is set on the project/branch the workflow is associated with.

  6. You are automatically added as the owner of the workflow.

    Optional: add more owners if required. This field auto-suggests groups, and users within P4 Server as you type (up to a combined limit of 20 entries).

    • A workflow must have at least one owner.
    • If you remove yourself as an owner, you cannot edit this workflow configuration later unless you have super user rights.
  7. Test and confirm that the workflow rules work as expected.

  8. Optional: if you want other P4 Code Review users to be able to use this workflow, select the Shared with others checkbox.

  9. Click Save. The Save button is disabled if any required fields are empty.

  10. Now that you have created a workflow associate the workflow with a project, see Add a workflow to a project/branch.