From 835a9fa7828d1849df10555de1a0d8a91cc9465c Mon Sep 17 00:00:00 2001 From: ishaansehgal99 Date: Thu, 4 Apr 2024 17:15:27 -0700 Subject: [PATCH] fix: Checkout Evans awesome fork --- .github/workflows/e2e-preset-test.yml | 6 +----- .github/workflows/kind-cluster/determine_models.py | 14 +++++++++++--- .github/workflows/preset-image-build.yml | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e-preset-test.yml b/.github/workflows/e2e-preset-test.yml index c22e7d6cc..3c2b1365d 100644 --- a/.github/workflows/e2e-preset-test.yml +++ b/.github/workflows/e2e-preset-test.yml @@ -48,6 +48,7 @@ jobs: run: | PR_BRANCH=${{ env.BRANCH_NAME }} \ FORCE_RUN_ALL=${{ env.FORCE_RUN_ALL }} \ + PR_REPO_URL=${{ github.event.pull_request.head.repo.clone_url }} \ python3 .github/workflows/kind-cluster/determine_models.py - name: Print Determined Models @@ -274,11 +275,6 @@ jobs: if: steps.check_test_image.outputs.IMAGE_EXISTS == 'true' && (steps.check_prod_image.outputs.IMAGE_EXISTS == 'false' || env.FORCE_RUN_ALL == 'true') run: | curl http://${{ steps.get_ip.outputs.SERVICE_IP }}:80/healthz - - - name: Test version endpoint - if: steps.check_test_image.outputs.IMAGE_EXISTS == 'true' && (steps.check_prod_image.outputs.IMAGE_EXISTS == 'false' || env.FORCE_RUN_ALL == 'true') - run: | - curl http://${{ steps.get_ip.outputs.SERVICE_IP }}:80/version - name: Test inference endpoint if: steps.check_test_image.outputs.IMAGE_EXISTS == 'true' && (steps.check_prod_image.outputs.IMAGE_EXISTS == 'false' || env.FORCE_RUN_ALL == 'true') diff --git a/.github/workflows/kind-cluster/determine_models.py b/.github/workflows/kind-cluster/determine_models.py index 5ace3ba63..18b5773e1 100644 --- a/.github/workflows/kind-cluster/determine_models.py +++ b/.github/workflows/kind-cluster/determine_models.py @@ -90,7 +90,7 @@ def models_to_build(files_changed): seen_model_types.add(model_info["type"]) return list(models) -def check_modified_models(pr_branch): +def check_modified_models(pr_branch, pr_repo_url): """Check for modified models in the repository.""" repo_dir = Path.cwd() / "repo" @@ -102,7 +102,14 @@ def check_modified_models(pr_branch): run_command("git checkout --detach") run_command("git fetch origin main:main") - run_command(f"git fetch origin {pr_branch}:{pr_branch}") + + fetch_command = f"git fetch origin {pr_branch}:{pr_branch}" + if pr_repo_url != KAITO_REPO_URL: + # Add the PR's repo as a new remote only if it's different from the main repo + run_command("git remote add pr_repo {}".format(pr_repo_url)) + fetch_command = f"git fetch pr_repo {pr_branch}" + + run_command(fetch_command) run_command(f"git checkout {pr_branch}") files = run_command("git diff --name-only origin/main") # Returns each file on newline @@ -118,6 +125,7 @@ def check_modified_models(pr_branch): def main(): pr_branch = os.environ.get("PR_BRANCH", "main") # If not specified default to 'main' force_run_all = os.environ.get("FORCE_RUN_ALL", "false") # If not specified default to False + pr_repo_url = os.environ.get("PR_REPO_URL", KAITO_REPO_URL) affected_models = [] if force_run_all != "false": @@ -125,7 +133,7 @@ def main(): else: # Logic to determine affected models # Example: affected_models = ['model1', 'model2', 'model3'] - affected_models = check_modified_models(pr_branch) + affected_models = check_modified_models(pr_branch, pr_repo_url) # Convert the list of models into JSON matrix format matrix = create_matrix(affected_models) diff --git a/.github/workflows/preset-image-build.yml b/.github/workflows/preset-image-build.yml index 5cdb8f98e..a5f100560 100644 --- a/.github/workflows/preset-image-build.yml +++ b/.github/workflows/preset-image-build.yml @@ -55,6 +55,7 @@ jobs: run: | PR_BRANCH=${{ env.BRANCH_NAME }} \ FORCE_RUN_ALL=${{ env.FORCE_RUN_ALL }} \ + PR_REPO_URL=${{ github.event.pull_request.head.repo.clone_url }} \ python3 .github/workflows/kind-cluster/determine_models.py - name: Print Determined Models