openqa-cli cheat sheet


openqa-cli is a command-line utility for interacting with openQA. The tool is versatile and allows you to control and interact with an arbitrary openQA instance from the comfort of your command line. While the internal help is quiet comprehensive, I list some of the most basic tasks in the form of a tutorial or knowledge base here.

Within this page the hostname duck-norris.host refers to a custom openQA instance. Replace it with your own hostname.

I use job id 1234 as an example ID. Replace with the actual job ID.

Scroll down to see some common pitfalls and troubleshooting when interacting with the CLI.

How do I …

… show the help message for using the API?

openqa-cli api --help                                # Show help

… get a job’s state?

openqa-cli api jobs/1234
openqa-cli api --host http://duck-norris.host jobs/1234

… restart a job?

openqa-cli api -X POST --host http://duck-norris.host jobs/1234/restart

Restart a job but not its directly chained parents

openqa-cli api --host http://duck-norris.host -X POST jobs/1234/restart skip_parents=1

… cancel job?

openqa-cli api -X POST --host http://duck-norris.host jobs/1234/cancel

… start/post a new job?

openqa-cli api --host http://duck-norris.host -X POST isos ARCH=x86_64 DISTRI=sle ...

This is often referred to as “isos post” because it has been used to test an ISO image. Nowadays we are also testing non-iso images

Post a new job with json parameters

To post a job with settings from a json file

openqa-cli api --host http://duck-norris.host --data-file FILE.json --form -X POST isos

The parameters DISTRI, VERSION, ARCH and FLAVOR are then taken from the json file. The FILE.json looks like the following:

{
    "DISTRI": "opensuse",
    "VERSION": "tumbleweed",
    "ARCH": "x86_64",
    "FLAVOR": "GCE-Updates",
    "IMAGE_ID": "image-test12345",
    "IMAGE_BASE": "publiccloud_tools.qcow2"
    "INCIDENT_ID": 12345,
    "BUILD": ":12345:kernel",
    "_OBSOLETE": "1",
}

… delete a job?

openqa-cli api --host http://duck-norris.host -X DELETE jobs/1234

Troubleshooting and pitfalls


(Last modified on July 14, 2022)