-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
0 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,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 |
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,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 |
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,70 @@ | ||
--- | ||
name: schedule-test-run-command | ||
on: | ||
repository_dispatch: | ||
types: [schedule-test-run-command] | ||
jobs: | ||
schedule-test-run-on-o3: | ||
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: | | ||
sudo apt remove -y python3-distro-info | ||
pipx install poetry | ||
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. |