Skip to content
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

Dummy change #20

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
dispatch-command:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v3
with:
token: ${{ secrets.PAT }}
commands: |
schedule-test-run
cancel-tests
print-result
help
issue-type: pull-request
permission: none
22 changes: 22 additions & 0 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: help-command
on:
repository_dispatch:
types: [help-command]
jobs:
help:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
> Command | Description
> --- | ---
> /help | Print this message
> /schedule-test-run [distri={opensuse,fedora,sle,centos,ubuntu,debian,archlinux}] [version_distri={Tumbleweed+opensuse,Leap+opensuse,37+fedora,Rawhide+fedora,8+centos,9+centos,15+sle,22.04+ubuntu,10+debian,rolling+archlinux}] | Schedules a test run on openqa.opensuse.org
> /cancel-tests | Cancel the current test run
> /print-result | Pretty prints the result from the test run
67 changes: 67 additions & 0 deletions .github/workflows/schedule-test-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: schedule-test-run-command
on:
repository_dispatch:
types: [schedule-test-run-command]
jobs:
help:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: poetry-${{ hashFiles('poetry.lock') }}

- name: install python dependencies
run: poetry install

- name: create the openQA client config file
run: |
mkdir -p ~/.config/openqa
echo "[openqa.opensuse.org]" > ~/.config/openqa/client.conf
echo "key = ${{ secrets.O3_KEY }}" >> ~/.config/openqa/client.conf
echo "secret = ${{ secrets.O3_SECRET }}" >> ~/.config/openqa/client.conf

- name: schedule the actual test run
run: |
VERSION_DISTRI="${{ github.event.client_payload.slash_command.args.named.version_distri }}"
DISTRI="${{ github.event.client_payload.slash_command.args.named.distri }}"
CMD="poetry run schedule_test_run"
eval "$CMD -vd $(echo $VERSION_DISTR | sed 's/,/ /g') -d $(echo $DISTRI | sed 's/,/ /g') --dry-run"
json_state_file=$(ls -tr *json|tail -1)
echo "json_state_file=$json_state_file" >> $GITHUB_ENV
echo "json_b64_state=$(cat $json_state_file | base64 -w 0)"

- name: create a comment with the json state file
uses: peter-evans/create-or-update-comment@v3
id: create_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Created the test run ${{ env.json_state_file }}.
<details><summary>Internal state</summary>
${{ env.json_b64_state }}
</details>

- name: Add reaction to the original comment on success
if: ${{ success() }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.PAT }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: "+1"

- name: generate the url to this workflow run
if: ${{ failure() || cancelled() }}
run: echo "run_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV

- name: Add reaction and a link to the error to the original comment on failure
if: ${{ failure() || cancelled() }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.PAT }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: "-1"
body: Failed to schedule the test, see the [workflow run](${{ env.run_url }}) for further details.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kiwi-functional-tests

KIWI openQA functional tests using the images from the staging project on OBS.
KIWI openQA functional tests using the images from the staging project on OBS


## Prerequisites
Expand Down
12 changes: 0 additions & 12 deletions launcher/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,3 @@
DEBIAN_TESTS,
ARCHLINUX_TESTS,
]


class COLORS:
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKCYAN = "\033[96m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"
134 changes: 0 additions & 134 deletions launcher/monitor.py

This file was deleted.

84 changes: 68 additions & 16 deletions launcher/openqa.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from enum import StrEnum, auto, unique
from typing import Literal
from openqa_client.client import OpenQA_Client
from pydantic import BaseModel, ConfigDict
Expand All @@ -21,6 +22,71 @@ class JobDependency(BaseModel):
directly_chained: list[int]


@unique
class JobState(StrEnum):
DONE = auto()
CANCELLED = auto()
SCHEDULED = auto()
RUNNING = auto()

@property
def pretty(self) -> str:
EMOJI = {
JobState.SCHEDULED: "📅",
JobState.RUNNING: "🛻",
JobState.CANCELLED: "🚫",
JobState.DONE: "🏁",
}
return f"{EMOJI[self]} {self.value}"


@unique
class JobResult(StrEnum):
SCHEDULED = auto()
SOFTFAILED = auto()
USER_CANCELLED = auto()
FAILED = auto()
SKIPPED = auto()
INCOMPLETE = auto()
PASSED = auto()
NONE = auto()
PARALLEL_FAILED = auto()
PARALLEL_RESTARTED = auto()
USER_RESTARTED = auto()
OBSOLETED = auto()
TIMEOUT_EXCEEDED = auto()

@property
def is_failed(self) -> bool:
return self not in (
JobResult.SCHEDULED,
JobResult.SOFTFAILED,
JobResult.PASSED,
JobResult.NONE,
JobResult.PARALLEL_RESTARTED,
JobResult.USER_RESTARTED,
)

@property
def pretty(self) -> str:
EMOJI = {
JobResult.SCHEDULED: "📅",
JobResult.SOFTFAILED: "🟡",
JobResult.USER_CANCELLED: "✖",
JobResult.FAILED: "❌",
JobResult.SKIPPED: "⏭",
JobResult.INCOMPLETE: "🚫",
JobResult.PASSED: "✅",
JobResult.NONE: "❓",
JobResult.PARALLEL_FAILED: "❌",
JobResult.PARALLEL_RESTARTED: "🔁",
JobResult.USER_RESTARTED: "🔁",
JobResult.OBSOLETED: "",
JobResult.TIMEOUT_EXCEEDED: "⏰",
}
return f"{EMOJI[self]} {self.value}"


class Job(BaseModel):
"""A test job on openQA"""

Expand All @@ -43,23 +109,9 @@ class Job(BaseModel):
group_id: int | None
parents: JobDependency
parents_ok: Literal[1, 0, ""]
result: Literal[
"scheduled",
"softfailed",
"user_cancelled",
"failed",
"skipped",
"incomplete",
"passed",
"none",
"parallel_failed",
"parallel_restarted",
"user_restarted",
"obsoleted",
"timeout_exceeded",
]
result: JobResult
settings: dict[str, str]
state: Literal["done", "cancelled", "scheduled", "running"]
state: JobState
test: str
#: timestamp when the test finished or failed
t_finished: str | None
Expand Down
Loading