Skip to content

Commit 16c779b

Browse files
authored
Merge branch 'opendatahub-io:main' into feature/mariadb-tls-negative-case
2 parents 4678e6c + 6a1f7e2 commit 16c779b

File tree

104 files changed

+3458
-2309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3458
-2309
lines changed

.github/workflows/add-remove-labels.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ on:
44
types: [synchronize]
55

66
pull_request_review:
7+
types: [submitted, edited]
8+
9+
pull_request_review_comment:
10+
types: [created, edited]
711

812
issue_comment:
913
types: [created, edited, deleted]
10-
if: |
11-
contains(github.event.comment.body, '/wip') ||
12-
contains(github.event.comment.body, '/verified') ||
13-
contains(github.event.comment.body, '/lgtm') ||
14-
contains(github.event.comment.body, '/hold')
1514

1615

1716
permissions:
@@ -21,6 +20,12 @@ permissions:
2120

2221
jobs:
2322
add-remove-labels:
23+
if: |
24+
contains(github.event.comment.body, '/wip') ||
25+
contains(github.event.comment.body, '/verified') ||
26+
contains(github.event.comment.body, '/lgtm') ||
27+
contains(github.event.comment.body, '/hold') ||
28+
contains(github.event.comment.body, '/cherry-pick')
2429
runs-on: ubuntu-latest
2530

2631
steps:
@@ -38,12 +43,13 @@ jobs:
3843

