File tree Expand file tree Collapse file tree 9 files changed +153
-10
lines changed
Expand file tree Collapse file tree 9 files changed +153
-10
lines changed Original file line number Diff line number Diff line change 1+ name : OpenAPI2CRD tool CI
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - ' tools/openapi2crd/**'
8+ pull_request :
9+ branches : [ "main" ]
10+ paths :
11+ - ' tools/openapi2crd/**'
12+
13+ jobs :
14+
15+ openapi2crd :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v5
19+
20+ - name : Install devbox
21+ uses :
jetify-com/[email protected] 22+ with :
23+ enable-cache : ' true'
24+
25+ - name : Update Devbox
26+ working-directory : ./tools/openapi2crd
27+ run : devbox update
28+
29+ - name : CI checks
30+ working-directory : ./tools/openapi2crd
31+ run : devbox run -- make ci
Original file line number Diff line number Diff line change 1+ name : Scaffolder tool CI
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ paths :
7+ - ' tools/scaffolder/**'
8+ pull_request :
9+ branches : [ "main" ]
10+ paths :
11+ - ' tools/scaffolder/**'
12+
13+ jobs :
14+
15+ scaffolder :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v5
19+
20+ - name : Set up Go
21+ uses : actions/setup-go@v6
22+ with :
23+ go-version-file : " ./tools/scaffolder/go.mod"
24+
25+ - name : CI checks
26+ working-directory : ./tools/scaffolder
27+ run : make ci
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ GO_FILES := $(shell find . -name '*.go' -not -path './vendor/*')
99# Go packages for testing
1010PACKAGES := $(shell go list ./...)
1111
12+ # GO TOOLS
13+ GCI := go tool -modfile=../toolbox/go.mod gci
14+
1215crds : build # # Generate CRDs from config file
1316 @echo " ==> Generating CRDs..."
1417 $(BINARY_PATH ) --config config.yaml --output $(CRD_FILE )
@@ -26,7 +29,7 @@ $(BINARY_PATH): $(GO_FILES) ## File-based build target.
2629
2730fmt : # # Format all Go code
2831 @echo " ==> Formatting code..."
29- @gci write -s standard -s default -s localmodule .
32+ $( GCI ) write -s standard -s default -s localmodule .
3033
3134unit-test : # # Run unit tests with race detection and coverage
3235 @echo " ==> Running unit tests..."
@@ -41,4 +44,7 @@ all: gen-mock fmt unit-test build
4144clean : # # Clean up built artifacts
4245 @echo " ==> Cleaning..."
4346 @rm -f $(BINARY_PATH )
44- @rm -f $(CRD_FILE )
47+ @rm -f $(CRD_FILE )
48+
49+ .PHONY : ci
50+ ci : all # # Standard CI tests
Original file line number Diff line number Diff line change 1+ {
2+ "$schema" : " https://raw.githubusercontent.com/jetify-com/devbox/0.16.0/.schema/devbox.schema.json" ,
3+ "packages" : [
4+ " path:../../flakes/go" ,
5+ " go-mockery@latest"
6+ ],
7+ "shell" : {
8+ "init_hook" : [
9+ " echo 'Welcome to devbox!' > /dev/null"
10+ ],
11+ "scripts" : {
12+ "test" : [
13+ " echo \" Error: no test specified\" && exit 1"
14+ ]
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ {
2+ "lockfile_version": "1",
3+ "packages": {
4+ "github:NixOS/nixpkgs/nixpkgs-unstable": {
5+ "last_modified": "2025-11-08T12:28:21Z",
6+ "resolved": "github:NixOS/nixpkgs/f6b44b2401525650256b977063dbcf830f762369?lastModified=1762604901&narHash=sha256-Pr2jpryIaQr9Yx8p6QssS03wqB6UifnnLr3HJw9veDw%3D"
7+ },
8+ "go-mockery@latest": {
9+ "last_modified": "2025-10-22T20:59:19Z",
10+ "resolved": "github:NixOS/nixpkgs/01b6809f7f9d1183a2b3e081f0a1e6f8f415cb09#go-mockery",
11+ "source": "devbox-search",
12+ "version": "3.5.5",
13+ "systems": {
14+ "aarch64-darwin": {
15+ "outputs": [
16+ {
17+ "name": "out",
18+ "path": "/nix/store/qzzbjxgk4ai311ibriyyj91bn5z75520-go-mockery-3.5.5",
19+ "default": true
20+ }
21+ ],
22+ "store_path": "/nix/store/qzzbjxgk4ai311ibriyyj91bn5z75520-go-mockery-3.5.5"
23+ },
24+ "aarch64-linux": {
25+ "outputs": [
26+ {
27+ "name": "out",
28+ "path": "/nix/store/3vg4ak5zdpdm46ny0q8x0f1275358n14-go-mockery-3.5.5",
29+ "default": true
30+ }
31+ ],
32+ "store_path": "/nix/store/3vg4ak5zdpdm46ny0q8x0f1275358n14-go-mockery-3.5.5"
33+ },
34+ "x86_64-darwin": {
35+ "outputs": [
36+ {
37+ "name": "out",
38+ "path": "/nix/store/jvvan3ans4x2w1vkj46mnwma0y24i2xz-go-mockery-3.5.5",
39+ "default": true
40+ }
41+ ],
42+ "store_path": "/nix/store/jvvan3ans4x2w1vkj46mnwma0y24i2xz-go-mockery-3.5.5"
43+ },
44+ "x86_64-linux": {
45+ "outputs": [
46+ {
47+ "name": "out",
48+ "path": "/nix/store/r9s8r5h3g448bp2qi20ym2h0plxgixbn-go-mockery-3.5.5",
49+ "default": true
50+ }
51+ ],
52+ "store_path": "/nix/store/r9s8r5h3g448bp2qi20ym2h0plxgixbn-go-mockery-3.5.5"
53+ }
54+ }
55+ }
56+ }
57+ }
Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ package plugins
1818import (
1919 "fmt"
2020
21- "github.com/mongodb/mongodb-atlas-kubernetes/tools/openapi2crd/pkg/converter"
22-
2321 "github.com/getkin/kin-openapi/openapi3"
2422 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
23+
24+ "github.com/mongodb/mongodb-atlas-kubernetes/tools/openapi2crd/pkg/converter"
2525)
2626
2727// Parameters adds parameters from the OpenAPI spec to the CRD schema.
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ package plugins
1818import (
1919 "slices"
2020
21- configv1alpha1 "github.com/mongodb/mongodb-atlas-kubernetestools /openapi2crd/pkg/apis/config/v1alpha1"
21+ configv1alpha1 "github.com/mongodb/mongodb-atlas-kubernetes/tools /openapi2crd/pkg/apis/config/v1alpha1"
2222)
2323
2424type SkippedProperties struct {}
@@ -40,9 +40,7 @@ func (p *SkippedProperties) Process(req *PropertyProcessorRequest) error {
4040 }
4141
4242 for _ , s := range req .PropertyConfig .Filters .SkipProperties {
43- if _ , ok := requiredPaths [s ]; ok {
44- delete (requiredPaths , s )
45- }
43+ delete (requiredPaths , s )
4644 }
4745
4846 req .Property .Required = make ([]string , 0 , len (req .Property .Required ))
Original file line number Diff line number Diff line change @@ -39,4 +39,11 @@ generate-all: build
3939generate-all-override :
4040 $(BINARY_PATH ) --input $(CRD_FILE ) --all --override \
4141 --indexer-out $(INDEXER_OUT ) \
42- --controller-out $(CONTROLLER_OUT ) \
42+ --controller-out $(CONTROLLER_OUT )
43+
44+ .PHONY : unit-test
45+ unit-test :
46+ go test -race -cover ./...
47+
48+ .PHONY : ci
49+ ci : build unit-test # # Standard CI tests
Original file line number Diff line number Diff line change @@ -464,7 +464,7 @@ spec:
464464 // Verify package-level getTranslationRequest function
465465 assert .Contains (t , contentStr , "func getTranslationRequest(" )
466466 assert .Contains (t , contentStr , "ctx context.Context" )
467- assert .Contains (t , contentStr , "client client.Client" )
467+ assert .Contains (t , contentStr , "k8sClient client.Client" )
468468 assert .Contains (t , contentStr , "crdName string" )
469469 assert .Contains (t , contentStr , "storageVersion string" )
470470 assert .Contains (t , contentStr , "targetVersion string" )
You can’t perform that action at this time.
0 commit comments