Checking Code with Custom Executors
Scenario
You can register your own executors with CodeArts Check to schedule and execute check tasks. This section describes how to use a custom executor to check code from CodeArts Repo.
This practice depends on CodeArts Repo to store the code.
Constraints
- To use your custom executors, contact technical support.
- You have permissions for CodeArts Repo.
Resource and Cost Planning
In this practice, you need to purchase an ECS as a custom executor. For details about the price of an ECS, see Price Calculator.
Prerequisites
- You have purchased an ECS.
NOTE:
Only EulerOS 2.5 is supported for custom executors.
- You have installed Git-LFS on the custom executor. If not, install it by referring to the following command-based example.
Run the following commands on the executor:
# Download wget -O git-lfs.tar.gz https://github.com/git-lfs/git-lfs/releases/download/v3.4.1/git-lfs-linux-amd64-v3.4.1.tar.gz # Decompress the package tar -zxvf git-lfs.tar.gz # Open the directory generated after the decompression cd git-lfs-3.4.1 # Run the installation script sh install.sh # Verify git lfs version
- You have attached an EVS disk.
Procedure
Step |
Description |
---|---|
Create a project. |
|
Create a pool of custom executors (agent pool). |
|
Create a repository to store code. |
|
Configure the task to use the custom executor. |
|
View the check logs to verify the executor used for the task. |
Creating a Project
- Log in to the Huawei Cloud console.
- Click
in the upper left corner and choose from the service list.
- Click Access Service. The homepage of CodeArts is displayed.
- Click Create Project, and select the Scrum template.
- Set the project name to check-bestpractice and keep the default values for other parameters.
- Click OK to access the project.
Creating an Agent Pool
- On the navigation bar, click the username
and choose All Account Settings.
- Choose .
- Click Create Pool. In the displayed dialog box, set parameters according to Table 2 and click Save.
Table 2 Agent pool configuration Parameter
Description
Pool Name
Assign a custom name to the pool, for example, custom_pool.
Pool Type
Select LINUX_DOCKER. When a task is initiated, a Linux Docker container will be started to run the task.
Description
(Optional) Enter additional information to describe the pool.
This pool can be used by all users of the current account.
(Optional) Selecting this option allows all users within the current account to use the pool.
- Click the name of the new pool (custom_pool is used in this practice). The pool configuration page is displayed.
- Click Create Agent. In the displayed dialog box, configure the agent according to Table 3 and leave the other parameters as default.
Table 3 Parameters for creating an agent Parameter
Description
Install Docker
Selecting this option mandates Docker installation.
Install Docker automatically
Toggling on the switch will automatically install Docker.
AK
SK
Agent Name
Assign a custom name to the agent, for example, agent_test_custom.
Agent Workspace
Enter an agent workspace that follows the standard Linux directory structure. For example, /opt/agent_test_custom.
- Select the check box to confirm that you have read and accept the agreements. Then click Generate Command and Copy Command. Click Close.
Figure 1 Creating an agent
- Go to the ECS list page, find the row of the ECS purchased to meet prerequisites, click Remote Login, and run the command copied in 6, as instructed by Step 3.
- On the agent list page, click Refresh List. After the information is automatically synchronized in the background, a new item will be added to the list. The agent alias is agent_test_custom-mwlye1NlLG.
Creating a CodeArts Repo Repository
- On the navigation bar, choose . The CodeArts Repo homepage is displayed.
- Click New Repository. On the displayed page, expand the Project drop-down list and select the project name you specify when creating a project. Then, select Template as the repository type. Click Next.
- On the template selection page, select the Java Maven Demo template and click Next.
- On the displayed page, set Repository Name to custom_repo, select Automatically create Check task, and leave the other parameters as default. Click OK.
Figure 2 shows the directory that stores files of the code repository.
Configuring and Executing a Check Task
- In the navigation pane, choose . The task is displayed on the task list page, because you have selected Automatically create Check task when creating a cloud repository in CodeArts Repo.
- Click the task name. On the displayed page, choose Settings > Custom Environment.
- In the Execution Host area, select Self-Hosted.
- Expand the drop-down list and select custom_pool you created in Creating an Agent Pool.
- Click Save and click Start Check.
Viewing Check Results
Click the task name. On the displayed task details page, click Logs. If the logs contain "Find available executor node:agent_test_custom-mwlye1NlLG," the task is executed by a custom executor. agent_test_custom-mwlye1NlLG is the agent alias mentioned in 8.
Related Operations
- For more configurations, see Configuring a Task.
- For general issues about executing tasks, see General Issues.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot