> ## Documentation Index
> Fetch the complete documentation index at: https://docs.incredibuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Line Interface  (CLI)

Last updated on Nov 05, 2024

Some settings can be modified using the command line or scripts. These commands require root user permissions.

## Agent Settings

<Accordion title="View Inline CLI Help">
  ```
  /opt/incredibuild/management/get_agent_params.py help
  ```

  ```
  /opt/incredibuild/management/set_agent_params.py help
  ```
</Accordion>

<Accordion title="Enable/Disable Agents as Helpers">
  ### Get Status

  Run this on any agent to view if an agent is enabled or disabled to participate as a helper in builds (returns true if enabled, false if disabled).

  ```
  /opt/incredibuild/management/get_agent_params.py enable-as-helper
  ```

  ### Set Status

  Run these on any agent to modify enable or disable it's ability to participate as a helper in builds.

  ```
  sudo /opt/incredibuild/management/set_agent_params.py enable-as-helper
  ```

  ```
  sudo /opt/incredibuild/management/set_agent_params.py disable-as-helper
  ```
</Accordion>

<Accordion title="Change Coordinator">
  ### Get Coordinator

  To view the Coordinator that a helper is associated with, run this on any agent machine:

  ```
  /opt/incredibuild/management/get_agent_params.py coordinator
  ```

  ### Set Coordinator

  To change the Coordinator that a helper is associated with, run this on any agent machine. If run on a helper, it will stop any running tasks and reassign them to an available helper or the initiator. If run an Initiator, any builds started by that initiator will be aborted.

  If the new Coordinator is not the same version of Incredibuild as the Agents, the Agents will be automatically upgraded or downgraded.

  ```
  sudo /opt/incredibuild/management/set_agent_params.py coordinator <hostname/IP of new Coordinator>
  ```

  After this is done, you also need [unsubscribe the licenses](/linux/4.15.0/license-standard) on the original Coordinator and resubscribe them on the new Coordinator.

  For example:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py coordinator 192.168.10.50
  ```
</Accordion>

<Accordion title="Maximum Number of Helper Cores">
  ### Get Maximum Number of Local Helpers

  To view the maximum number of available local cores required to start a new build, run this command on any agent machine:

  ```
  /opt/incredibuild/management/get_agent_params.py max-helper-cores
  ```

  ### Set Maximum Number of Local Helpers

  To change the maximum number of cores that an Agent can use when participating in builds, run this command on any agent machine:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py max-helper-cores <number>
  ```

  For example:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py max-helper-cores 64
  ```
</Accordion>

<Accordion title="Minimum Number of Local Helper Cores">
  ### Get Minimum Number of Local Helpers

  To view the minimum number of available local cores required to start a new build, run this command on any agent machine:

  ```
  /opt/incredibuild/management/get_agent_params.py min-local-cores
  ```

  ### Set Minimum Number of Local Helpers

  To change the minimum number of available local cores required to start a new build, run this command on any agent machine:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py min-local-cores <number>
  ```

  For example:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py min-local-cores 8
  ```
</Accordion>

<Accordion title="Proxy for Outgoing External Communication">
  ### Get the Proxy Server for HTTP Communication

  Get the proxy server that will be used for outgoing external HTTP communication from Incredibuild.

  ```
  /opt/incredibuild/management/get_agent_params.py http_proxy
  ```

  ### Set the Proxy Server for HTTP Communication

  Set the proxy server that will be used for outgoing external HTTP communication from Incredibuild. To remove the proxy server, use this command with an empty value:

  ```
  /opt/incredibuild/management/set_agent_params.py http_proxy <URL or empty value>
  ```

  ### Get the Proxy Server for HTTPS Communication

  Get the proxy server that will be used for outgoing external HTTPS communication from Incredibuild.

  ```
  /opt/incredibuild/management/get_agent_params.py https_proxy
  ```

  ### Set the Proxy Server for HTTPS Communication

  Set the proxy server that will be used for outgoing external HTTPS communication from Incredibuild. To remove the proxy server, use this command with an empty value:

  ```
  /opt/incredibuild/management/set_agent_params.py https_proxy <URL or empty value>
  ```

  ### Get No Proxy Exceptions

  To get the list of IP addresses, hostnames, and domains that bypass your proxy, use the following command:

  ```
  sudo /opt/incredibuild/management/get_agent_params.py no_proxy
  ```

  ### Set No Proxy Exceptions

  To set the list of IP addresses, hostnames, and domains that bypass your proxy, use the following command:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py no_proxy <comma separated list>
  ```

  For example:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py no_proxy 192.54.3.22,192.78.54.230
  ```
</Accordion>

<Accordion title="Maximum Initiator Cores">
  ### Get Maximum Initiator Cores

  To view the maximum number of cores that can be used by the agent when acting as the Initiator of a build, run this on any agent:

  ```
  /opt/incredibuild/management/get_agent_params.py max-initiator-cores
  ```

  ### Set Maximum Initiator Cores

  To set the maximum number of cores that can be used by the agent when acting as the Initiator of a build, run this on any agent:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py max-initiator-cores <number of max initiator cores>
  ```

  For example:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py max-initiator-cores 16
  ```
</Accordion>

<Accordion title="Build Cache">
  These commands control the Build Cache settings on Initiator machines.

  ### Get Local Build Cache Information

  Return information about the location and size of your local build cache:

  ```
  /opt/incredibuild/management/build_avoid_cache.sh <user|shared|group='groupname'> info
  ```

  ### Set Local Build Cache Size

  Set the local build cache size. By default, the size is 100GB:

  ```
  /opt/incredibuild/management/build_avoid_cache.sh <user|shared|group='groupname'> set_size <size in GB>
  ```

  ### Get Build Cache Service

  You can retrieve the default Build Cache Service used by an Initiator. This service is used for shared Build Cache.

  ```
  sudo /opt/incredibuild/management/get_agent_params.py build-cache-service-URL
  ```

  ### Set Build Cache Service

  You can set the default Build Cache Service used by an Initiator. This service is used for shared Build Cache.

  ```
  sudo /opt/incredibuild/management/set_agent_params.py build-cache-service-URL http://<agent IP or hostname>:<port>
  ```

  For example:

  ```
  sudo /opt/incredibuild/management/set_agent_params.py build-cache-service-URL http://linux_lab_machine2:8080
  ```

  To unset this parameter, call it with the value "":

  ```
  sudo /opt/incredibuild/management/set_agent_params.py build-cache-service-URL ""
  ```

  ### Clear Build Cache

  Clear the local build cache:

  ```
  /opt/incredibuild/management/build_avoid_cache.sh <user|shared|group='groupname'> clear
  ```
</Accordion>

<Accordion title="Log Location">
  These commands allow you to define a remote location to [store build logs](/linux/4.15.0/log-location).

  ### Get Log Location

  To view what remote location is defined for storing build logs from this agent:

  ```
  /opt/incredibuild/management/get_agent_params.py log-mount-directory
  ```

  ### Set Log Location

  To set the remote location for storing build logs from this agent. The location should already be mounted to a folder on the agent:

  ```
  /opt/incredibuild/management/set_agent_params.py log-mount-directory <path to mounted remote location>
  ```
</Accordion>

## Coordinator Settings

<Accordion title="Build Groups">
  ### Create Build Group

  Run this on your Primary Coordinator to create a new Build Group.

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group create [group name]
  ```

  For example:

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group create devteam5
  ```

  ### Delete Build Group

  Run this on your Primary Coordinator to Delete a Build Group.

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group delete [group name]
  ```

  For example:

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group delete devteam5
  ```

  ### Get All Build Groups

  Run this on your Primary Coordinator to return a list of all Build Groups in JSON format.

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group list
  ```

  ### Get List of Agents in Build Group

  Run this on your Primary Coordinator to returns a list of all Agents (in JSON) assigned to the specified Build Group.

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group agents [group name]
  ```

  For example:

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group agents devteam5
  ```

  ### Set Build Group

  Run this on your Primary Coordinator to assigns an Agent to an existing Build Group.

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group assign [group name] [agent IP or name]
  ```

  For example:

  ```
  sudo /opt/incredibuild/ctl/coordinator build-group assign devteam5 22.33.44.55
  ```

  ### Get Build Group

  To view what Build Group an agent is in, run this on the agent:

  ```
  /opt/incredibuild/management/get_agent_params.py build-group
  ```
</Accordion>

<Accordion title="Show License">
  Returns license information in JSON format including: GUID, name, expiration date, number of server cores and SUVM cores.

  ```
  /opt/incredibuild/ctl/coordinator license show
  ```
</Accordion>

<Accordion title="Get License Usage">
  Returns the total number of cores and the total number of available (unsubscribed) cores for each type of license (server \ SUVM).

  ```
  /opt/incredibuild/ctl/coordinator license usage
  ```
</Accordion>

<Accordion title="Create License Key File">
  Creates a key file (.pk) for the coordinator in the given path with the given name (should have .pk extension). This is required to generate a first license or renew an existing license (similar to the UI option to generate key file).

  ```
  /opt/incredibuild/ctl/coordinator license key-file <file path with file name>
  ```

  For example:

  ```
  /opt/incredibuild/ctl/coordinator license key-file /var/Incredibuild/ib-key.pk
  ```
</Accordion>

<Accordion title="Load License">
  Loads the specified license file. If the coordinator already has a valid license, this will replace it without any downtime to the Grid and running builds. If the load fails for any reason, the CLI will provide an error and revert back to the previous license (if applicable).

  ```
  /opt/incredibuild/ctl/coordinator license load
  ```
</Accordion>

<Accordion title="Unload License">
  Unloads the existing license.

  ```
  /opt/incredibuild/ctl/coordinator license unload
  ```
</Accordion>

<Accordion title="Get Coordinator Type and Status">
  Returns the coordinator type (primary \ secondary) and status (offline, standby, active) in JSON format.

  ```
  /opt/incredibuild/ctl/coordinator status
  ```
</Accordion>

<Accordion title="Secondary Coordinator">
  ### Get Secondary Coordinator IP/Name

  When run on the Primary Coordinator, it returns the IP address or machine name for the Secondary Coordinator (if one is defined).

  ```
  /opt/incredibuild/ctl/coordinator secondary get
  ```

  ### Set Secondary Coordinator

  Sets the specified machine as the Secondary Coordinator for this Primary Coordinator.

  ```
  /opt/incredibuild/ctl/coordinator secondary set <machine name or IP>
  ```

  For example:

  ```
  /opt/incredibuild/ctl/coordinator secondary set 192.168.10.50
  ```

  ### Get Secondary Coordinator Status

  Returns the status of the Secondary Coordinator in JSON format (can be unconfigured, offline, standby, or active)

  ```
  /opt/incredibuild/ctl/coordinator secondary status
  ```
</Accordion>

## Build Cache Service Settings

<Accordion title="Build Cache Service">
  These commands control the Build Cache settings on Build Cache Service machines.

  ### Get Build Cache Size

  To view the Build Cache size (in GB) on the Build Cache Service machine:

  ```
  sudo /opt/incredibuild/management/build_cache_service.py get-size-limit
  ```

  ### Set Build Cache Size

  To set the Build Cache size (in GB) on the Build Cache Service machine:

  ```
  sudo /opt/incredibuild/management/build_cache_service.py set-size-limit <size>
  ```

  For example:

  ```
  sudo /opt/incredibuild/management/build_cache_service.py set-size-limit 150
  ```

  ### Clear Build Cache

  To clear the Build Cache on the Build Cache Service machine:

  ```
  sudo /opt/incredibuild/management/build_cache_service.py clear
  ```

  ### View Build Cache Location

  To view the path where the Build Cache is stored on the Build Cache Service machine:

  ```
  sudo /opt/incredibuild/management/build_cache_service.py get-path
  ```

  ### Get Build Cache Used Size

  To view the currently used size of the Build Cache on the Build Cache Service machine:

  ```
  sudo /opt/incredibuild/management/build_cache_service.py get-used-size
  ```
</Accordion>
