Skip to content

Commit 355f78c

Browse files
authored
Use the correct SDK version in the SDK execution tests CI (kubeflow#11683)
The KFP SDK execution tests weren't using the SDK from the pull request. Additionally, this commit adds support for choosing the right SDK in forks. Signed-off-by: mprahl <[email protected]>
1 parent 976fba8 commit 355f78c

File tree

8 files changed

+20
-9
lines changed

8 files changed

+20
-9
lines changed

.github/workflows/kfp-samples.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
id: tests
4949
env:
5050
PULL_NUMBER: ${{ github.event.pull_request.number }}
51+
REPO_NAME: ${{ github.repository }}
5152
run: |
5253
./backend/src/v2/test/sample-test.sh
5354
continue-on-error: true

.github/workflows/kfp-sdk-runtime-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ jobs:
2828
- name: Run KFP Runtime Code Tests
2929
run: |
3030
export PULL_NUMBER="${{ github.event.inputs.pull_number || github.event.pull_request.number }}"
31+
export REPO_NAME="${{ github.repository }}"
3132
./test/presubmit-test-kfp-runtime-code.sh

.github/workflows/sdk-execution.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ jobs:
6666

6767
- name: Run tests
6868
id: tests
69+
env:
70+
PULL_NUMBER: ${{ github.event.pull_request.number }}
71+
REPO_NAME: ${{ github.repository }}
6972
run: |
7073
export KFP_ENDPOINT="http://localhost:8888"
7174
export TIMEOUT_SECONDS=2700

backend/src/v2/test/sample-test.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ python3 -m pip install -r ./requirements-sample-test.txt
2323

2424
popd
2525

26+
REPO_NAME="${REPO_NAME:-kubeflow/pipelines}"
27+
2628
if [[ -n "${PULL_NUMBER}" ]]; then
27-
export KFP_PACKAGE_PATH="git+https://github.com/kubeflow/pipelines@refs/pull/${PULL_NUMBER}/merge#egg=kfp&subdirectory=sdk/python"
29+
export KFP_PACKAGE_PATH="git+https://github.com/${REPO_NAME}@refs/pull/${PULL_NUMBER}/merge#egg=kfp&subdirectory=sdk/python"
2830
else
29-
export KFP_PACKAGE_PATH='git+https://github.com/kubeflow/pipelines#egg=kfp&subdirectory=sdk/python'
31+
export KFP_PACKAGE_PATH="git+https://github.com/${REPO_NAME}#egg=kfp&subdirectory=sdk/python"
3032
fi
3133

3234
python3 -m pip install $KFP_PACKAGE_PATH

backend/src/v2/test/scripts/ci-env.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ GCS_ROOT="gs://${PROJECT}/${COMMIT_SHA}/v2-sample-test"
1818
GCR_ROOT="gcr.io/${PROJECT}/${COMMIT_SHA}/v2-sample-test"
1919
# This is kfp-ci endpoint.
2020
HOST=${HOST:-"https://$(curl https://raw.githubusercontent.com/kubeflow/testing/master/test-infra/kfp/endpoint)"}
21+
REPO_NAME="${REPO_NAME:-kubeflow/pipelines}"
2122

2223
if [[ -z "${PULL_NUMBER}" ]]; then
23-
KFP_PACKAGE_PATH='git+https://github.com/kubeflow/pipelines\#egg=kfp&subdirectory=sdk/python'
24+
KFP_PACKAGE_PATH="git+https://github.com/${REPO_NAME}#egg=kfp&subdirectory=sdk/python"
2425
else
25-
KFP_PACKAGE_PATH='git+https://github.com/kubeflow/pipelines@refs/pull/${PULL_NUMBER}/merge\#egg=kfp&subdirectory=sdk/python'
26+
KFP_PACKAGE_PATH="git+https://github.com/${REPO_NAME}@refs/pull/${PULL_NUMBER}/merge#egg=kfp&subdirectory=sdk/python"
2627
fi
2728

2829
cat <<EOF >kfp-ci.env

test/kfp-kubernetes-execution-tests/sdk_execution_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ def run(test_case: TestCase) -> Tuple[str, client.client.RunPipelineResult]:
110110

111111

112112
def get_kfp_package_path() -> str:
113+
repo_name = os.environ.get('REPO_NAME', 'kubeflow/pipelines')
113114
if os.environ.get('PULL_NUMBER') is not None:
114-
path = f'git+https://github.com/kubeflow/pipelines.git@refs/pull/{os.environ.get("PULL_NUMBER")}/merge#subdirectory=sdk/python'
115+
path = f'git+https://github.com/{repo_name}.git@refs/pull/{os.environ["PULL_NUMBER"]}/merge#subdirectory=sdk/python'
115116
else:
116-
path = 'git+https://github.com/kubeflow/pipelines.git@master#subdirectory=sdk/python'
117+
path = 'git+https://github.com/{repo_name}.git@master#subdirectory=sdk/python'
117118
print(f'Using the following KFP package path for tests: {path}')
118119
return path
119120

test/presubmit-tests-sdk.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ pytest sdk/python/kfp --cov=kfp
3636
set +x
3737
# export COVERALLS_REPO_TOKEN=$(gsutil cat gs://ml-pipeline-test-keys/coveralls_repo_token)
3838
set -x
39-
REPO_BASE="https://github.com/kubeflow/pipelines"
39+
REPO_NAME="${REPO_NAME:-kubeflow/pipelines}"
40+
REPO_BASE="https://github.com/${REPO_NAME}"
4041
export COVERALLS_SERVICE_NAME="prow"
4142
export COVERALLS_SERVICE_JOB_ID=$PROW_JOB_ID
4243
export CI_PULL_REQUEST="$REPO_BASE/pull/$PULL_NUMBER"

test/sdk-execution-tests/sdk_execution_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ def run(test_case: TestCase) -> Tuple[str, client.client.RunPipelineResult]:
9999

100100

101101
def get_kfp_package_path() -> str:
102+
repo_name = os.environ.get('REPO_NAME', 'kubeflow/pipelines')
102103
if os.environ.get('PULL_NUMBER') is not None:
103-
path = f'git+https://github.com/kubeflow/pipelines.git@refs/pull/{os.environ.get("PULL_NUMBER")}/merge#subdirectory=sdk/python'
104+
path = f'git+https://github.com/{repo_name}.git@refs/pull/{os.environ["PULL_NUMBER"]}/merge#subdirectory=sdk/python'
104105
else:
105-
path = 'git+https://github.com/kubeflow/pipelines.git@master#subdirectory=sdk/python'
106+
path = 'git+https://github.com/{repo_name}.git@master#subdirectory=sdk/python'
106107
print(f'Using the following KFP package path for tests: {path}')
107108
return path
108109

0 commit comments

Comments
 (0)