Maintain a Testflinger Agent Host

This guide outlines how to maintain a Testflinger agent host deployed with Juju. To deploy a Testflinger agent host, please read the Deploy a Testflinger Agent Host how-to guide.

Pull latest code from Git

To update the Testflinger code used by the agent host, run the update-testflinger action.

$ juju run <agent-host-charm-unit> update-testflinger

Tip

You can optionally specify a branch to pull by providing the branch parameter. e.g. $ juju run <agent-host-charm-unit> update-testflinger --branch=<branch_name>

Update Agent Configurations

The agent configurations, which are stored in a git repository, are not pulled regularly. To pull any updates to the configurations, run the update-configs action.

$ juju run <agent-host-charm-unit> update-configs

The updated configurations will be applied and the agents will be restarted. If the agents are currently reserved or in a state where they cannot be restarted, then the updated configurations will not be applied until those agents are restarted.

Update TF Scripts

To update the TF scripts used by the agent host, upgrade the charm to the latest version. This will pull the latest TF scripts and apply them to the agent host.

$ juju refresh <agent-host-application>

Monitoring the Agent Host

Note

The following instructions assume you SSH into the agent host charm unit. You can SSH into the unit using juju ssh <agent-host-charm-unit>.

Using supervisorctl on the agent host to check status

The agent host is configured to use supervisorctl to manage the agents. You can run the following command to see the status of all the agents configured inside the charm.

$ sudo supervisorctl status

Viewing the agent logs

To show the logs for a specific agent, run:

$ sudo supervisorctl tail <agent name>

You can also use the -f option to follow the logs.

To show the logs for supervisorctl itself, to see what it’s recently started, stopped, or signalled, you can use:

$ sudo supervisorctl maintail

Stopping and restarting agents

Note

The preferred way to handle agent status is via the CLI by following the instructions in the Handling Agent Status documentation.

You can use the following command to stop a specific agent:

$ sudo supervisorctl stop <agent name>

Be aware that other actions on the charm such as update-configs might later cause this to restart the agents.

To signal an agent to safely restart when it’s no longer running a job, you can run:

$ sudo supervisorctl signal USR1 <agent name>