Skip to content

Commit 69b40ec

Browse files
authored
CLOUDP-362266: Add generation CI (#3075)
* CLOUDP-362266: Add generation CI Signed-off-by: jose.vazquez <jose.vazquez@mongodb.com> * Add alerting to Gen CI * Use webhook secret from test env * Reuse check-missing-files Signed-off-by: jose.vazquez <jose.vazquez@mongodb.com> --------- Signed-off-by: jose.vazquez <jose.vazquez@mongodb.com>
1 parent 29c77fe commit 69b40ec

File tree

6 files changed

+102
-75
lines changed

6 files changed

+102
-75
lines changed

.github/workflows/gen-ci.yaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Generation CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'tools/scaffolder/**'
8+
- 'tools/openapi2crd/**'
9+
- 'config/openapi2crd.yaml'
10+
- '.github/workflows/gen-ci.yaml'
11+
pull_request:
12+
branches: [ "main" ]
13+
paths:
14+
- 'tools/scaffolder/**'
15+
- 'tools/openapi2crd/**'
16+
- 'config/openapi2crd.yaml'
17+
- '.github/workflows/gen-ci.yaml'
18+
19+
jobs:
20+
21+
scaffolder:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v6
25+
26+
- name: Set up Go
27+
uses: actions/setup-go@v6
28+
with:
29+
go-version-file: "./tools/scaffolder/go.mod"
30+
31+
- name: Scaffolder CI checks
32+
working-directory: ./tools/scaffolder
33+
run: make ci
34+
35+
openapi2crd:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
40+
- name: Install devbox
41+
uses: jetify-com/devbox-install-action@v0.14.0
42+
with:
43+
enable-cache: 'true'
44+
45+
- name: OpenAPI2CRD CI checks
46+
working-directory: ./tools/openapi2crd
47+
run: devbox run -- make ci
48+
49+
check-gen-all:
50+
runs-on: ubuntu-latest
51+
needs:
52+
- scaffolder
53+
- openapi2crd
54+
steps:
55+
- uses: actions/checkout@v6
56+
57+
- name: Install devbox
58+
uses: jetify-com/devbox-install-action@v0.14.0
59+
with:
60+
enable-cache: 'true'
61+
62+
- name: Gen All checks
63+
run: devbox run -- make clean gen-all check-missing-files
64+
65+
failure-alert:
66+
name: Slack Alert on Failure
67+
environment: test
68+
runs-on: ubuntu-latest
69+
needs:
70+
- scaffolder
71+
- openapi2crd
72+
- check-gen-all
73+
if: failure()
74+
env:
75+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
76+
steps:
77+
- name: Checkout Code
78+
uses: actions/checkout@v6
79+
80+
- name: Send Slack Notification
81+
env:
82+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
83+
run: |
84+
chmod +x scripts/slackit.sh
85+
86+
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
87+
88+
# Detect which job specifically failed for the message
89+
FAILED_JOBS=""
90+
if [[ "${{ needs.scaffolder.result }}" == "failure" ]]; then FAILED_JOBS+="[Scaffolder] "; fi
91+
if [[ "${{ needs.openapi2crd.result }}" == "failure" ]]; then FAILED_JOBS+="[OpenAPI2CRD] "; fi
92+
if [[ "${{ needs.check-gen-all.result }}" == "failure" ]]; then FAILED_JOBS+="[GenAllChecks] "; fi
93+
94+
MSG="❌ *Critical Failure on Gen CI* | ${{ github.repository }}
95+
Type: ${{ github.event_name }}
96+
Failed: $FAILED_JOBS
97+
<$RUN_URL|View Failing Logs>"
98+
99+
echo "$MSG" | ./scripts/slackit.sh

.github/workflows/openapi2crd.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/scaffolder.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ jobs:
9797

9898
failure-alert:
9999
name: Slack Alert on Failure
100-
# We should not have to access release, but we do not have this secret in 1Password
101-
environment: release
100+
environment: test
102101
runs-on: ubuntu-latest
103102
needs:
104103
- ci

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,8 @@ run-scaffolder: tools/scaffolder/bin/scaffolder
903903
--indexer-out $(realpath .)/internal/generated/indexers \
904904
--controller-out $(realpath .)/internal/generated/controller
905905

906-
gen-all: gen-crds gen-go-types run-scaffolder fmt
906+
gen-all: gen-crds gen-go-types run-scaffolder fmt ## Generate all CRDs, Go types, and scaffolding
907907

908908
build-autogen: gen-all $(ALL_IN_ONE_AUTOGENERATED_CONFIG)
909909
EXPERIMENTAL=1 VERSION=$(shell $(JQ) -r .next $(VERSION_FILE))-EXPERIMENTAL-${GITCOMMIT} $(MAKE) image
910+

internal/nextapi/generated/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)