IBM Cloud Docs
Updating agents

Updating agents

Update an agent configuration in the currently selected Schematics region to work directly in your cloud infrastructure. Updating an agent does not validate or deploy your agent. Select the agent version to update. You can analyze the activity logs and recover the update.

Following are the scenarios that you must use agent upgrade.

  • To incorporate the issues, features, or vulnerable images by Schematics. For example, you are using agent version is 1.0.0. If Schematics releases v1.0.x, you can use agent update to upgrade v1.0.0 - v1.1.1.
  • To update an agent metadata such as name, description, tags, resource group, version, and agent_metadata attributes.
  • You can use agent update to revoke the updated version to its existing version.

Agent update cannot be done on a deployed agent through terraform init, terraform plan, and terraform apply on the workspace with the deployed agent.

Before you begin

Review and select your agent version to update.

Updating an agent definition

Update your agent configuration by choosing the cluster and IBM Cloud Object Storage of your choice.

  1. Log in to IBM Cloud console.
  2. Click the Menu icon hamburger icon > Platform Automation > Schematics > Extensions.
    • Select your agent:
      • Select Actions > Edit Agent
      • You can edit the Description, Cluster, COS instance name, COS bucket name, COS bucket region, or Agent version as in the requirement.
  3. Click Update and validate to validate the cluster and IBM Cloud Object Storage configuration.
  4. Click Deploy to redeploy an agent.

Creating an agent definition through CLI

Select the IBM Cloud region where you want to update and manage your agent. Set the CLI region command by running ibmcloud target -r <region>. Select the same region as the location specified on the agent create command. The IBM Cloud Object Storage bucket location must be of the form eu-gb or us-south and not a city name. For more information, see the agent update command.

Example

ibmcloud schematics agent update --id AGENT_ID --location <us-south> --agent-location <us-south> --version <1.0.0> --infra-type <ibm_kubernetes> --cluster-id <cg3fgvad0dak571xxx> --cluster-resource-group <Default> --cos-instance-name <agent-cos-instance> --cos-bucket <agent-cos-bucket> --cos-location <us-east> --resource-group <Default>

Verifying agent update

ibmcloud schematics agent get --id agent-ga-prod-cli-jan-10.soA.cd1c

Updating an agent through API

Follow the steps to update an IAM access token and authenticate with Schematics through the API. For more information, see Update an agent.

You can use the refresh_token to get a new IAM access token if you IAM token is expired.

Example

  curl -X PUT https://schematics.cloud.ibm.com/v2/agents/{agent_id} \-H 'Authorization: Bearer <Auth Key>' -H 'X-Feature-Agents: true' -H 'refresh_token: <refresh_token> ' -d '{
  "name": "AgentName",
  "description": "New Description",
  "resource_group": "Default",
  "tags": [
  "tag1",
  "tag2"
  ],
  "version": "v1.0.0",
  "schematics_location": "us-south",
  "agent_location": "us-south",
  "agent_infrastructure": {
  "infra_type": "ibm_kubernetes",
  "cluster_id": "cluster_id",
  "cluster_resource_group": "Default",
  "cos_instance_name": "blueprint_basic",
  "cos_bucket_name": "sample_bucket_name",
  "cos_bucket_region": "us-east"
  },
  "agent_inputs": [
  {
  "name": "ibmcloud_api_key",
  "value": "<api_key of the account where cluster and cos are present>",
  "metadata": {
  "secure": true
  }
  },
  {
  "name": "ansible_pull_ibmcloud_api_key",
  "value": "jenkins api_key for pulling agents images",
  "metadata": {
  "secure": true
  }
  },
  {   
  "name": "devops_api_key",
  "value": "api_key where you want to create agent and run fvts",
  "metadata": {
  "secure": true
  }
  }
  ],
  "user_state": {
  "state": "enable"
  }
  }'

Verify that the agent definition is created successfully as shown in the output. Record the agent ID for use in subsequent commands. For example, agentb1-gsmforvpc.soA.115c.

Now, run the agent deploy API with the agent ID to update the Schematics workspace that deploys the agent. The agent deploy operation starts both the agent validate, and agent deploy operations to setup the agent.

Syntax

  PUT /v2/agents/<enter your agentID>/deploy HTTP/1.1
  Host: schematics.cloud.ibm.com
  Content-Type: application/json
  Authorization: Bearer 

Agents version history

Find a summary of changes for each version of Schematics Agents. Be sure to keep your Schematics Agents up-to-date so that you can use all the available features.

Schematics Agents version history
Version Release date Changes
1.1.1 23 July 2024 Enhanced the agent deletion timeout period and agent deploy issues are fixed.
1.1.0 19 March 2024 Added support for the Schematics Agents on the Red Hat OpenShift Kubernetes Service.
1.0.0 10 January 2024 Schematics support for agent is generally available (GA) with full production support. For more information, see Release note.

Next steps