Skip to content

Commit 3da4299

Browse files
authored
Reusable compat workflow (#21290)
* DF1 compat workflow * get version from go.mod * attach to build * review fixes * set us-east * change registry * add workflow_dispatch trigger * make workflow appear * rollback * make workflow appear * fix * make workflow appear * rollback * fix * remove trigger for now
1 parent 01b76a7 commit 3da4299

File tree

4 files changed

+229
-19
lines changed

4 files changed

+229
-19
lines changed
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Upgrade Compatibility Test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
buildcmd:
7+
description: "Build command to run"
8+
required: true
9+
type: string
10+
envcmd:
11+
description: "Environment setup command to run"
12+
required: true
13+
type: string
14+
testcmd:
15+
description: "Test command to run"
16+
required: true
17+
type: string
18+
nodes:
19+
description: "Number of nodes for the test"
20+
required: false
21+
default: "3"
22+
type: string
23+
versions-back:
24+
description: "Number of versions to go back for compatibility testing"
25+
required: false
26+
default: "2"
27+
type: string
28+
working-directory:
29+
description: "Working directory for commands"
30+
required: false
31+
default: "devenv"
32+
type: string
33+
logs-directory:
34+
description: "Logs directory"
35+
required: true
36+
type: string
37+
ctf-log-level:
38+
description: "CTF log level"
39+
required: false
40+
default: "info"
41+
type: string
42+
43+
workflow_dispatch:
44+
inputs:
45+
buildcmd:
46+
description: "Build command to run"
47+
required: true
48+
type: string
49+
envcmd:
50+
description: "Environment setup command to run"
51+
required: true
52+
type: string
53+
testcmd:
54+
description: "Test command to run"
55+
required: true
56+
type: string
57+
nodes:
58+
description: "Number of nodes for the test"
59+
required: false
60+
default: "3"
61+
type: string
62+
versions-back:
63+
description: "Number of versions to go back for compatibility testing"
64+
required: false
65+
default: "2"
66+
type: string
67+
working-directory:
68+
description: "Working directory for commands"
69+
required: false
70+
default: "devenv"
71+
type: string
72+
logs-directory:
73+
description: "Logs directory"
74+
required: true
75+
type: string
76+
ctf-log-level:
77+
description: "CTF log level"
78+
required: false
79+
default: "info"
80+
type: string
81+
82+
83+
concurrency:
84+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }}
85+
cancel-in-progress: true
86+
87+
jobs:
88+
compatibility:
89+
permissions:
90+
id-token: write
91+
contents: read
92+
pull-requests: write
93+
runs-on: ubuntu24.04-16cores-64GB # ghv-ignore!
94+
defaults:
95+
run:
96+
working-directory: ${{ github.event_name == 'workflow_call' && inputs.working-directory || github.event.inputs.working-directory }}
97+
env:
98+
BUILD_CMD: ${{ github.event_name == 'workflow_call' && inputs.buildcmd || github.event.inputs.buildcmd }}
99+
ENV_CMD: ${{ github.event_name == 'workflow_call' && inputs.envcmd || github.event.inputs.envcmd }}
100+
TEST_CMD: ${{ github.event_name == 'workflow_call' && inputs.testcmd || github.event.inputs.testcmd }}
101+
NODES: ${{ github.event_name == 'workflow_call' && inputs.nodes || github.event.inputs.nodes }}
102+
VERSIONS_BACK: ${{ github.event_name == 'workflow_call' && inputs.versions-back || github.event.inputs.versions-back }}
103+
WORKING_DIR: ${{ github.event_name == 'workflow_call' && inputs.working-directory || github.event.inputs.working-directory }}
104+
LOGS_DIR: ${{ github.event_name == 'workflow_call' && inputs.logs-directory || github.event.inputs.logs-directory }}
105+
CTF_LOG_LEVEL: ${{ github.event_name == 'workflow_call' && inputs.ctf-log-level || github.event.inputs.ctf-log-level }}
106+
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v5
110+
with:
111+
fetch-depth: 0
112+
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || '' }}
113+
114+
- name: Set up Docker Buildx
115+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
116+
117+
- name: Install Just
118+
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
119+
with:
120+
just-version: "1.40.0"
121+
122+
- name: Configure AWS credentials using OIDC
123+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
124+
with:
125+
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_SDLC_ECR_READONLY_ARN }}
126+
aws-region: us-west-2
127+
128+
- name: Authenticate to ECR
129+
id: login-ecr
130+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
131+
132+
- name: Set up Go
133+
uses: actions/setup-go@v6 # v6
134+
with:
135+
cache: true
136+
go-version-file: ${{ env.WORKING_DIR }}/go.mod
137+
cache-dependency-path: ${{ env.WORKING_DIR }}/go.sum
138+
139+
- name: Download Go dependencies
140+
run: |
141+
go mod download
142+
working-directory: ${{ env.WORKING_DIR }}
143+
144+
- name: Get CTF version from go.mod
145+
shell: bash
146+
working-directory: ${{ env.WORKING_DIR }}
147+
run: |
148+
CTF_VERSION=$(go list -m -json "github.com/smartcontractkit/chainlink-testing-framework/framework" | jq -r .Version)
149+
echo "CTF_TAG=framework/$CTF_VERSION" >> $GITHUB_ENV
150+
151+
- name: Install CTF binary
152+
shell: bash
153+
working-directory: ${{ env.WORKING_DIR }}
154+
env:
155+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
run: |
157+
mkdir -p bin
158+
gh release download "${{ env.CTF_TAG }}" --pattern "framework-v*-linux-amd64.tar.gz" --clobber --repo smartcontractkit/chainlink-testing-framework -O ctf.tar.gz
159+
tar -xzf ctf.tar.gz
160+
mv ctf bin/ctf
161+
chmod +x bin/ctf
162+
163+
- name: Run compat test
164+
working-directory: ${{ env.WORKING_DIR }}
165+
shell: bash
166+
env:
167+
CTF_LOG_LEVEL: ${{ env.CTF_LOG_LEVEL }}
168+
FAKE_SERVER_IMAGE: ${{ secrets.FAKE_SERVER_IMAGE }}
169+
REGISTRY: ${{ secrets.REGISTRY_SDLC }}/chainlink
170+
BUILD_CMD: ${{ env.BUILD_CMD }}
171+
ENV_CMD: ${{ env.ENV_CMD }}
172+
TEST_CMD: ${{ env.TEST_CMD }}
173+
NODES: ${{ env.NODES }}
174+
VERSIONS_BACK: ${{ env.VERSIONS_BACK }}
175+
run: |
176+
./bin/ctf compat backward \
177+
--registry "${REGISTRY}" \
178+
--buildcmd "${BUILD_CMD}" \
179+
--envcmd "${ENV_CMD}" \
180+
--testcmd "${TEST_CMD}" \
181+
--nodes "${NODES}" \
182+
--versions-back "${VERSIONS_BACK}"
183+
184+
- name: Upload Logs
185+
if: always()
186+
uses: actions/upload-artifact@v4
187+
with:
188+
name: container-logs-smoke
189+
path: ${{ env.LOGS_DIR }}
190+
retention-days: 3

