Using Workflow to Enforce SCM Policies

If you simply want to automate issue processing and enforce workflow rules for issues of a given type, all you need to do is create and activate a workflow whose condition is based on issue type. No further action is required. For example, if you activate a defects workflow whose condition is Type = Defect, issues with type Defect are automatically subject to the rules in the defects workflow. Issue automation features like stage and transition buttons are then displayed on the Issue Edit form for defects based on the conditions specified in the workflow.

Activating a workflow does not affect which issues can be promoted into or exit from a stream, however. If you want to use a workflow to enforce SCM policies on your streams, you must explicitly specify applicable workflow rules on those streams.

This section describes the different levels of policy enforcement possible with workflow and tells you how to implement them.

Types of Restrictions You Can Define for a Stream

You can use workflow to enforce three types of restrictions for issues in a stream. You can:

  • Restrict a stream to issues of a given type. For example, you might want to allow only Defects in your Maint stream.
  • Restrict a stream to issues in a specific workflow stage. For example, you might want to allow only Defects in the Closed stage in your Build stream.
  • Enforce workflow rules for a specific workflow. For example, you might not care which issues enter your Dev stream (Defects, Enhancements, New Features, and so on), but you might want to ensure that if an issue is an Enhancement that it is in the WIP stage before it is allowed in the stream.

All SCM policy enforcement for a stream is defined using the Workflow Rules dialog box, shown here for the example phoenix_Client stream. The following sections describe how to implement each of these stream restrictions.

About Incomplete Issues

By default, AccuRev allows incomplete issues to be promoted into a stream, regardless of the type of workflow restrictions you define for the stream. You can change this by clearing the Allow incomplete issues in this stream check box at the top of the Workflow Rules for Stream dialog box.

Back to top

Restricting Entry to a Specific Issue Type

Use this procedure when you want to allow only issues of a certain type in the stream.

  1. Create a workflow whose condition is based on issue type.
  2. In the StreamBrowser, right-click the stream for which you want to enforce SCM policies, and choose Workflow Rules from the context menu.

    The Workflow Rules for Stream dialog box appears. The stream name appears in the dialog box title. The workflow rules you specify apply to this stream only.

  3. Optionally, clear the Allow incomplete issues in this stream check box.
  4. In the Choose Workflow field, select the workflow you want to use to enforce SCM policies on this stream and click the Add button.

    A tab displaying options for stream entry and exit rules for the selected workflow appears.

  5. Click the Ok button.

Back to top

Restricting Entry to a Specific Workflow Stage

Use this procedure when you want to allow only issues in a specific workflow stage to be promoted into or promoted out of the stream.

  1. Create a workflow whose condition is based on issue type.
  2. In the StreamBrowser, right-click the stream for which you want to enforce SCM policies, and choose Workflow Rules from the context menu.

    The Workflow Rules for Stream dialog box appears. The stream name appears in the dialog box title. The workflow rules you specify apply to this stream only.

  3. Optionally, clear the Allow incomplete issues in this stream check box.
  4. In the Choose Workflow field, select the workflow you want to use to enforce SCM policies on this stream and click the Add button.

    A tab displaying options for stream entry and exit rules for the selected workflow appears.

  5. To restrict entry into the stream:

    1. Select the Restrict entry to issues in specified workflow stages radio button.
    2. In the When Stage Is... column, click the Click here to add drop-down and select the appropriate workflow stage.
    3. If you want AccuRev to execute a transition when the issue is promoted to this stream, click the Click here to add drop-down in the Perform This Transition... column and select the desired transition.
    4. Optionally, specify workflow rules for additional stages.
    5. To restrict exit from the stream, click the arrow next to the Stream Exit Rules label, and then repeat Step 5.
    6. To specify rules for another workflow on the same stream, return to Step 4.
    7. If you need to delete a workflow rule, click the delete button ().
    8. Click the Ok button.

Back to top

Enforcing Rules for a Specific Workflow

Use this procedure when you want to enforce rules for issues that are subject to a specific workflow, but you do not care about placing restrictions on issues of any other type.

  1. Create a workflow whose condition is based on issue type.
  2. In the StreamBrowser, right-click the stream for which you want to enforce SCM policies, and choose Workflow Rules from the context menu.

    The Workflow Rules for Stream dialog box appears. The stream name appears in the dialog box title. The workflow rules you specify apply to this stream only.

  3. Optionally, clear the Allow incomplete issues in this stream check box.
  4. Select the Allow issues from specified workflows only check box.
  5. In the Choose Workflow field, select the workflow you want to use to enforce SCM policies on this stream and click the Add button.

    A tab displaying options for stream entry and exit rules for the selected workflow appears.

  6. Specify the stream entry and exit rules as described in Step 5 and Step 5 in Restricting Entry to a Specific Workflow Stage.
  7. To specify rules for another workflow on the same stream, return to Step 5.
  8. If you need to delete a workflow rule, click the delete button ().
  9. Click the Ok button.

Back to top