Skip to content

Commit 153618a

Browse files
committed
fix(ci): get latest tag for catalog remote tests
1 parent f295b3c commit 153618a

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

.github/workflows/pull-request-main.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,28 @@ 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: Get latest catalog service tag
87+
id: get-catalog-tag
88+
run: |
89+
# Fetch the latest tag from the catalog service repository
90+
LATEST_TAG=$(gh api repos/smartcontractkit/op-catalog/releases/latest --jq '.tag_name')
91+
echo "Latest catalog service tag: ${LATEST_TAG}"
92+
echo "tag=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
93+
env:
94+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
8596
- name: Pull Catalog Service ECR Image
8697
uses: smartcontractkit/.github/actions/pull-private-ecr-image@2f8f0baf38e46140c6a119eb551a56eaaabcc09e # pull-private-ecr-image@1.0.0
8798
with:
8899
aws-account-number: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}
89100
aws-region: ${{ secrets.AWS_REGION }}
90101
aws-role-arn: ${{ secrets.ECR_READ_ROLE_ARN }}
91102
ecr-repository: "op-catalog-service"
92-
image-tag: "latest"
103+
image-tag: ${{ steps.get-catalog-tag.outputs.tag }}
93104

94105
- name: Run Catalog Remote Integration Tests
95106
uses: smartcontractkit/.github/actions/ci-test-go@dfcba48f05933158428bce867d790e3d5a9baa6b # ci-test-go@1.1.0
@@ -98,6 +109,8 @@ jobs:
98109
go-test-cmd: cd datastore/catalog/remote && go test -v -race -timeout 10m -gcflags=all=-d=checkptr=0 -coverprofile=../../../coverage.txt
99110
use-go-cache: true
100111
artifact-name: catalog-remote-tests
112+
env:
113+
CATALOG_SERVICE_IMAGE: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/op-catalog-service:${{ steps.get-catalog-tag.outputs.tag }}
101114

102115
sonarqube:
103116
name: Sonar Scan

.github/workflows/schedule-main.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,28 @@ jobs:
7575
id-token: write
7676
contents: read
7777
actions: read
78-
env:
79-
CATALOG_SERVICE_IMAGE: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/op-catalog-service:latest
8078
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Get latest catalog service tag
83+
id: get-catalog-tag
84+
run: |
85+
# Fetch the latest tag from the catalog service repository
86+
LATEST_TAG=$(gh api repos/smartcontractkit/op-catalog/releases/latest --jq '.tag_name')
87+
echo "Latest catalog service tag: ${LATEST_TAG}"
88+
echo "tag=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
89+
env:
90+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
8192
- name: Pull Catalog Service ECR Image
8293
uses: smartcontractkit/.github/actions/pull-private-ecr-image@2f8f0baf38e46140c6a119eb551a56eaaabcc09e # pull-private-ecr-image@1.0.0
8394
with:
8495
aws-account-number: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}
8596
aws-region: ${{ secrets.AWS_REGION }}
8697
aws-role-arn: ${{ secrets.ECR_READ_ROLE_ARN }}
8798
ecr-repository: "op-catalog-service"
88-
image-tag: "latest"
99+
image-tag: ${{ steps.get-catalog-tag.outputs.tag }}
89100

90101
- name: Run Catalog Remote Integration Tests
91102
uses: smartcontractkit/.github/actions/ci-test-go@dfcba48f05933158428bce867d790e3d5a9baa6b # ci-test-go@1.1.0
@@ -94,6 +105,8 @@ jobs:
94105
go-test-cmd: cd datastore/catalog/remote && go test -v -race -timeout 10m -gcflags=all=-d=checkptr=0 -coverprofile=../../../coverage.txt
95106
use-go-cache: true
96107
artifact-name: catalog-remote-tests
108+
env:
109+
CATALOG_SERVICE_IMAGE: ${{ secrets.AWS_ACCOUNT_NUMBER_PROD }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/op-catalog-service:${{ steps.get-catalog-tag.outputs.tag }}
97110

98111
sonarqube:
99112
name: Sonar Scan

0 commit comments

Comments
 (0)