Skip to content

Commit ab65401

Browse files
committed
feat(ci): resolve image commit SHAs for conformance/e2e reports
- CI resolves latest main commit SHA for gateway/dataplane/dashboard - Deploys with sha-<commit> tags instead of :latest - Conformance test logs image SHAs from GATEWAY_IMAGE_SHA, DATAPLANE_IMAGE_SHA, DASHBOARD_IMAGE_SHA env vars - Both conformance.yml and e2e.yml updated
1 parent e0cb346 commit ab65401

3 files changed

Lines changed: 81 additions & 7 deletions

File tree

.github/workflows/conformance.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ jobs:
2121
go-version-file: go.mod
2222
cache-dependency-path: go.sum
2323

24+
- name: Resolve image versions
25+
id: images
26+
run: |
27+
gw_sha=$(curl -sSfL -H "Authorization: Bearer ${{ github.token }}" \
28+
https://api.github.com/repos/nantian-gw/gateway/commits/main | jq -r .sha | cut -c1-7)
29+
dp_sha=$(curl -sSfL -H "Authorization: Bearer ${{ github.token }}" \
30+
https://api.github.com/repos/nantian-gw/dataplane/commits/main | jq -r .sha | cut -c1-7)
31+
db_sha=$(curl -sSfL -H "Authorization: Bearer ${{ github.token }}" \
32+
https://api.github.com/repos/nantian-gw/dashboard/commits/main | jq -r .sha | cut -c1-7)
33+
echo "gateway_sha=${gw_sha}" >> $GITHUB_OUTPUT
34+
echo "dataplane_sha=${dp_sha}" >> $GITHUB_OUTPUT
35+
echo "dashboard_sha=${db_sha}" >> $GITHUB_OUTPUT
36+
echo "gateway: ${gw_sha} dataplane: ${dp_sha} dashboard: ${db_sha}"
37+
2438
- name: Create kind cluster
2539
run: |
2640
kind create cluster --name conformance --wait 5m
@@ -33,19 +47,32 @@ jobs:
3347
3448
- name: Deploy nantian-gw
3549
run: |
36-
kubectl apply -k deploy/kubernetes/overlays/kind-conformance
37-
kubectl wait --for=condition=ready pod --all -n nantian-gw --timeout=180s
50+
cp -r deploy/kubernetes/overlays/kind-conformance /tmp/overlay
51+
kustomize edit set image \
52+
nantian-controlplane=ghcr.io/nantian-gw/nantian-controlplane:sha-${{ steps.images.outputs.gateway_sha }} \
53+
nantian-dataplane=ghcr.io/nantian-gw/dataplane:sha-${{ steps.images.outputs.dataplane_sha }} \
54+
nantian-gw-dashboard=ghcr.io/nantian-gw/dashboard:sha-${{ steps.images.outputs.dashboard_sha }} \
55+
-e /tmp/overlay
56+
kubectl apply -k /tmp/overlay
57+
kubectl wait --for=condition=ready pod --all -n nantian-gw --timeout=300s
3858
3959
- name: Run conformance tests
60+
env:
61+
GATEWAY_IMAGE_SHA: ${{ steps.images.outputs.gateway_sha }}
62+
DATAPLANE_IMAGE_SHA: ${{ steps.images.outputs.dataplane_sha }}
63+
DASHBOARD_IMAGE_SHA: ${{ steps.images.outputs.dashboard_sha }}
4064
run: |
65+
echo "=== Images under test ==="
66+
echo " controlplane: ghcr.io/nantian-gw/nantian-controlplane:sha-${GATEWAY_IMAGE_SHA}"
67+
echo " dataplane: ghcr.io/nantian-gw/dataplane:sha-${DATAPLANE_IMAGE_SHA}"
68+
echo " dashboard: ghcr.io/nantian-gw/dashboard:sha-${DASHBOARD_IMAGE_SHA}"
4169
go test -tags=conformance -count=1 -v -timeout 30m ./conformance/
4270
4371
- name: Collect logs on failure
4472
if: failure()
4573
run: |
4674
kubectl describe pods -n nantian-gw
47-
kubectl logs -n nantian-gw --all-containers --tail=200 -l app=nantian-controlplane
48-
kubectl logs -n nantian-gw --all-containers --tail=200 -l app=nantian-dataplane
75+
kubectl logs -n nantian-gw --all-containers --tail=200 || true
4976
5077
- name: Cleanup
5178
if: always()

.github/workflows/e2e.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19+
- name: Resolve image versions
20+
id: images
21+
run: |
22+
gw_sha=$(curl -sSfL -H "Authorization: Bearer ${{ github.token }}" \
23+
https://api.github.com/repos/nantian-gw/gateway/commits/main | jq -r .sha | cut -c1-7)
24+
dp_sha=$(curl -sSfL -H "Authorization: Bearer ${{ github.token }}" \
25+
https://api.github.com/repos/nantian-gw/dataplane/commits/main | jq -r .sha | cut -c1-7)
26+
db_sha=$(curl -sSfL -H "Authorization: Bearer ${{ github.token }}" \
27+
https://api.github.com/repos/nantian-gw/dashboard/commits/main | jq -r .sha | cut -c1-7)
28+
echo "gateway_sha=${gw_sha}" >> $GITHUB_OUTPUT
29+
echo "dataplane_sha=${dp_sha}" >> $GITHUB_OUTPUT
30+
echo "dashboard_sha=${db_sha}" >> $GITHUB_OUTPUT
31+
echo "gateway: ${gw_sha} dataplane: ${dp_sha} dashboard: ${db_sha}"
32+
1933
- name: Create kind cluster
2034
run: |
2135
kind create cluster --name e2e --wait 5m
@@ -28,11 +42,26 @@ jobs:
2842
2943
- name: Deploy nantian-gw
3044
run: |
31-
kubectl apply -k deploy/kubernetes/overlays/kind-conformance
32-
kubectl wait --for=condition=ready pod --all -n nantian-gw --timeout=180s
45+
cp -r deploy/kubernetes/overlays/kind-conformance /tmp/overlay
46+
kustomize edit set image \
47+
nantian-controlplane=ghcr.io/nantian-gw/nantian-controlplane:sha-${{ steps.images.outputs.gateway_sha }} \
48+
nantian-dataplane=ghcr.io/nantian-gw/dataplane:sha-${{ steps.images.outputs.dataplane_sha }} \
49+
nantian-gw-dashboard=ghcr.io/nantian-gw/dashboard:sha-${{ steps.images.outputs.dashboard_sha }} \
50+
-e /tmp/overlay
51+
kubectl apply -k /tmp/overlay
52+
kubectl wait --for=condition=ready pod --all -n nantian-gw --timeout=300s
3353
3454
- name: Run smoke test
35-
run: CLUSTER_NAME=e2e ./test/e2e/smoke/run.sh --no-cleanup
55+
env:
56+
GATEWAY_IMAGE_SHA: ${{ steps.images.outputs.gateway_sha }}
57+
DATAPLANE_IMAGE_SHA: ${{ steps.images.outputs.dataplane_sha }}
58+
DASHBOARD_IMAGE_SHA: ${{ steps.images.outputs.dashboard_sha }}
59+
run: |
60+
echo "=== Images under test ==="
61+
echo " controlplane: ghcr.io/nantian-gw/nantian-controlplane:sha-${GATEWAY_IMAGE_SHA}"
62+
echo " dataplane: ghcr.io/nantian-gw/dataplane:sha-${DATAPLANE_IMAGE_SHA}"
63+
echo " dashboard: ghcr.io/nantian-gw/dashboard:sha-${DASHBOARD_IMAGE_SHA}"
64+
CLUSTER_NAME=e2e ./test/e2e/smoke/run.sh --no-cleanup
3665
3766
- name: Collect logs on failure
3867
if: failure()

conformance/conformance_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const (
2424
)
2525

2626
func TestGatewayAPIConformance(t *testing.T) {
27+
logImageVersions(t)
28+
2729
options := gatewayconformance.DefaultOptions(t)
2830
options, expandedAllFeatures := patchAllFeatures(options)
2931

@@ -157,3 +159,19 @@ func parseGatewayAddresses(raw string, fallback string) []gatewayv1beta1.Gateway
157159

158160
return addresses
159161
}
162+
163+
func logImageVersions(t *testing.T) {
164+
components := []struct{ env, name string }{
165+
{"GATEWAY_IMAGE_SHA", "controlplane"},
166+
{"DATAPLANE_IMAGE_SHA", "dataplane"},
167+
{"DASHBOARD_IMAGE_SHA", "dashboard"},
168+
}
169+
t.Log("=== Images under test ===")
170+
for _, c := range components {
171+
sha := os.Getenv(c.env)
172+
if sha == "" {
173+
sha = "unknown"
174+
}
175+
t.Logf(" %s: sha-%s", c.name, sha)
176+
}
177+
}

0 commit comments

Comments
 (0)