Currently the code expects a stable Fedora release.
$ make system/fedora
$ hatch env create dev
$ hatch -e dev shell
$ newa
Newa!
$
By default, NEWA settings is loaded from file $HOME/.newa
.
Below is an example of such a file.
[erratatool]
url = https://..
[jira]
url = https://...
token = *JIRATOKEN*
[reportportal]
url = https://...
token = *RP_TOKEN*
project = my_personal
[testingfarm]
token = *TESTING_FARM_API_TOKEN*
recheck_delay = 120
This settings can be overriden by environment variables that takes precedence.
NEWA_ET_URL
NEWA_JIRA_URL
NEWA_JIRA_TOKEN
NEWA_JIRA_PROJECT
NEWA_REPORTPORTAL_URL
NEWA_REPORTPORTAL_TOKEN
NEWA_REPORTPORTAL_PROJECT
TESTING_FARM_API_TOKEN
NEWA_TF_RECHECK_DELAY
Make sure you have your $HOME/.newa
configuration file defined prior running this file.
$ REQUESTS_CA_BUNDLE=/etc/pki/tls/cert.pem newa event --compose CentOS-Stream-9 jira --issue-config demodata/jira-compose-config.yaml schedule execute report
Or
$ REQUESTS_CA_BUNDLE=/etc/pki/tls/cert.pem newa event --erratum 124115 jira --issue-config demodata/jira-errata-config.yaml schedule execute report
event
Gets event details either from a command line
newa event --erratum 12345
or from a files having init-
prefix.
Produces multiple files based on the event (erratum) details,
splitting them according to the product release and populating
them with the event
and erratum
keys.
For example:
$ cat state/event-128049-RHEL-9.4.0.yaml
erratum:
builds: []
release: RHEL-9.4.0
event:
id: '128049'
type_: erratum
$ cat state/event-128049-RHEL-8.10.0.yaml
erratum:
builds: []
release: RHEL-8.10.0
event:
id: '128049'
type_: erratum
jira
Processes multiple files having event-
prefix. For each event/file reads
Jira configuration file and for each item from the configuration it
creates or updates a Jira issue and produces jira-
file, populating it
with jira
and recipe
keys.
For example:
$ cat state/jira-128049-RHEL-8.10.0-NEWA-12.yaml
erratum:
builds: []
release: RHEL-8.10.0
event:
id: '128049'
type_: erratum
jira:
id: NEWA-12
recipe:
url: https://path/to/recipe.yaml
$ cat state/jira-128049-RHEL-9.4.0-NEWA-6.yaml
erratum:
builds: []
release: RHEL-9.4.0
event:
id: '128049'
type_: erratum
jira:
id: NEWA-6
recipe:
url: https://path/to/recipe.yaml
schedule
Processes multiple files having jira-
prefix. For each such file it
reads recipe details from recipe.url
and according to that recipe
it produces multiple request-
files, populating it with recipe
key.
For example:
$ cat state/request-128049-RHEL-8.10.0-NEWA-12-REQ-1.yaml
erratum:
builds: []
release: RHEL-8.10.0
event:
id: '128049'
type_: erratum
jira:
id: NEWA-12
recipe:
url: https://path/to/recipe.yaml
request:
context:
distro: rhel-8.10.0
environment: {}
git_ref: ''
git_url: ''
id: REQ-1
tmt_path: ''
$ cat state/request-128049-RHEL-8.10.0-NEWA-12-REQ-2.yaml
erratum:
builds: []
release: RHEL-8.10.0
event:
id: '128049'
type_: erratum
jira:
id: NEWA-12
recipe:
url: https://path/to/recipe.yaml
request:
context:
distro: rhel-8.10.0
environment: {}
git_ref: ''
git_url: ''
id: REQ-2
tmt_path: ''
execute
Processes multiple files having schedule-
prefix. For each such file it
reads request details from the inside and proceeds with the actual execution.
When tests are finished it produces files having execute-
prefix updated with
details of the execution.
Example:
$ cat state/execute-RHEL-9.5.0-20240519.9-RHEL-9.5.0-20240519.9-BASEQESEC-1227-REQ-1.2.yaml
compose:
id: RHEL-9.5.0-20240519.9
erratum: null
event:
id: RHEL-9.5.0-20240519.9
type_: compose
execution:
artifacts_url: https://artifacts.somedomain.com/testing-farm/db0d98d2-f5c0-4f18-9308-66801f054342
batch_id: 49aa0321898d
return_code: 0
jira:
id: BASEQESEC-1227
recipe:
url: https://raw.githubusercontent.com/RedHatQE/newa/main/demodata/recipe1.yaml
request:
compose: RHEL-9.5.0-20240519.9
context:
color: blue
environment:
CITY: Brno
PLANET: Earth
git_ref: main
git_url: https://github.com/RedHatQE/newa.git
id: REQ-1.2
plan: /plan1
rp_launch: recipe1
tmt_path: demodata
when: null
import
This subcommand currently takes care of the results reporting to Jira and
interaction with ReportPortal. It processes multiple files having execute-
prefix,
reads RP launch details and searches for all the relevant launches, subsequently
merging them into a single launch. Later, it updates the respective Jira issue
with a note about test results availalability and a link to ReportPortal launch.
This subcommand doesn't produce any files.
Built on https://jinja.palletsprojects.com/en/3.1.x/templates/#builtin-tests, adds the following tests:
erratum
- whether an event or job are processing an erratummatch
- whether a string matches given regular exceptionnewa
should expose the following variables to expressions:
JOB
- an instance of Job
subclass, e.g. ErratumJob
EVENT
- also JOB.event
ERRATUM
- also JOB.erratum
if JOB is erratum
A couple of examples:
# Checking if event type equals to "errata", "compose", ...
when: EVENT is erratum
when: EVENT is not erratum
when: JOB is erratum
when: JOB is not erratum
# Checking if errata number starts with (or contains or matches regexp) string "RHSA"
when: EVENT.id is match("f.*")
when: EVENT.id is match("b.*")
when: JOB.event.id is match("f.*")
when: JOB.event.id is match("b.*")
# Checking if errata release starts with (or contains or matches regexp) string "rhel-x.y"
when: JOB.erratum.release is match("RHEL-.*")
when: JOB.erratum.release is match("(?i)rhel-.*")
when: JOB.erratum.release is match("RHEL-9.7.0")
# Maybe we could add custom tests, e.g.:
when: JOB is RHEL
when: JOB is RHEL_9
when: JOB is not RHEL_9_5_0
# Negations of all checks above
when: JOB.erratum.release is not match("RHEL-.*")
when: JOB.erratum.release is not match("(?i)rhel-.*")
when: JOB.erratum.release is not match("RHEL-9.7.0")
#