@@ -79,17 +79,49 @@ jobs:
7979 id-token : write
8080 contents : read
8181 actions : read
82- env :
83- CATALOG_SERVICE_IMAGE : ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/op-catalog-service:latest
8482 steps :
83+ - name : Checkout code
84+ uses : actions/checkout@v4
85+
86+ - name : Configure AWS credentials for ECR
87+ uses : aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
88+ with :
89+ role-to-assume : ${{ secrets.ECR_READ_ROLE_ARN }}
90+ aws-region : ${{ secrets.AWS_REGION }}
91+
92+ - name : Get latest catalog service tag from ECR
93+ id : get-catalog-tag
94+ run : |
95+ # Fetch all image tags from ECR and get the latest semantic version tag
96+ # Get all tags, filter for semantic versions (vX.Y.Z), and sort properly
97+ LATEST_TAG=$(aws ecr describe-images \
98+ --repository-name op-catalog-service \
99+ --region ${{ secrets.AWS_REGION }} \
100+ --registry-id ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }} \
101+ --output json | \
102+ jq -r '.imageDetails[].imageTags[]? // empty' | \
103+ grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | \
104+ sed 's/^v//' | \
105+ sort -t. -k1,1n -k2,2n -k3,3n | \
106+ tail -1 | \
107+ sed 's/^/v/')
108+
109+ if [[ -z "${LATEST_TAG}" ]]; then
110+ echo "::error::Could not find a valid semantic version tag in ECR"
111+ exit 1
112+ fi
113+
114+ echo "Latest catalog service tag from ECR: ${LATEST_TAG}"
115+ echo "tag=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
116+
85117 - name : Pull Catalog Service ECR Image
86118 uses : smartcontractkit/.github/actions/pull-private-ecr-image@2f8f0baf38e46140c6a119eb551a56eaaabcc09e # pull-private-ecr-image@1.0.0
87119 with :
88120 aws-account-number : ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}
89121 aws-region : ${{ secrets.AWS_REGION }}
90122 aws-role-arn : ${{ secrets.ECR_READ_ROLE_ARN }}
91123 ecr-repository : " op-catalog-service"
92- image-tag : " latest "
124+ image-tag : ${{ steps.get-catalog-tag.outputs.tag }}
93125
94126 - name : Run Catalog Remote Integration Tests
95127 uses : smartcontractkit/.github/actions/ci-test-go@dfcba48f05933158428bce867d790e3d5a9baa6b # ci-test-go@1.1.0
98130 go-test-cmd : cd datastore/catalog/remote && go test -v -race -timeout 10m -gcflags=all=-d=checkptr=0 -coverprofile=../../../coverage.txt
99131 use-go-cache : true
100132 artifact-name : catalog-remote-tests
133+ env :
134+ CATALOG_SERVICE_IMAGE : ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/op-catalog-service:${{ steps.get-catalog-tag.outputs.tag }}
101135
102136 sonarqube :
103137 name : Sonar Scan
0 commit comments