Skip to content

Commit

Permalink
fix: Checkout Evans awesome fork
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaansehgal99 committed Apr 5, 2024
1 parent 9db1a04 commit 835a9fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/e2e-preset-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/kind-cluster/determine_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand All @@ -118,14 +125,15 @@ 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":
affected_models = [model['name'] for model in YAML_PR['models']]
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)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/preset-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 835a9fa

Please sign in to comment.