Creating an Agent
Scenario
An agent is installed on a host and registered with CodeArts. It is used as a custom executor for code check and build tasks.
Agent pools support custom executors running the following OSs.
OS |
Version |
---|---|
CentOS |
CentOS 6 or later |
Debian |
Debian 6.0 or later |
openEuler |
openEuler 19.09 or later |
Ubuntu |
Ubuntu Server 18.04 LTS or later |
Windows |
Windows 7 or later |
Restrictions
- 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.
- To ensure successful installation, do not use temporary AK/SK.
Prerequisites
- An agent pool has been created. For details, see Creating an Agent Pool.
- You must be an agent pool owner or administrator.
If you create an agent 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.
- You have a host that meets the following requirements:
- Specifications: 4 vCPUs | 8 GiB or above, disk space > 80 GiB
- The host can access the public network.
- CodeArts automatically installs Java, Git, and Docker on Linux hosts. You can also manually install them using the root account.
For details about the installation methods, visit the official websites of Java, Git, and Docker.
- If your host OS is Windows or macOS, install Java 8 and Git on the server using a system administrator account.
Creating an Agent
- Go to the CodeArts homepage.
- Log in to the CodeArts console, click
, and select a region where you have enabled CodeArts.
- Click Go to Workspace.
If your account uses the old billing mode (see Old Billing Modes), click Access Service.
- Log in to the CodeArts console, click
- Click the username
on the top navigation bar and choose All Account Settings.
- Choose Agent Management > Agent Pool.
- Find the target agent pool in the agent pool list and click its name to display the Agents tab.
- Click Create Agent.
Figure 1 Creating an agent
- Configure parameters as required.
Table 2 Creating an agent Parameter
Description
Auto Install JDK
Available when the agent pool type is LINUX or LINUX_DOCKER, and enabled by default.
This parameter is optional. Configure it as needed. Once enabled, CodeArts will automatically install JDK on the host.
Auto Install Git
Available when the agent pool type is LINUX or LINUX_DOCKER, and enabled by default.
This parameter is optional. Configure it as needed. Once enabled, CodeArts will automatically install Git on the host.
Install Docker automatically
Available when the agent pool type is LINUX or LINUX_DOCKER.
Enabled by default when the agent pool type is LINUX_DOCKER.
This parameter is optional. Configure it as needed. Once enabled, CodeArts will install Docker on the host and register and start the Docker service.
Restart Without Re-registration
Available when the agent pool type is LINUX or LINUX_DOCKER.
Once enabled, the agent process will be automatically registered as a Linux system service. It will automatically resume and does not need to be created again when the host is restarted.
AK
Your access key ID (AK). For details, see Obtaining an AK/SK.
SK
Your secret access key (SK). For details, see Obtaining an AK/SK.
Agent Name
Agents with the same name cannot be installed on the same host.
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 and executes tasks on the host. Different agents on the same host cannot use the same agent workspace.
Example:
- Linux: /opt/cloud/agent01
- Windows: C:/opt/cloud/agent01
- macOS: /opt/cloud/agent01
- Click the checkbox under Agent Workspace.
- Click Generate Command. The command for installing the agent is automatically generated in the command box.
- Click Copy Command.
- 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 2 Response returned after installation - Return to the Agents page.
Refresh the page after 10 to 30 seconds. If the status becomes Idle, the installation is successful.
There are five agent statuses:
- Running: The agent is running tasks. Agents in this state cannot be deleted.
- Idle: The agent is connected but not running any task.
- Disabled: The agent is connected but cannot run tasks.
- Offline: The agent is disconnected. Log in to reconnect it, or delete it if it is no longer needed.
- Deleting: The agent is being deleted.
Managing Agents
- Go to the CodeArts homepage.
- Log in to the CodeArts console, click
, and select a region where you have enabled CodeArts.
- Click Go to Workspace.
If your account uses the old billing mode (see Old Billing Modes), click Access Service.
- Log in to the CodeArts console, click
- Click the username
on the top navigation bar and choose All Account Settings.
- Choose Agent Management > Agent Pool.
- Find the target agent pool in the agent pool list and click its name to display the Agents tab.
- Locate the target agent and perform the operations listed in the table below as needed.
Table 3 Managing agents Operation
Description
Enabling/Disabling an agent
- Click
in the Operation column to disable the agent. After the agent is disabled, the Status column changes to Disabled.
- Click
in the Operation column to enable the agent. After the agent is enabled, the Status column changes to Idle.
Deleting an agent
WARNING:- The deletion cannot be undone. Exercise caution when performing this operation.
- If you have enabled Restart Without Re-registration when creating an agent, the agent will be automatically re-registered once the host is restarted. To avoid this, log in to the host and run the uninstallation command before deleting the agent.
- Deleting a single agent: On the Agents tab, click
in the Operation column of the target agent to delete it.
- Deleting multiple agents: On the Agents tab, select the target agents and click Batch Delete.
- Click
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