Skip to content

Commit 36e0791

Browse files
authored
Merge branch 'main' into scc
2 parents b126825 + ac5a130 commit 36e0791

File tree

14 files changed

+279
-99
lines changed

14 files changed

+279
-99
lines changed

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

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ on:
1111

1212
issue_comment:
1313
types: [created, edited, deleted]
14-
# I don't believe the conditional is supported here
15-
# if: |
16-
# contains(github.event.comment.body, '/wip') ||
17-
# contains(github.event.comment.body, '/verified') ||
18-
# contains(github.event.comment.body, '/lgtm') ||
19-
# contains(github.event.comment.body, '/hold')
2014

2115

2216
permissions:
@@ -26,6 +20,12 @@ permissions:
2620

2721
jobs:
2822
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')
2929
runs-on: ubuntu-latest
3030

3131
steps:
@@ -36,27 +36,6 @@ jobs:
3636
comment-id: ${{ github.event.comment.id }}
3737
reactions: '+1'
3838

39-
# This currently fails with either the bot PAT or the standard github token secret
40-
# gh: Insufficient scopes for reacting to this Pull Request Review Comment. (HTTP 403)
41-
# {"message":"Insufficient scopes for reacting to this Pull Request Review Comment.","documentation_url":"https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment","status":"403"}
42-
# It could work if we had a token with the proper permissions.
43-
# See https://github.com/peter-evans/create-or-update-comment/issues/392 for why the action above doesn't work.
44-
# Confirmed as a bug, see: https://github.com/github/docs/issues/36899
45-
# - name: Acknowledge the review with thumbs up reaction
46-
# if: ${{ github.event.review }}
47-
# env:
48-
# GH_TOKEN: ${{ secrets.OPENDATAHUB_TESTS_BOT_PAT }}
49-
# REVIEW_COMMENT_ID: ${{ github.event.review.id }}
50-
# REPO_NAME: ${{ github.event.repository.name }}
51-
# REPO_OWNER: ${{ github.event.repository.owner.login }}
52-
# run: |
53-
# gh api \
54-
# --method POST \
55-
# -H "Accept: application/vnd.github+json" \
56-
# -H "X-GitHub-Api-Version: 2022-11-28" \
57-
# /repos/$REPO_OWNER/$REPO_NAME/pulls/comments/$REVIEW_COMMENT_ID/reactions \
58-
# -f "content=+1"
59-
6039
- uses: actions/checkout@v4
6140

6241
- name: Install uv
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 }}

.github/workflows/scripts/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
`lgtm` label removed on each new commit push.
3636
* To mark PR as verified comment `/verified` to the PR, to un-verify comment `/verified cancel` to the PR.
3737
`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.
3840
3941
<details>
4042
<summary>Supported labels</summary>

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ repos:
3535
- id: detect-secrets
3636

3737
- repo: https://github.com/astral-sh/ruff-pre-commit
38-
rev: v0.11.2
38+
rev: v0.11.4
3939
hooks:
4040
- id: ruff
4141
- id: ruff-format

tests/conftest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from simple_logger.logger import get_logger
2525

2626
from utilities.data_science_cluster_utils import update_components_in_dsc
27+
from utilities.exceptions import ClusterLoginError
2728
from utilities.general import get_s3_secret_dict
2829
from utilities.infra import (
2930
create_ns,
@@ -246,33 +247,36 @@ def unprivileged_client(
246247
non_admin_user_password: tuple[str, str],
247248
) -> Generator[DynamicClient, Any, Any]:
248249
"""
249-
Provides none privileged API client. If non_admin_user_password is None, then it will yield admin_client.
250+
Provides none privileged API client. If non_admin_user_password is None, then it will raise.
250251
"""
251252
if non_admin_user_password is None:
252-
yield admin_client
253+
raise ValueError("Unprivileged user not provisioned")
253254

254255
else:
255256
current_user = run_command(command=["oc", "whoami"])[1].strip()
257+
non_admin_user_name = non_admin_user_password[0]
256258

257259
if login_with_user_password(
258260
api_address=admin_client.configuration.host,
259-
user=non_admin_user_password[0],
261+
user=non_admin_user_name,
260262
password=non_admin_user_password[1],
261263
):
262264
with open(kubconfig_filepath) as fd:
263265
kubeconfig_content = yaml.safe_load(fd)
264266

265267
unprivileged_context = kubeconfig_content["current-context"]
266268

269+
unprivileged_client = get_client(config_file=kubconfig_filepath, context=unprivileged_context)
270+
267271
# Get back to admin account
268272
login_with_user_password(
269273
api_address=admin_client.configuration.host,
270274
user=current_user.strip(),
271275
)
272-
yield get_client(config_file=kubconfig_filepath, context=unprivileged_context)
276+
yield unprivileged_client
273277

274278
else:
275-
yield admin_client
279+
raise ClusterLoginError(user=non_admin_user_name)
276280

277281

278282
@pytest.fixture(scope="session")
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from typing import Generator, Any
2+
3+
import pytest
4+
from kubernetes.dynamic import DynamicClient
5+
from ocp_resources.namespace import Namespace
6+
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
7+
8+
9+
@pytest.fixture(scope="class")
10+
def pvc_minio_namespace(
11+
admin_client: DynamicClient, minio_namespace: Namespace
12+
) -> Generator[PersistentVolumeClaim, Any, Any]:
13+
with PersistentVolumeClaim(
14+
client=admin_client,
15+
name="minio-pvc",
16+
namespace=minio_namespace.name,
17+
accessmodes=PersistentVolumeClaim.AccessMode.RWO,
18+
volume_mode=PersistentVolumeClaim.VolumeMode.FILE,
19+
size="10Gi",
20+
) as pvc:
21+
yield pvc

tests/model_explainability/guardrails/conftest.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def vllm_gateway_config(admin_client: DynamicClient, model_namespace: Namespace)
209209
def minio_llm_deployment(
210210
admin_client: DynamicClient,
211211
minio_namespace: Namespace,
212-
llm_models_pvc: PersistentVolumeClaim,
212+
pvc_minio_namespace: PersistentVolumeClaim,
213213
) -> Generator[Deployment, Any, Any]:
214214
with Deployment(
215215
client=admin_client,
@@ -229,7 +229,7 @@ def minio_llm_deployment(
229229
"volumes": [
230230
{
231231
"name": "model-volume",
232-
"persistentVolumeClaim": {"claimName": "llm-models-claim"},
232+
"persistentVolumeClaim": {"claimName": pvc_minio_namespace.name},
233233
}
234234
],
235235
"initContainers": [
@@ -282,18 +282,3 @@ def minio_llm_deployment(
282282
) as deployment:
283283
deployment.wait_for_replicas(timeout=Timeout.TIMEOUT_10MIN)
284284
yield deployment
285-
286-
287-
@pytest.fixture(scope="class")
288-
def llm_models_pvc(
289-
admin_client: DynamicClient, minio_namespace: Namespace
290-
) -> Generator[PersistentVolumeClaim, Any, Any]:
291-
with PersistentVolumeClaim(
292-
client=admin_client,
293-
name="llm-models-claim",
294-
namespace=minio_namespace.name,
295-
accessmodes=PersistentVolumeClaim.AccessMode.RWO,
296-
volume_mode=PersistentVolumeClaim.VolumeMode.FILE,
297-
size="10Gi",
298-
) as pvc:
299-
yield pvc

0 commit comments

Comments
 (0)