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.
Restricting Entry to a Specific Issue Type
Use this procedure when you want to allow only issues of a certain type in the stream.
- Create a workflow whose condition is based on issue type.
-
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.
- Optionally, clear the Allow incomplete issues in this stream check box.
-
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.
- Click the Ok button.
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.
- Create a workflow whose condition is based on issue type.
-
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.
- Optionally, clear the Allow incomplete issues in this stream check box.
-
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.
-
To restrict entry into the stream:
- Select the Restrict entry to issues in specified workflow stages radio button.
- In the When Stage Is... column, click the Click here to add drop-down and select the appropriate workflow stage.
- 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.
- Optionally, specify workflow rules for additional stages.
- To restrict exit from the stream, click the arrow next to the Stream Exit Rules label, and then repeat Step 5.
- To specify rules for another workflow on the same stream, return to Step 4.
- If you need to delete a workflow rule, click the delete button ().
- Click the Ok button.
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.
- Create a workflow whose condition is based on issue type.
-
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.
- Optionally, clear the Allow incomplete issues in this stream check box.
- Select the Allow issues from specified workflows only check box.
-
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.
- Specify the stream entry and exit rules as described in Step 5 and Step 5 in Restricting Entry to a Specific Workflow Stage.
- To specify rules for another workflow on the same stream, return to Step 5.
- If you need to delete a workflow rule, click the delete button ().
- Click the Ok button.