-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix broken requirements * remove envparse listed as requirement, but not used anywhere * Refactor dir hierarchy * Push devel builds to the devel repository * Fix imports * fix tests * changelog, readme modifications * try krb5 as dependency Signed-off-by: Daniel Diblik <[email protected]>
- Loading branch information
Showing
15 changed files
with
135 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# See the documentation for more information: | ||
# https://packit.dev/docs/configuration/ | ||
|
||
specfile_path: tesar.spec | ||
|
||
# add or remove files that should be synced | ||
files_to_sync: | ||
- tesar.spec | ||
- .packit.yaml | ||
|
||
# name in upstream package repository or registry (e.g. in PyPI) | ||
upstream_package_name: tesar | ||
# downstream (Fedora) RPM package name | ||
downstream_package_name: tesar | ||
|
||
jobs: | ||
# Build for pull request push | ||
- job: copr_build | ||
owner: danmyway | ||
project: tesar-devel | ||
trigger: pull_request | ||
targets: | ||
- fedora-stable | ||
actions: | ||
# Get the version from the spec file | ||
get-current-version: | ||
- echo devel | ||
# Build for merge to devel | ||
- job: copr_build | ||
owner: danmyway | ||
project: tesar-devel | ||
trigger: commit | ||
branch: devel | ||
targets: | ||
- fedora-stable | ||
actions: | ||
# Get the version from the spec file | ||
get-current-version: | ||
- echo devel | ||
# Build for release tagged on main | ||
- job: copr_build | ||
owner: danmyway | ||
project: tesar | ||
trigger: release | ||
targets: | ||
- fedora-stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ | |
1. [Testing farm API key](#testing-farm-api-key) | ||
2. [Cloud Resources Tag](#cloud-resources-tag) | ||
3. [Package dependencies](#package-dependencies) | ||
3. [Setup](#setup) | ||
3. [Setting up](#setting-up) | ||
1. [Installation](#installation) | ||
1. [Clone](#clone) | ||
2. [Install](#install) | ||
3. [Set up configuration file](#set-up-configuration-file) | ||
3. [Set up the configuration file](#set-up-configuration-file) | ||
4. [Config file template](#config-file-template) | ||
2. [Usage](#usage) | ||
1. [Commands](#commands) | ||
|
@@ -39,7 +39,7 @@ That is IMHO **exactly six times more**, than it should be. | |
With this script, you will be able to do all of the above with just one command! | ||
|
||
```shell | ||
``` | ||
tesar test copr c2r -ref pr123 -g github oamg main -p /plans/tier0/basic_sanity_checks /plans/tier1/rhsm -c cos84 cos7 ol8 | ||
``` | ||
|
||
|
@@ -60,54 +60,35 @@ Each team using the Testing Farm to run test efforts has a BusinessUnit tag assi | |
Those are important to use for correct reporting efforts of a cloud spend for each team.<br> | ||
Ask peers in your team for the tag value. | ||
|
||
### Package dependencies | ||
# Setting up | ||
|
||
To be able to get information for brew-builds and copr-builds this script uses the `brewkoji` and | ||
`python-copr` packages. <br> | ||
If needed, install `python-copr-doc` for code documentation for the python-copr package.<br> | ||
Documentation then will be available at `/usr/share/doc/python-copr/html/ClientV3.html` | ||
It is also recommended to install `python-kerberos`, `python-requests`, `python-requests-kerberos`, `make`, `krb5-devel`, `gcc`, `python3-devel`, `redhat-rpm-config` to be able to run the script. | ||
### Installation | ||
|
||
Before installing the packages, it is advised to download the `rcm-tools-fedora.repo` to be able to install `brewkoji` | ||
#### Enable the copr repository | ||
|
||
```shell | ||
sudo su | ||
curl -L https://download.devel.redhat.com/rel-eng/RCMTOOLS/rcm-tools-fedora.repo -o /etc/yum.repos.d/rcm-tools-fedora.repo | ||
``` | ||
sudo dnf copr enable danmyway/tesar | ||
``` | ||
|
||
Installing the packages | ||
If you are brave enough, though not advised, you can try out the development repository. | ||
|
||
```shell | ||
dnf install brewkoji python-copr python-copr-doc python-kerberos python-requests python-requests-kerberos make krb5-devel gcc python3-devel redhat-rpm-config | ||
``` | ||
sudo dnf copr enable danmyway/tesar-devel | ||
``` | ||
|
||
# Setup | ||
|
||
### Installation | ||
#### Install | ||
|
||
#### Clone | ||
Clone repository to your local machine. | ||
```shell | ||
# ssh | ||
git clone [email protected]:danmyway/tesar.git | ||
# https | ||
git clone https://github.com/danmyway/tesar.git | ||
``` | ||
#### Install | ||
Change directory to the cloned folder, run virtual environment and install the package. | ||
```shell | ||
cd ~/tesar | ||
pipenv --site-packages shell | ||
pip install . | ||
sudo dnf install tesar | ||
``` | ||
#### Set up configuration file | ||
#### Set up the configuration file | ||
Set up config file with obtained Testing Farm API key and Cloud Resources Tag that helps with tracking cloud spend. | ||
|
||
```shell | ||
``` | ||
touch ~/.config/tesar && printf "[testing-farm]\nAPI_KEY={your testing farm api key}\n[cloud-resources-tag]\nCLOUD_RESOURCES_TAG={tag}" > ~/.config/tesar | ||
``` | ||
or copy provided file and edit with your favourite editor, e.g. | ||
```shell | ||
``` | ||
cp ./tesar.temp ~/.config/tesar | ||
vim ~/.config/tesar | ||
``` | ||
|
@@ -120,8 +101,6 @@ API_KEY= | |
CLOUD_RESOURCES_TAG= | ||
``` | ||
### Usage | ||
If you installed the script via `pip install .` you should be able to run the script by running `tesar` command.<br> | ||
Otherwise run with `python3 __main__.py` from the `tesar/tesar` directory. | ||
|
||
#### Commands | ||
As of now tesar is able to perform two tasks. | ||
|
@@ -140,50 +119,7 @@ You can look for possible [targeted OS' below](#mapped-composes), multiple can b | |
Use `-w/--wait` to override the default 20 seconds waiting time for successful response from the endpoint, or `-nw/--no-wait` to skip the wait time. | ||
If for any reason you would need the raw payload, use `--dry-run` to get it printed to the command line or use `--dry-run-cli` to print out the full usable `http POST` command. | ||
When no `-t/--target` option is specified, the request is sent for all mapped target composes for their respective tested packages. | ||
```shell | ||
❯ tesar test --help | ||
usage: tesar test [-h] (-ref REFERENCE [REFERENCE ...] | -id TASK_ID [TASK_ID ...]) [-g GIT [GIT ...]] [-gp GIT_PATH] [-a ARCHITECTURE] (-p PLANS [PLANS ...] | -pf PLANFILTER [PLANFILTER ...] | -tf TESTFILTER [TESTFILTER ...]) | ||
[-t TARGET [TARGET ...]] [-pw] [-w WAIT] [-nw] [-l] [--dry-run] [--dry-run-cli] [--debug] | ||
artifact_type package | ||
|
||
Send requests to the Testing Farm conveniently. | ||
|
||
positional arguments: | ||
artifact_type Choose which type of artifact to test. Choices: brew, copr | ||
package Choose package to test. Choices: c2r, leapp-repository | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
-ref REFERENCE [REFERENCE ...], --reference REFERENCE [REFERENCE ...] | ||
Mutually exclusive with respect to --task-id. For brew: Specify the reference version to find the correct artifact (e.g. 0.1-2, 0.1.2). For copr: Specify the pull request reference to find the correct | ||
artifact (e.g. pr123, main, master, ...). | ||
-id TASK_ID [TASK_ID ...], --task-id TASK_ID [TASK_ID ...] | ||
Mutually exclusive with respect to --reference. For brew: Specify the TASK ID for required brew build. NOTE: Double check, that you are passing TASK ID for copr builds, not BUILD ID otherwise | ||
testing farm will not install the package. For copr: Specify the BUILD ID for required copr build. | ||
-g GIT [GIT ...], --git GIT [GIT ...] | ||
Provide repository base (github, gitlab, gitlab.cee.redhat) owner of the repository and a branch containing the tests you want to run. Default: '['github', 'oamg', 'main']' | ||
-gp GIT_PATH, --git-path GIT_PATH | ||
Path to the metadata tree root. Should be relative to the git repository root provided in the url parameter. Default: '.' | ||
-a ARCHITECTURE, --architecture ARCHITECTURE | ||
Choose suitable architecture. Default: 'x86_64'. | ||
-p PLANS [PLANS ...], --plans PLANS [PLANS ...] | ||
Specify a test plan or multiple plans to request at testing farm. To run whole set of tiers use /plans/tier*/ Accepts multiple space separated values, sends as a separate request. | ||
-pf PLANFILTER [PLANFILTER ...], --planfilter PLANFILTER [PLANFILTER ...] | ||
Filter plans. The specified plan filter will be used in tmt plan ls --filter <YOUR-FILTER> command. By default enabled: true filter is applied. Accepts multiple space separated values, sends as a separate | ||
request. | ||
-tf TESTFILTER [TESTFILTER ...], --testfilter TESTFILTER [TESTFILTER ...] | ||
Filter tests. The specified plan filter will be used in tmt run discover plan test --filter <YOUR-FILTER> command. Accepts multiple space separated values, sends as a separate request. | ||
-t TARGET [TARGET ...], --target TARGET [TARGET ...] | ||
Choose targeted test run. For c2r targeted OS, for leapp targeted upgrade path. | ||
-pw, --pool-workaround | ||
Workarounds the AWS spot instances release. | ||
-w WAIT, --wait WAIT Provide number of seconds to wait for successful response. Default: 20 seconds. | ||
-nw, --no-wait Don't wait for successful response and get the artifact link ASAP. | ||
-l, --log Log test links or dry run output to a file. | ||
--dry-run Print out just the payload that would be sent to the testing farm. Do not actually send any request. | ||
--dry-run-cli Print out https shell command with requested payload. Do not actually send any request. | ||
--debug Print out additional information for each request. | ||
``` | ||
|
||
|
||
##### Report | ||
With the report command you are able to get the results of the requested jobs straight to the command line.<br> | ||
|
@@ -206,42 +142,13 @@ Corresponding return code is set based on the results with following logic: | |
|
||
The default way to show results is by showing each run details as a separate table. In order to combine test results of several different tft runs you can use comparison mode which is triggered by the `--compare` flag of `tesar report`. | ||
|
||
```shell | ||
❯ tesar report -c 8f4e2e3e-beb4-4d3a-9b0a-68a2f428dd1b -c c3726a72-8e6b-4c51-88d8-612556df7ac1 --short --unify-results=tier2=tier2_7to8 --compare | ||
``` | ||
```shell | ||
❯ tesar report --help | ||
usage: tesar report [-h] [--showarch] [-l2] [-s] [-stn SPLIT_TESTNAME] [-spn SPLIT_PLANNAME] [-w] [-d] [--skip-pass] [--compare] [-u UNIFY_RESULTS] [-lt | -f FILE | -c CMD] | ||
Parses task IDs, Testing Farm artifact URLs or Testing Farm API request URLs from multiple sources. | ||
options: | ||
-h, --help show this help message and exit | ||
--showarch Display architecture. By default the architecture is not shown. | ||
-l2, --level2 Display test view detail. By default the report shows only plan view. | ||
-s, --short Display short test and plan names. | ||
-stn SPLIT_TESTNAME, --split-testname SPLIT_TESTNAME | ||
Specify an index from which will the test name be shown. Passed to testname.split('/')[index:] | ||
-spn SPLIT_PLANNAME, --split-planname SPLIT_PLANNAME | ||
Specify an index from which will the plan name be shown. Passed to planname.split('/')[index:] | ||
-w, --wait Wait for the job to complete. Print the table afterwards | ||
-d, --download-logs Download logs for requested run(s). | ||
--skip-pass Skip PASSED results while showing table and while downloading logs. | ||
--compare Build a comparison table for several runs results | ||
-u UNIFY_RESULTS, --unify-results UNIFY_RESULTS | ||
Plans name to be treated as one in plan1=plan2 format, useful for runs comparison in case of renaming. | ||
-lt, --latest Mutually exclusive with respect to --file and --cmd. Report latest jobs from /tmp/tesar_latest_jobs. | ||
-f FILE, --file FILE Mutually exclusive with respect to --latest and --cmd. Specify a different location than the default ./report_jobs of the file containing request_id's, artifact URLs | ||
or request URLs. | ||
-c CMD, --cmd CMD Mutually exclusive with respect to --file and --latest. Parse request_ids, artifact URLs or request URLs from the command line. | ||
❯ tesar report -c 8f4e2e3e-beb4-4d3a-9b0a-68a2f428dd1b -c c3726a72-8e6b-4c51-88d8-612556df7ac1 --short --unify-results=tier2=tier2_7to8 --compare | ||
``` | ||
|
||
#### Examples | ||
|
||
```shell | ||
``` | ||
# Test copr build for PR#123 with plan basic_sanity_check on CentOS 8.4 | ||
$ tesar test copr c2r -ref pr123 -g github oamg main -p /plans/tier0/basic_sanity_checks -c cos84 | ||
|
@@ -256,7 +163,7 @@ $ tesar test brew c2r -ref 0.12-3 -git github oamg main -p /plans/tier0/basic_sa | |
``` | ||
|
||
```shell | ||
``` | ||
# Get results for the requests in the default file ./latest_jobs | ||
$ tesar report | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import contextlib | ||
import sys | ||
|
||
from dispatch import get_arguments, get_datetime | ||
|
||
ARGS = get_arguments() | ||
from .dispatch import get_arguments, get_datetime | ||
|
||
|
||
def main(): | ||
if ARGS.action == "test": | ||
from dispatch.__main__ import main as dispatch | ||
args = get_arguments() | ||
|
||
if args.action == "test": | ||
from .dispatch.__main__ import main as dispatch | ||
|
||
if ARGS.log: | ||
if args.log: | ||
datetime_str = get_datetime() | ||
with open(f"./artifactlog_{datetime_str}", "a") as log: | ||
with contextlib.redirect_stdout(log): | ||
sys.exit(dispatch()) | ||
else: | ||
sys.exit(dispatch()) | ||
elif ARGS.action == "report": | ||
from report.__main__ import main as report | ||
elif args.action == "report": | ||
from .report.__main__ import main as report | ||
|
||
sys.exit(report()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.