phsmoura / centos / sig-guide

Forked from centos/sig-guide 2 years ago
Clone

Blame docs/ci.md

80c633
# Testing
15677d
15677d
The CentOS Project has some resources available for each SIG to run some CI jobs/tests for their projects.
15677d
We'll document soon how to get onboarded (on request) on the CentOS CI infra platform.
15677d
73fd19
We offer the following resources :
15677d
15677d
  * Openshift hosted jenkins (one per project/SIG), using usual authentication from FAS/ACO
15677d
  * bare-metal and/or Virtual Machines ephemeral nodes on which you can run some tests (including destructive ones), that will be automatically be reinstalled (for bare-metal) or discarded (for VMs)
f8ca97
f8ca97
f8ca97
## Using bare-metal/Virtual Machines with Duffy client
f8ca97
Duffy is the middle layer running ci.centos.org that manages the provisioning, maintenance and teardown / rebuild of the Nodes (physical hardware and VMs) that are used to run the tests in the CI Cluster.
f8ca97
f8ca97
### Installing and configuring duffy client
f8ca97
Use `pip` to install duffy client.
f8ca97
f8ca97
```shell
f8ca97
pip install --user duffy[client]
f8ca97
```
f8ca97
f8ca97
Duffy client needs the tenant's name and the tenant's API key to be able to request sessions from duffy server. If the tenant doesn't exist yet, it should be created in duffy server. Having the tenant's name and the tenant's API key, create the file `.config/duffy` with the following content. 
f8ca97
f8ca97
```
f8ca97
client:
f8ca97
  url: https://duffy.ci.centos.org/api/v1
f8ca97
  auth:
f8ca97
    name: <tenant name>
f8ca97
    key: <API key>
f8ca97
```
f8ca97
f8ca97
### Requesting a session
f8ca97
Before creating a session, the name of the pool is required. Check the pool available executing the command.
f8ca97
f8ca97
```shell
f8ca97
duffy client list-pools
f8ca97
```
f8ca97
f8ca97
!!! note
f8ca97
    The name of the pool is structured like this: 
f8ca97
f8ca97
    `<AAA>-<BBB>-<CCC>-<DDD>-<EEE>-<FFF>`
f8ca97
f8ca97
    - AAA: Identify if it is a bare metal or virtual machine
f8ca97
    - BBB: The kind of the instance, like seamicro, AWS EC2, etc
f8ca97
    - CCC: The size of the machine
f8ca97
    - DDD: The operational system
f8ca97
    - EEE: Operational system's version
f8ca97
    - FFF: The architecture
f8ca97
f8ca97
f8ca97
Having the name of the pool, request how many sessions needed. Duffy has a limit of sessions per tenant, this information is available in the duffy server.
f8ca97
f8ca97
```shell
f8ca97
duffy client request-session pool=<name of the pool>,quantity=<number of sessions>
f8ca97
``` 
f8ca97
f8ca97
By default this command outputs a _json_, but it's possible to change the format to _yaml_ or _flat_ using `--format`. Under "node" key it's possible to find the node's hostname provisioned. Log in to it as `root` user, using `ssh`.
f8ca97
f8ca97
```json
f8ca97
{
f8ca97
<...output ommited...>
f8ca97
f8ca97
"nodes": [
f8ca97
    {
f8ca97
        "hostname": "<hostname>",
f8ca97
        "ipaddr": "<ip address>",
f8ca97
f8ca97
<...output ommited...>
f8ca97
}
f8ca97
```
f8ca97
f8ca97
### Retiring a session
f8ca97
To retire a session, the session id is required. Check the id executing.
f8ca97
f8ca97
```shell
f8ca97
duffy client list-sessions
f8ca97
```
f8ca97
f8ca97
When needed to retire the session execute the command.
f8ca97
f8ca97
```shell
f8ca97
duffy client retire-session <session id>
f8ca97
```