-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add verification run scheduler #5647
Draft
ByteOtter
wants to merge
14
commits into
os-autoinst:master
Choose a base branch
from
ByteOtter:add-verification-scheduler
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
23b2be0
add scheduler script
ByteOtter 42fb4e7
update script naming to fit convention
ByteOtter 33a384b
fix help text
ByteOtter 6c9dc7e
support custom target domains
ByteOtter c7f23ee
Fix style of help text
ByteOtter 6bd62d6
Apply coding style feedback
ByteOtter b7737ac
Fix text formatting
ByteOtter dbac7fb
Remove unnecessary quotations
ByteOtter b113b10
Merge token retrieval into clone-custom-git-refspec script
ByteOtter f8fc47b
Change name of configuration file
ByteOtter d103077
Implement --modules flag
ByteOtter 95c234e
Fix typo in example
ByteOtter 1c3a1e2
Move token collection after function declaration
ByteOtter f1ab36f
Update scripts (tmp)
ByteOtter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,126 @@ | ||
#!/bin/bash | ||
# Copyright 2024 (c) SUSE LLC | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
# Schedule a verification run for a os-autoinst PR | ||
# USAGE: | ||
# | ||
# schedule_verification_run $SOURCE $PR_ID $BASE_TEST_ID $[test/module, test/module, ...] $TEST_NAME | ||
# | ||
# Parameters | ||
# | ||
# * $SOURCE - The source you want to schedule a rund for. Can be either opensuse or suse. | ||
# * $PR_ID - The ID of your GitHub Pull Request. | ||
# * $BASE_TEST_ID - The ID of the test you want you use as a base. | ||
# * $[test/module, ...] - The modules of your test you want to schedule for. | ||
# * $TEST_NAME - The Name of your test. (E.g.: TETS=RUST) | ||
# | ||
# Specify your GitHub access token in a config file at '~/.config/openqa/gh.conf' like this: | ||
# | ||
# ``` | ||
# GH_ACCESS_TOKEN="YOUR_TOKEN_HERE" | ||
# ``` | ||
# | ||
# Default test modules | ||
# | ||
# The following modules are automatically selected to load for your run: | ||
# | ||
# * 'tests/installation/bootloader_start' | ||
# * 'tests/boot/boot_to_desktop' | ||
# | ||
# Example | ||
# | ||
# Pass arguments to this script like this: | ||
# | ||
# schedule_verification_run opensuse TOKEN 1234 12345 tests/console/rustup,tests/console/cargo RUST | ||
|
||
|
||
help_text=$(cat <<'EOF' | ||
OpenQA verification run scheduler. | ||
|
||
USAGE: | ||
====== | ||
|
||
$ schedule_verification_run $SOURCE $PR_ID $BASE_TEST_ID $[test/module, test/module,...] $TEST_NAME | ||
|
||
Parameters | ||
---------- | ||
|
||
* \$SOURCE - The source you want to schedule a rund for. Can be either opensuse or suse. | ||
* \$PR_ID - The ID of your GitHub Pull Request. | ||
* \$BASE_TEST_ID - The ID of the test you want you use as a base. | ||
* \$[test/module,...] - The modules of your test you want to schedule for. | ||
* \$TEST_NAME - The Name of your test. (E.g.: TEST=RUST) | ||
|
||
Specify your GitHub access token in '~/.config/openqa/gh.conf' like this: | ||
|
||
``` | ||
GH_ACCESS_TOKEN="YOUR_TOKEN_HERE" | ||
``` | ||
|
||
Default test modules | ||
-------------------- | ||
|
||
The following modules are automatically selected to load for your run: | ||
|
||
* 'tests/installation/bootloader_start' | ||
* 'tests/boot/boot_to_desktop' | ||
|
||
Options | ||
------- | ||
|
||
* '-h' / '--help' - Display this help text. | ||
|
||
EOF | ||
) | ||
|
||
source="$1" | ||
pr_id="$2" | ||
test_id="$3" | ||
modules="$4" | ||
test_name="$5" | ||
|
||
config_file="$HOME/.config/openqa/gh.conf" | ||
config="" | ||
|
||
# See help text. | ||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | ||
echo "$help_text" | ||
exit 0 | ||
fi | ||
|
||
# If too few or too many arguments are supplied -> die. | ||
if [ "$#" -ne 5 ]; then | ||
echo "Invalid number of arguments. Run with '-h' or '--help' to view usage." | ||
exit 1 | ||
fi | ||
|
||
# Read GH token from config file. | ||
if [[ -f "$config_file" ]]; then | ||
config=$(grep "^GH_ACCESS_TOKEN=" "$config_file" | cut -d'"' -f2) | ||
else | ||
echo "No GitHub token file found! Run with '-h' for more info." | ||
exit 1 | ||
fi | ||
|
||
GITHUB_TOKEN=$config | ||
|
||
export GITHUB_TOKEN | ||
|
||
if [ "$source" = "opensuse" ]; then | ||
echo "Dispatching verification run for opensuse..." | ||
openqa-clone-custom-git-refspec "https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/$pr_id" \ | ||
"https://openqa.opensuse.org/tests/$test_id" \ | ||
SCHEDULE="tests/installation/bootloader_start,tests/boot/boot_to_desktop,$modules" \ | ||
TEST="$test_name" | ||
elif [ "$source" = "suse" ]; then | ||
echo "Dispatching verification run for suse..." | ||
openqa-clonse-custom-git-refspec "https://github.com/os-autoinst-distri-opensuse/pull/$pr_id" \ | ||
"https://openqa.suse.de/tests/$test_id" \ | ||
SCHEDULE="tests/installation/bootloader_start,tests/boot/boot_to_desktop,$modules" \ | ||
TEST="$test_name" | ||
else | ||
# NOTE: Technically we could support custom targets via a config file. TBI. | ||
echo "Unknown argument '$1'. Must be either 'suse' or 'opensuse'. Custom openqa instances not yet supported." | ||
exit 1 | ||
fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder, are you aware of the existing support for job URL's within the PR description? See https://github.com/os-autoinst/openQA/blob/master/script/openqa-clone-custom-git-refspec#L52
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually wasn't aware of this, thanks for making me aware. That'd make integrating parts of the ideas into
openqa-clone-custom-git-refspec
even more alluring to take advantage of this feature. @foursixnine, what do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to mention that we came to the conclusion that it is better to avoid the
@
-syntax as one probably don't want to mention the@openqa
organization on GitHub here. Of course this makes the mentioned feature of the refspec script less interesting - unless one would change it.However, I suggest to use https://github.com/os-autoinst/scripts/blob/master/openqa-clone-and-monitor-job-from-pr instead (which is already setup for the openSUSE test distribution and uses the
openqa: Clone …
syntax). It will soon also support creating clones by creating/editing comments but it is so far limited to the PR description.(You can also read https://open.qa/docs/#_create_and_monitor_openqa_jobs_from_within_the_ci_runner for more information on the broader topic.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep its the first point here: #5647 (comment)
the extract URLs from description sounds nice, but only useful if it would edit the description and add the badges; I'd say lets keep that out of scope :)