Authentication using Testflinger CLIΒΆ

Authentication is required for submitting jobs with priority, submitting jobs to a restricted queue, reserving a machine for longer than 6 hours or using secrets. Authentication is also necessary to change an agent status, but this is limited to admin users only. For more information, please refer to Testflinger Agents.

Authenticating with Testflinger server requires a client id and a secret key. These credentials can be provided to the CLI using the environment variables TESTFLINGER_CLIENT_ID and TESTFLINGER_SECRET_KEY. You can put these variables in a .env file:

TESTFLINGER_CLIENT_ID=my_client_id
TESTFLINGER_SECRET_KEY=my_secret_key

You can then export these variables in your shell:

set -a
source .env
set +a

With these variables set, you can testflinger_cli submit your jobs normally, and the authentication will be done by the CLI automatically.

Alternatively, you can set the client id and secret key using command line arguments:

$ testflinger-cli submit example-job.yaml --client_id "my_client_id" --secret_key "my_secret_key"

However, this is not recommended for security purposes.

Tip

You can also authenticate by running testflinger-cli login with or without additional command line arguments. Upon successful authentication with login or any authenticated command, testflinger-cli will cache credentials and authenticate automatically without requiring client_id and secret_key until the cached credentials expire.