3944
- name: Run add remove labels
4045
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
GITHUB_TOKEN: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }}
4247
GITHUB_PR_NUMBER: "${{ github.event.pull_request.number || github.event.issue.number }}"
4348
GITHUB_EVENT_ACTION: ${{ github.event.action }}
4449
GITHUB_EVENT_REVIEW_STATE: ${{ github.event.review.state }}
4550
GITHUB_EVENT_NAME: ${{ github.event_name }}
4651
COMMENT_BODY: ${{ github.event.comment.body }}
52+
REVIEW_COMMENT_BODY: ${{ github.event.review.body }}
4753
GITHUB_USER_LOGIN: ${{ github.event.sender.login }}
4854
ACTION: "add-remove-labels"
4955
run: uv run python .github/workflows/scripts/pr_workflow.py
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Push Container Image On PR Merge
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
7+
permissions:
8+
pull-requests: write
9+
contents: write
10+
issues: write
11+
12+
jobs:
13+
if_merged:
14+
if: github.event.pull_request.merged == true
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
- name: Set env TAG
20+
run: |
21+
if [ ${{ github.event.pull_request.base.ref }} == "main" ]; then
22+
echo "TAG=latest" >> $GITHUB_ENV
23+
else
24+
echo "TAG=${{ github.event.pull_request.base.ref }}" >> "$GITHUB_ENV"
25+
fi
26+
- name: Build Image
27+
id: build-image
28+
uses: redhat-actions/buildah-build@v2
29+
with:
30+
image: opendatahub-tests
31+
tags: ${{ env.TAG }}
32+
containerfiles: |
33+
./Dockerfile
34+
35+
- name: Push To Image Registry
36+
id: push-to-registry
37+
uses: redhat-actions/push-to-registry@v2
38+
with:
39+
image: ${{ steps.build-image.outputs.image }}
40+
tags: ${{ steps.build-image.outputs.tags }}
41+
registry: quay.io/opendatahub
42+
username: ${{ secrets.QUAY_USERNAME }}
43+
password: ${{ secrets.QUAY_PASSWORD }}
44+
45+
- name: Add comment to PR
46+
if: always()
47+
env:
48+
URL: ${{ github.event.pull_request.comments_url }}
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
curl \
52+
-X POST \
53+
$URL \
54+
-H "Content-Type: application/json" \
55+
-H "Authorization: token $GITHUB_TOKEN" \
56+
--data '{ "body": "Status of building tag ${{ env.TAG }}: ${{ steps.build-image.outcome }}. \nStatus of pushing tag ${{ env.TAG }} to image registry: ${{ steps.push-to-registry.outcome }}." }'
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Cherry Pick On Comment
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
cherry-pick:
7+
name: Cherry Pick
8+
if: |
9+
github.event.issue.pull_request != '' &&
10+
contains(github.event.comment.body, '/cherry-pick') &&
11+
((github.event.pull_request.author_association != 'NONE') &&
12+
(github.event.pull_request.author_association != 'MANNEQUIN') &&
13+
(github.event.pull_request.author_association != 'FIRST_TIMER') &&
14+
(github.event.pull_request.author_association != 'FIRST_TIME_CONTRIBUTOR'))
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout the latest code
18+
uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }}
21+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
22+
- name: Automatic Cherry Pick
23+
uses: dbasunag/cherry-pick-pr@master
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Run Label Action on PR Review Event
2+
on:
3+
workflow_run:
4+
workflows: ["Dummy Workflow on review"]
5+
types:
6+
- completed
7+
permissions:
8+
pull-requests: write
9+
contents: write
10+
issues: write
11+
12+
jobs:
13+
run_on_workflow_a_success:
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Run this on Dummy workflow success
18+
run: echo "Dummy Workflow on review completes successfully"
19+
download_context_artifact:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: 'Download artifact'
23+
uses: actions/github-script@v7
24+
with:
25+
script: |
26+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
run_id: context.payload.workflow_run.id,
30+
});
31+
32+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
33+
return artifact.name == "context.json"
34+
})[0];
35+
36+
let download = await github.rest.actions.downloadArtifact({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
artifact_id: matchArtifact.id,
40+
archive_format: 'zip',
41+
});
42+
43+
let fs = require('fs');
44+
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/context.zip`, Buffer.from(download.data));
45+
46+
- name: 'Unzip artifact'
47+
run: unzip context.zip
48+
- name: 'Return Parsed JSON'
49+
uses: actions/github-script@v7
50+
id: return-parsed-json
51+
with:
52+
script: |
53+
let fs = require('fs');
54+
let data = fs.readFileSync('./context.json');
55+
return JSON.parse(data);
56+
outputs:
57+
pr_num: ${{fromJSON(steps.return-parsed-json.outputs.result).pr_num}}
58+
event_action: ${{fromJSON(steps.return-parsed-json.outputs.result).event_action}}
59+
review_state: ${{fromJSON(steps.return-parsed-json.outputs.result).review_state}}
60+
event_name: ${{fromJSON(steps.return-parsed-json.outputs.result).event_name}}
61+
comment_body: ${{fromJSON(steps.return-parsed-json.outputs.result).comment_body}}
62+
review_comment_body: ${{fromJSON(steps.return-parsed-json.outputs.result).review_comment_body}}
63+
user_login: ${{fromJSON(steps.return-parsed-json.outputs.result).user_login}}
64+
action: ${{fromJSON(steps.return-parsed-json.outputs.result).action}}
65+
log_context_values:
66+
needs:
67+
- download_context_artifact
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: 'Set all Env Variable'
71+
run: |
72+
echo "GITHUB_PR_NUMBER=${{ needs.download_context_artifact.outputs.pr_num }}" >> "$GITHUB_ENV"
73+
echo "GITHUB_EVENT_ACTION=${{ needs.download_context_artifact.outputs.event_action }}" >> "$GITHUB_ENV"
74+
echo "GITHUB_EVENT_REVIEW_STATE=${{ needs.download_context_artifact.outputs.review_state }}" >> "$GITHUB_ENV"
75+
echo "GITHUB_EVENT_NAME=${{ needs.download_context_artifact.outputs.event_name }}" >> "$GITHUB_ENV"
76+
echo "COMMENT_BODY=${{ needs.download_context_artifact.outputs.comment_body }}" >> "$GITHUB_ENV"
77+
echo "REVIEW_COMMENT_BODY=${{ needs.download_context_artifact.outputs.review_comment_body }}" >> "$GITHUB_ENV"
78+
echo "GITHUB_USER_LOGIN=${{ needs.download_context_artifact.outputs.user_login }}" >> "$GITHUB_ENV"
79+
echo "ACTION=${{ needs.download_context_artifact.outputs.action }}" >> "$GITHUB_ENV"
80+
- uses: actions/checkout@v4
81+
82+
- name: Install uv
83+
uses: astral-sh/setup-uv@v5
84+
- name: 'Run add-remove-labels action'
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }}
87+
GITHUB_EVENT_NAME: ${{ needs.download_context_artifact.outputs.event_name }}
88+
run: uv run python .github/workflows/scripts/pr_workflow.py

.github/workflows/scripts/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
SUCCESS_STR: str = "success"
1212
FAILURE_STR: str = "failure"
1313
QUEUED_STR: str = "queued"
14+
APPROVED: str = "approved"
1415

1516
SUPPORTED_LABELS: set[str] = {
1617
f"{LABEL_PREFIX}{WIP_LABEL_STR}",
@@ -34,6 +35,8 @@
3435
`lgtm` label removed on each new commit push.
3536
* To mark PR as verified comment `/verified` to the PR, to un-verify comment `/verified cancel` to the PR.
3637
`verified` label removed on each new commit push.
38+
* To Cherry-pick a merged PR `/cherry-pick <target_branch_name>` to the PR. If <target_branch_name> is valid,
39+
and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
3740
3841
<details>
3942
<summary>Supported labels</summary>

0 commit comments

Comments
 (0)