$ anypoint-cli-agent-fabric-plugin conf client_id myClientID $ anypoint-cli-agent-fabric-plugin conf client_secret myClientSecret $ anypoint-cli-agent-fabric-plugin conf organization myOrgId
Build Agent Networks in a CI/CD Environment
If you run operations within a CI/CD environment, you can use Anypoint CLI’s Agent Fabric plugin to set up, create, build, publish, and deploy agent networks. For more information, see Anypoint CLI Agent Fabric Plugin.
Before You Begin
Make sure you meet the prerequisites for this task. For prerequisites, see Get Started with Agent Networks.
Install the Anypoint CLI Agent Fabric plugin by running this command in a terminal window:
npm i anypoint-cli-agent-fabric-plugin
Authentication
You can authenticate to Anypoint Platform through the command line by running the anypoint-cli-agent-fabric-plugin
command with a combination of parameters.
Or, you can set a combination of environment variables before running the anypoint-cli-agent-fabric-plugin
command. For more information, see Command-Line Parameters and Environment Variables.
Set configuration file authentication using a client ID and client secret from your connected app.
Add authentication values to the configuration file using these commands.
For more information, see Authentication to the Anypoint Platform CLI.
Create a Target Space for Your Environment
To deploy an agent network, you’ll need a target space, if you don’t have one already.
You can either create a private space for CloudHub 2.0 deployment or a namespace for Runtime Fabric. For more information about Runtime Fabric deployments, see Creating Namespaces for Application Deployments.
Create a Private Space for CloudHub 2.0 Deployment
-
Open Anypoint Runtime Manager.
-
Select the environment to use.
-
Select Private Spaces.
-
Select Create private space.
-
Enter
agent-network-space
or another name in the private space. -
Select Create.
-
Select Create private network.
-
Associate the space with the business group and environments you need to deploy your agent network to. You must complete this step so that the private space appears as a valid deployment target in Anypoint Code Builder and Anypoint CLI.
After you create a target space, set up the ingress and egress gateways for deployment, if you haven’t already done so. For agent networks, at least one small Managed Flex Gateway and one large Managed Flex Gateway is required in your environment. For more information about gateways, see Flex Gateway Deployment Models.
Use the agent-network:setup:gateways
command as specified in the command reference.
CLI for Agent Fabric Plugin Reference
Use these commands to set up gateways and author, publish, and deploy agent network projects.
Command | Description |
---|---|
Builds the agent network project and validates configuration |
|
Creates a new agent network project and generates the initial configuration files |
|
Deploys the agent network project to the target environment |
|
Publishes the agent network project to Anypoint Exchange |
|
Sets up the gateways for the agent network |
agent-network:project:build
> anypoint-cli-agent-fabric-plugin agent-network project build [flags]
Builds the current agent network project using the Maven wrapper (mvnw
or mvnw.cmd
).
This command validates the configuration and generates the artifacts required for publishing and deployment.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Enable debug mode |
|
|
Environment name |
|
|
Force update the dependencies |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Username |
|
$ anypoint-cli-agent-fabric-plugin agent-network project build
agent-network:project:create
> anypoint-cli-agent-fabric-plugin agent-network project create --name <projectName> [flags]
Creates a new agent network project in the current directory.
The command generates a project folder with initial configuration files, including agent-network.yaml
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
(Required) Name of the project |
|
|
Output directory for the project |
|
|
Asset ID (GAV) |
|
|
Asset version (GAV) |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Create a new directory under |
|
|
Environment name |
|
|
Group ID (GAV) |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Tab size for indenting the API specification |
|
|
Username |
|
$ anypoint-cli-agent-fabric-plugin agent-network project create --name my-agent-network
agent-network:project:deploy
> anypoint-cli-agent-fabric-plugin agent-network project deploy [flags]
Deploys the agent network application to the target private space.
By default, the command uses the agent-network-ingress-gw
and agent-network-egress-gw
gateways, and the agent-network-space
private space.
You can override these values using flags.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Name of the target egress gateway |
|
|
Name of the target ingress gateway |
|
|
Name of the target private space to deploy |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Disable tracing functionalities |
|
|
Do not wait for the agent network to be ready |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
One or more deployment properties in |
|
|
Username |
|
|
Format output as JSON |
|
$ anypoint-cli-agent-fabric-plugin agent-network project deploy
agent-network:project:publish
> anypoint-cli-agent-fabric-plugin agent-network project publish [flags]
Publishes the current agent network project to Anypoint Exchange. The command outputs links and details for all created assets.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Enable debug mode |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Username |
|
|
Format output as JSON |
|
$ anypoint-cli-agent-fabric-plugin agent-network project publish
agent-network:setup:gateways
> anypoint-cli-agent-fabric-plugin agent-network setup gateways [flags]
Sets up the agent network environment with the required ingress and egress gateways in the specified target private space. This step is required only if the target space does not already have gateways. In the typical (happy path) workflow, you run it once per target space before the first deployment.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Name of the egress gateway |
|
|
Name of the ingress gateway |
|
|
Name of the target private space where the gateways will be set up |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Username |
|
$ anypoint-cli-agent-fabric-plugin agent-network setup gateways --target-space my-space
agent-network:project:build
> anypoint-cli-agent-fabric-plugin agent-network project build [flags]
Builds the current agent network project using the Maven wrapper (mvnw
or mvnw.cmd
).
This command validates the configuration and generates the artifacts required for publishing and deployment.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Enable debug mode |
|
|
Environment name |
|
|
Force update the dependencies |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Username |
|
$ anypoint-cli-agent-fabric-plugin agent-network project build
agent-network:project:create
> anypoint-cli-agent-fabric-plugin agent-network project create --name <projectName> [flags]
Creates a new agent network project in the current directory.
The command generates a project folder with initial configuration files, including agent-network.yaml
.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
(Required) Name of the project |
|
|
Output directory for the project |
|
|
Asset ID (GAV) |
|
|
Asset version (GAV) |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Create a new directory under |
|
|
Environment name |
|
|
Group ID (GAV) |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Tab size for indenting the API specification |
|
|
Username |
|
$ anypoint-cli-agent-fabric-plugin agent-network project create --name my-agent-network
agent-network:project:deploy
> anypoint-cli-agent-fabric-plugin agent-network project deploy [flags]
Deploys the agent network application to the target private space.
By default, the command uses the agent-network-ingress-gw
and agent-network-egress-gw
gateways, and the agent-network-space
private space.
You can override these values using flags.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Name of the target egress gateway |
|
|
Name of the target ingress gateway |
|
|
Name of the target private space to deploy |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Disable tracing functionalities |
|
|
Do not wait for the agent network to be ready |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
One or more deployment properties in |
|
|
Username |
|
|
Format output as JSON |
|
$ anypoint-cli-agent-fabric-plugin agent-network project deploy
agent-network:project:publish
> anypoint-cli-agent-fabric-plugin agent-network project publish [flags]
Publishes the current agent network project to Anypoint Exchange. The command outputs links and details for all created assets.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Enable debug mode |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Username |
|
|
Format output as JSON |
|
$ anypoint-cli-agent-fabric-plugin agent-network project publish
agent-network:setup:gateways
> anypoint-cli-agent-fabric-plugin agent-network setup gateways [flags]
Sets up the agent network environment with the required ingress and egress gateways in the specified target private space. This step is required only if the target space does not already have gateways. In the typical (happy path) workflow, you run it once per target space before the first deployment.
In addition to the default flags, this command accepts the following flags:
Flag | Description | Example |
---|---|---|
|
Name of the egress gateway |
|
|
Name of the ingress gateway |
|
|
Name of the target private space where the gateways will be set up |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Username |
|
$ anypoint-cli-agent-fabric-plugin agent-network setup gateways --target-space my-space