Creating an Agent
Scenario
An agent is installed on a host and registered with CodeArts. It is used for code check and build tasks as a custom executor.
- Install only one agent on a host. If multiple agents are installed, some of them may go offline during task execution.
- Each agent executes only one task at a time.
Prerequisites
- You have the owner or administrator permission for the target agent pool.
If you create an agent in the LA-Sao Paulo1 and LA-Santiago regions as an IAM Identity Center user (a user created in the IAM Identity Center), use the AK/SK of an IAM user who has at least the administrator permission.
- An agent pool has been created.
- A host that meets the following requirements is available:
- Specifications: 4 vCPUs | 8 GiB or above, disk space > 80 GiB
- Java 8 and Git are installed. If the agent pool type is LINUX_DOCKER, Docker must also be installed.
- If you use a Linux host, you can choose auto agent installation, or manually install the agent using the root account.
- If you use a Windows or macOS host, manually install the agent on it using the system administrator account.
- If you use a Windows host, install 64-bit Java 8.
- The host can access the public network.
Creating an Agent
- Go to the CodeArts homepage.
- Log in to the CodeArts console, click , and select a region.
- Click Access Service.
- Click the username on the navigation bar and choose All Account Settings.
- Choose Agent Pool > Agent Pool.
- Find the target agent pool in the agent pool list and click its name to display the Agents tab.
- Click Create Agent.
- Configure parameters as required.
- Configure the network environment for the host.
Table 1 Configuration 1 Configuration Item
Description
Install a JDK automatically
The host must have a Java 8 (or later) environment.
After this function is enabled, JDK is automatically installed in the /usr/local directory of the host.
If this function is disabled, you need to install it manually. Learn how to install Java 8.
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
Install Git automatically
The host must have a Git environment.
After this function is enabled, Git is automatically installed on the host.
If this function is disabled, you need to install it manually. Learn how to install Git.
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
Install Docker automatically
The host must have a Docker environment.
After this function is enabled, Docker is automatically installed in the /usr/bin directory of the host. After the installation is complete, the service is automatically registered and the Docker service is started.
If this function is disabled, you need to install it manually. Learn how to install Docker.
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
Restart Without Re-registration
If this feature is enabled, the agent process will be automatically registered as a Linux system service that resumes when the host restarts. You do not need to create a new agent process.
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
- Configure authentication information.
Table 2 Configuration 2 Configuration Item
Description
AK
Access key ID.
Obtain the value from the access key file downloaded by referring to Obtaining an AK/SK.
SK
Secret access key.
Obtain the value from the access key file downloaded by referring to Obtaining an AK/SK.
Agent Name
Agents with the same name cannot be installed on the same host.
Set this parameter based on the site requirements. To facilitate management, it is recommended that the name be clear and associated with the agent IP address, such as 10.10.10.10-agent-01.
Agent Workspace
The working directory where the agent runs on the host and the workspace where tasks are executed. Different agents of the same host cannot use the same agent workspace.
For easy management, specify a data disk. Example:
- Linux: /opt/cloud/agent01
- Windows: C:/opt/cloud/agent01
- macOS: /opt/cloud/agent01
To ensure successful installation, do not use temporary AK/SK.
- Generate a command.
Set the parameters, agree to the statements, and click Generate Command. The command for installing the agent is automatically generated in the command box.
Click Copy Command.
- Configure the network environment for the host.
- Log in to the host and run the copied installation command.
- Linux host: Log in using the root account and then run the installation command.
- Windows host: Log in as the administrator, open Git Bash, and then run the installation command.
- macOS host: Log in using the root account and then run the installation command.
If the following message is displayed, the installation is complete.Figure 1 Successful installation
- Return to the Agents tab and close the dialog box.
After 10 to 30 seconds, refresh the page and check the Status column. If the status becomes Idle, the installation is successful.
Follow-up Operations
After creating agents, you can perform the following operations on them.
Operation |
Description |
---|---|
Viewing the agent list |
On the Agents tab, view the agent status, memory usage, and available disk space. There are five states:
|
Enabling/Disabling an agent |
On the Agents tab, click in the Operation column of the target agent to disable it. The status changes to Disabled. To enable the agent, click . The status changes to Idle. |
Deleting an agent |
NOTE:
|
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