devenv/Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ push-fakes registry:
1515

1616
# Rebuild CLI
1717
cli:
18-
pushd cmd/cl > /dev/null && go install -ldflags="-X main.Version=1.0.0" . && popd > /dev/null
18+
cd cmd/cl && go install -ldflags="-X main.Version=1.0.0" . && cd - > /dev/null || exit 1

devenv/go.mod

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/smartcontractkit/chainlink-evm v0.3.3
2626
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20251211123524-f0c4fe7cfc0a
2727
github.com/smartcontractkit/chainlink-protos/job-distributor v0.12.0
28-
github.com/smartcontractkit/chainlink-testing-framework/framework v0.13.10
28+
github.com/smartcontractkit/chainlink-testing-framework/framework v0.14.6
2929
github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake v0.10.1-0.20250711120409-5078050f9db4
3030
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5
3131
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.51.2
@@ -150,7 +150,7 @@ require (
150150
github.com/golang/protobuf v1.5.4 // indirect
151151
github.com/golang/snappy v1.0.0 // indirect
152152
github.com/google/btree v1.1.3 // indirect
153-
github.com/google/gnostic-models v0.6.8 // indirect
153+
github.com/google/gnostic-models v0.6.9 // indirect
154154
github.com/google/go-cmp v0.7.0 // indirect
155155
github.com/google/gofuzz v1.2.0 // indirect
156156
github.com/google/s2a-go v0.1.9 // indirect
@@ -222,6 +222,7 @@ require (
222222
github.com/moby/docker-image-spec v1.3.1 // indirect
223223
github.com/moby/go-archive v0.1.0 // indirect
224224
github.com/moby/patternmatcher v0.6.0 // indirect
225+
github.com/moby/spdystream v0.5.0 // indirect
225226
github.com/moby/sys/sequential v0.6.0 // indirect
226227
github.com/moby/sys/user v0.4.0 // indirect
227228
github.com/moby/sys/userns v0.1.0 // indirect
@@ -233,6 +234,7 @@ require (
233234
github.com/mr-tron/base58 v1.2.0 // indirect
234235
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
235236
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
237+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
236238
github.com/oklog/ulid v1.3.1 // indirect
237239
github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.116.0 // indirect
238240
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.116.0 // indirect
@@ -361,11 +363,11 @@ require (
361363
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
362364
gopkg.in/yaml.v2 v2.4.0 // indirect
363365
gopkg.in/yaml.v3 v3.0.1 // indirect
364-
k8s.io/api v0.32.2 // indirect
365-
k8s.io/apimachinery v0.32.2 // indirect
366-
k8s.io/client-go v0.32.2 // indirect
366+
k8s.io/api v0.32.3 // indirect
367+
k8s.io/apimachinery v0.32.3 // indirect
368+
k8s.io/client-go v0.32.3 // indirect
367369
k8s.io/klog/v2 v2.130.1 // indirect
368-
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
370+
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
369371
k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 // indirect
370372
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
371373
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect

0 commit comments

Comments
 (0)