66 branches :
77 - mainline
88 - releases/*
9+ - li/fix-compatibility-tests # Fix this
910 paths-ignore :
1011 - ' **.md'
1112 workflow_dispatch :
2021
2122# Setting MAX_VERSIONS_TO_TEST, this can be a configurable value or if no input is provided, it can be a default value.
2223env :
23- MAX_VERSIONS_TO_TEST : ${{ github.event.inputs.max_versions_to_test || 5 }}
24+ MAX_VERSIONS_TO_TEST : ${{ github.event.inputs.max_versions_to_test || 1 }} # TODO - Change it back to 5
2425
2526jobs :
2627 check-if-image-exists :
3132
3233 outputs :
3334 image_exists : ${{ steps.check-image.outputs.image_exists }}
34- image_identifier : ${{ steps.check-image.outputs.image_identifier }}
35+ api_image_identifier : ${{ steps.check-image.outputs.image_identifier }}
36+ inference_orchestrator_image_identifier : ${{ steps.check-image.outputs.image_identifier }}
37+ model_management_image_identifier : ${{ steps.check-image.outputs.image_identifier }}
3538 steps :
3639 - name : Checkout marqo repo
3740 uses : actions/checkout@v3
@@ -45,23 +48,48 @@ jobs:
4548 aws-secret-access-key : ${{ secrets.ECR_PUSHER_AWS_SECRET_ACCESS_KEY }}
4649 aws-region : us-east-1
4750
48- # step to check for image existence - it uses aws cli to check if the image exists in the ECR registry "marqo-compatibility-tests"
49- - name : Check image existence and get identifier
51+ # step to check for image existence - it uses aws cli to check if the all 3 images exists in
52+ # the ECR registry "marqo-compatibility-tests/<repo>" with tag as the current commit sha.
53+ - name : Check image existence and get identifiers
5054 id : check-image
55+ shell : bash
5156 run : |
52- echo "Checking for image existence"
53- if IMAGE_DETAILS=$(aws ecr describe-images --repository-name marqo-compatibility-tests --image-ids imageTag=${{ github.sha }} 2>/dev/null); then
54- echo "image_exists=true" >> $GITHUB_OUTPUT
55- echo "Image already exists in ECR, will not build and push again. Will be using the image digest from existing image"
56-
57- IMAGE_IDENTIFIER=$(echo "$IMAGE_DETAILS" | jq -r '.imageDetails[0].imageDigest')
58- REGISTRY_ID="424082663841.dkr.ecr.us-east-1.amazonaws.com"
59- FULL_IDENTIFIER="${REGISTRY_ID}/marqo-compatibility-tests@${IMAGE_IDENTIFIER}"
60- echo "image_identifier=${FULL_IDENTIFIER}" >> $GITHUB_OUTPUT
61- else
62- echo "image_exists=false" >> $GITHUB_OUTPUT
63- echo "Image doesn't exist"
64- fi
57+ set -euo pipefail
58+ echo "Checking ECR images for commit: ${{ github.sha }}"
59+
60+ REGISTRY_ID="424082663841.dkr.ecr.us-east-1.amazonaws.com"
61+ REPO_PREFIX="marqo-compatibility-tests"
62+
63+ # Format: "<repo-name>:<output-var>"
64+ repos=(
65+ " api:api_image_identifier"
66+ " inference-orchestrator:inference_orchestrator_image_identifier"
67+ " model-management:model_management_image_identifier"
68+ )
69+
70+ for pair in "${repos[@]}"; do
71+ IFS=':' read -r repo out_var <<< "$pair"
72+
73+ # Try to fetch the digest for the given tag; returns "None" if not found
74+ digest=$(aws ecr describe-images \
75+ --repository-name "${REPO_PREFIX}/${repo}" \
76+ --image-ids imageTag=${{ github.sha }} \
77+ --query 'imageDetails[0].imageDigest' \
78+ --output text 2>/dev/null || true)
79+
80+ if [[ -z "$digest" || "$digest" == "None" ]]; then
81+ echo "Image ${REPO_PREFIX}/${repo}:${{ github.sha }} doesn't exist."
82+ echo "image_exists=false" >> "$GITHUB_OUTPUT"
83+ exit 0
84+ fi
85+
86+ full="${REGISTRY_ID}/${REPO_PREFIX}/${repo}@${digest}"
87+ echo "${out_var}=${full}" >> "$GITHUB_OUTPUT"
88+ echo "Found : ${full}"
89+ done
90+
91+ echo "All images exist in ECR."
92+ echo "image_exists=true" >> "$GITHUB_OUTPUT"
6593
6694 build-and-push-image :
6795 # Job to actually build and push image to ECR registry. This job is only triggered if the image does not already exist in the ECR registry.
@@ -72,14 +100,14 @@ jobs:
72100 secrets : inherit
73101 with :
74102 marqo_ref : " ${{ github.sha }}"
75- push_to : " ECR"
76- image_repo : " marqo-compatibility-tests"
103+ push_to : " OS- ECR"
104+ image_namespace : " marqo-compatibility-tests"
77105 image_tag : " ${{ github.sha }}"
106+ platforms : ' linux/amd64'
78107 permissions :
79108 id-token : write
80109 contents : read
81110
82-
83111 orchestrate :
84112 # Job to orchestrate backwards compatibility test execution. Majorly responsible for determining to_version and for generating the list of from_version(s) to test against.
85113 name : Orchestrate backwards compatibility test execution
0 commit comments