Code review is a manual process to optimize production code, improve the code quality of production scheduling tasks, and ensure that code in the production environment meets required standards. You can require a code review before tasks are deployed to the production environment. If mandatory code review is enabled, only tasks that pass the review can be deployed to the production environment.
Overview
In DataWorks, you can enable mandatory code review to prevent task failures caused by non-compliant code, thereby avoiding wasted computing resources. When this feature is enabled, reviewers must rigorously check the code quality of tasks. This prevents code with errors from being deployed without approval.
-
Mandatory review disabled: When you submit a node, you can still manually start a review. However, the node can be deployed regardless of the review outcome.
-
Mandatory review enabled: When you submit a node, you must select a qualified reviewer to perform a code review.
-
If the review is approved, the node proceeds with submission and deployment.
-
If the review is not approved, the node cannot be submitted or deployed. You must modify the code based on the review comments and start a new review. The node can be deployed only after the new review is approved.
-
Limitations
-
The code review feature is available only in DataWorks Professional Edition and later. Make sure that you have activated DataWorks Professional Edition or a later edition. For more information about the features of different editions, see DataWorks editions.
-
Only an Alibaba Cloud account, a Workspace Administrator, or a RAM user with the AliyunDataWorksFullAccess permission can enable or disable code review for a workspace. For more information, see Users, roles, and permissions.
-
You cannot start a code review for special node types, such as composite nodes like do-while and for-each nodes, or for non-Python resource files.
(Optional) Administrator: Enable mandatory code review
A workspace administrator can enable mandatory code review for a workspace on the Data Studio settings page by following the steps below.
-
If mandatory code review is disabled, you can still start a review, but it will not block the deployment process.
-
Deleting a node does not trigger a code review upon submission.
Access Security Settings and Others
Go to the Workspaces page in the DataWorks console. In the top navigation bar, select a desired region. Find the desired workspace and choose in the Actions column.
-
Go to the Data Studio settings page.
-
In the lower-left corner, click the
icon and select Data Studio Settings to open the Data Studio settings page. -
Go to Security Settings and Others.
On the Data Studio settings page, switch to the Security Settings and Others tab.
-
Enable code review
On the Security Settings and Others tab, enable Code Review > Mandatory Review.
If you cannot find the Mandatory Review toggle on the Security Settings and Others tab, check your DataWorks edition. The code review feature is available only in DataWorks Professional Edition and later.
|
Parameter |
Description |
|
Mandatory Review |
Specifies whether a code review is required before tasks in the current workspace are deployed to the production environment. |
|
Project Code Reviewer |
Customize code reviewers.
Note
|
|
Specify Mandatory Code Review Baseline Scope |
Specifies which nodes require a code review upon submission. You can determine which nodes require mandatory code review based on the priority of the baseline to which the nodes belong. The logic is as follows:
Note
When you select non-baseline tasks, all newly created nodes in the workspace require approval. |
|
Code Review Notification Method |
After you enable mandatory review, you can configure fine-grained notification mechanisms to ensure that key information is automatically delivered to relevant personnel:
The following notification methods are supported: SMS, DingTalk Group Robot Webhook, Mail, WeChat Group Webhook, Lark Webhook, and Standard Webhook. Alert SMS messages and phone calls generated by code review are counted toward your alert resource usage. You can view the alert resource usage of the code review module on the Alert Resource page in the management console. For more information, see View alert resource usage. Note
|
Review initiator: Initiate a code review
A code review is triggered when you submit a node. After you select a reviewer, a review ticket is generated. If the administrator has enabled mandatory code review, the deployment process is blocked at the production checker stage. The node can be deployed to the production environment only after the code review is approved.
-
If a node already has an ongoing code review and a new review is initiated, the result of the previous review is automatically invalidated.
-
Deleting a node does not trigger a code review.
-
Deploy the task.
-
Click the
icon to save the data development node that you want to deploy, and then click the
icon to go to the Online publishing content page. -
Click the Start Release Production button to start the deployment. Because mandatory code review is enabled, the deployment process is blocked at the production checker stage. The node can be deployed only after the code review is approved.
-
-
Initiate a code review.
Click Initiate Code Review. On the Code Review configuration page, configure Code Reviewer and Description of change.
Configuration item
Description
Code Reviewer
Select the Project Code Reviewer configured under this control. You can specify one or more code reviewers.
Description of change
Describe the code changes and other relevant information.
After the configuration is complete, click Confirm to submit the code review.
Reviewer: Process a review ticket
A code reviewer can view pending review records and process review tickets in the Code Review List > Reviewed by Me > menu. Go to the code review page. Click the icon in the left-side navigation pane of the Data Studio page to go to the code review list page, where you can view the code review tickets assigned to you. Process a code review ticket. In the Code Review List > Reviewed by Me menu to view pending review records and process review tickets.
-
Go to the code review page.
Click the
icon in the left-side navigation pane of the Data Studio page to go to the Code Review List > Reviewed by Me page, where you can view the menu to view pending review records and process review tickets. Go to the code review page. Click the icon in the left-side navigation pane of the Data Studio page to go to the code review list page, where you can view the code review tickets assigned to you. Process a code review ticket. In the Code Review List > Reviewed by Me code review tickets. -
Process a code review ticket.
On the Code Review List > Reviewed by Me > menu to view pending review records and process review tickets. Go to the code review page. Click the icon in the left-side navigation pane of the Data Studio page to go to the code review list page, where you can view the code review tickets assigned to you. Process a code review ticket. In the Code Review List > Reviewed by Me page, you can view the details of code reviews and perform operations on review tickets.
-
On the code review list page: You can quickly perform the following operations on review tickets: By, Reject, Abandoned, Reopen, and Share.
-
On the code review details page:
-
On the Code Review List > Reviewed by Me page, click the code review ticket that you want to review to go to the Code Review Details page. On this page, you can view the changes in the code and schedule settings compared to the production version, and decide whether to approve the code review.
-
In the review operations section, the reviewer can perform the following review operations on the review ticket:
-
: Approve. -
: Reject. -
: Abandon. -
: Reopen. -
Comments.
-
Note-
Abandoned: Abandon the current review process. After the review is abandoned, the current node version can be submitted and deployed directly.
-
Reopen: If you want to re-review an abandoned review process, you can click Reopen.
After the code review is complete, the review initiator can view the review details and manage review tickets on the Code Review List > Reviewed by Me page.
-
-
Review initiator: View review results
The review initiator can view review results and manage review tickets in the Code Review List > Reviewed by Me > Created by Me menu.
-
Go to the code review page.
Click the
button in the left-side navigation pane of the Data Studio page to go to the code review page, where you can view the Created by Me code review tickets. -
Confirm the review results.
On the Code Review List > Reviewed by Me > Created by Me page, you can view the details of code reviews and perform operations on review tickets.
-
On the code review list page: The review initiator can quickly view review results and perform the following operations: Abandoned, Reopen, or Share.
NoteAbandon the current review process. After the review is abandoned, the current node version must be submitted for review again or the review ticket must be reopened before the deployment process can continue.
-
On the code review details page: On the Code Review List > Reviewed by Me page, click the corresponding code review ticket to go to the Code Review Details page, where you can decide whether to Reopen or Abandoned the code review.
-
-
If the review is not approved, the node cannot be submitted or deployed. You must modify the code based on the review comments and start a new review. The node can be deployed only after the new review is approved.
Next step
After the code review is approved, you can proceed with the deployment process. If the code review is not approved, you can adjust the code based on the review comments and initiate a new code review.