Creating an Agent
Overview
You can install an agent on a host and connect the host to CodeArts for registration. You can customize execution resource connection.
Creating an Agent
- After completing the operations described in Creating an Agent Pool, find the target agent pool in the agent pool list and click its name to display the Agents tab page.
- Click Create Agent. A dialog box is displayed.
- 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, the JDK is automatically installed in the /usr/local directory of the host.
If this function is disabled, you need to manually install a JDK. Learn how to install Java 8 or above.
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 manually install Git. Learn how to install Git.
NOTE:This configuration item is displayed only when the agent pool type is LINUX or LINUX_DOCKER.
Install Docker
The host must have a Docker environment.
After this function is enabled, the 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 manually install Docker. Learn how to install Docker.
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
- 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 installation command copied in the previous step.
- 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 page and close the dialog box.
After 10 to 30 seconds, check the status of the installed agent instance on the Agents tab page. If the status is Idle, the installation is successful.
Follow-up Procedure
- View the agent list.
In the agent pool list, find the target agent pool and click its name to display the Agents tab page.
The agent list displays the agent status, memory usage, and available hard disk space.
An agent can be in any of the following states:
Table 3 Agent states Agent Status
Description
Running
The agent is performing tasks.
Idle
The agent is connected, and no tasks are running.
Disabled
The agent is connected, but is disabled to perform tasks.
Offline
The agent is disconnected. If you want it to go online, log in to the agent to re-register. Otherwise, you can delete the agent.
Deleting
The agent is being deleted.
- Delete an agent.
- Start or stop the agent.
On the Agents tab page, click in the Operation column to disable the agent. After the agent is disabled, the status changes to Disabled. Click to enable the agent again and the status changes to Idle.
- View pool details.
On the Agents tab page, click the Pool Details tab to view information including the owner, pool type, creation time, and description.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.