aiven/aiven-operator

Fresh clone build failing

Azanul opened this issue · 9 comments

Followed developer's guide.

make build command fails

make build
go generate ./...
2024/05/27 18:30:29 can't compile field "topic_name" regex `^(?!\.$|\.\.$)[-_.A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/27 18:30:29 can't compile field "name" regex `^(?!\.$|\.\.$)[-_.A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/27 18:30:29 can't compile field "tag" regex `^(?!aiven-)[^\W\d_](?:[:\w./-]*[\w./-])?$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/27 18:30:29 can't compile field "kafka_topic" regex `^(?!\.$|\.\.$)[-_.A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/27 18:30:29 can't compile field "tag" regex `^(?!aiven-)[^\W\d_](?:[:\w./-]*[\w./-])?$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/27 18:30:29 can't compile field "namespace" regex `^(?!(AWS/|:))[:\.\-_/#A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
/Users/azanulhaque/Projects/aiven-operator/bin/controller-gen-v0.9.2 object:headerFile="hack/boilerplate.go.txt" paths="./..."
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102c40d14]

goroutine 216 [running]:
go/types.(*Checker).handleBailout(0x1400019ae00, 0x1400065fd18)
        /usr/local/go/src/go/types/check.go:367 +0x9c
panic({0x102f0ba60?, 0x103493f30?})
        /usr/local/go/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x102fd4c70, 0x10349c7c0})
        /usr/local/go/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
        /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x102fd4c70?, 0x10349c7c0?})
        /usr/local/go/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x102fdae58, 0x103468840}, 0x1400019ae00, 0x10349c7c0, 0x0)
        /usr/local/go/src/go/types/const.go:92 +0x138
go/types.(*Checker).arrayLength(0x1400019ae00, {0x102fd9200, 0x14001b36a40?})
        /usr/local/go/src/go/types/typexpr.go:510 +0x238
go/types.(*Checker).typInternal(0x1400019ae00, {0x102fd7850, 0x140013dc2d0}, 0x0)
        /usr/local/go/src/go/types/typexpr.go:299 +0x3bc
go/types.(*Checker).definedType(0x1400019ae00, {0x102fd7850, 0x140013dc2d0}, 0x1026c4a5c?)
        /usr/local/go/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).varType(0x1400019ae00, {0x102fd7850, 0x140013dc2d0})
        /usr/local/go/src/go/types/typexpr.go:145 +0x2c
go/types.(*Checker).structType(0x1400019ae00, 0x140002d7860, 0x140002d7860?)
        /usr/local/go/src/go/types/struct.go:113 +0x128
go/types.(*Checker).typInternal(0x1400019ae00, {0x102fd77c0, 0x14001851638}, 0x140002d4cd0)
        /usr/local/go/src/go/types/typexpr.go:316 +0xed0
go/types.(*Checker).definedType(0x1400019ae00, {0x102fd77c0, 0x14001851638}, 0x102d4f283?)
        /usr/local/go/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).typeDecl(0x1400019ae00, 0x140002d4cd0, 0x14000936a00, 0x0)
        /usr/local/go/src/go/types/decl.go:615 +0x39c
go/types.(*Checker).objDecl(0x1400019ae00, {0x102fdfd00, 0x140002d4cd0}, 0x0)
        /usr/local/go/src/go/types/decl.go:197 +0x880
go/types.(*Checker).packageObjects(0x1400019ae00)
        /usr/local/go/src/go/types/resolver.go:681 +0x3c0
go/types.(*Checker).checkFiles(0x1400019ae00, {0x14000d82240, 0x3, 0x3})
        /usr/local/go/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
        /usr/local/go/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0x1400036f0b0, 0x14000275ca0)
        /Users/azanulhaque/go/pkg/mod/sigs.k8s.io/controller-tools@v0.9.2/pkg/loader/loader.go:286 +0x2d8
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0x14000275ca0)
        /Users/azanulhaque/go/pkg/mod/sigs.k8s.io/controller-tools@v0.9.2/pkg/loader/loader.go:99 +0x44
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0x140003be690, 0x14000275ca0)
        /Users/azanulhaque/go/pkg/mod/sigs.k8s.io/controller-tools@v0.9.2/pkg/loader/refs.go:268 +0x304
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check.func1(0x4c?)
        /Users/azanulhaque/go/pkg/mod/sigs.k8s.io/controller-tools@v0.9.2/pkg/loader/refs.go:262 +0x58
created by sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check in goroutine 44
        /Users/azanulhaque/go/pkg/mod/sigs.k8s.io/controller-tools@v0.9.2/pkg/loader/refs.go:260 +0x230
make: *** [boilerplate] Error 2

Hey. Could you please try latest main (there are few updates)? It works for me and also I see it is failing in controller-gen so I wonder what is the issue.

Hey. Are you running the latest main? It works for me and also I see it is failing in controller-gen so I wonder what is the issue.

Yes, I'm on latest main.

git rev-parse HEAD

b3d28cf9e6ccd139a6c8a284a3a477431c8a5a93

I tried tracking the issue. The regexp part

2024/05/28 13:33:25 can't compile field "topic_name" regex `^(?!\.$|\.\.$)[-_.A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/28 13:33:26 can't compile field "name" regex `^(?!\.$|\.\.$)[-_.A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/28 13:33:26 can't compile field "tag" regex `^(?!aiven-)[^\W\d_](?:[:\w./-]*[\w./-])?$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/28 13:33:26 can't compile field "kafka_topic" regex `^(?!\.$|\.\.$)[-_.A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/28 13:33:26 can't compile field "tag" regex `^(?!aiven-)[^\W\d_](?:[:\w./-]*[\w./-])?$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
2024/05/28 13:33:26 can't compile field "namespace" regex `^(?!(AWS/|:))[:\.\-_/#A-Za-z0-9]+$`: error parsing regexp: invalid or unsupported Perl syntax: `(?!`

is from https://github.com/aiven/go-api-schemas which in turn (I think) fetches the pattern from https://api.aiven.io/v1/project/${AIVEN_PROJECT_NAME}/service_types

I'm still looking in the nil pointer dereference in controller-gen

@byashimov Upon updating to v0.10.0 the issue seems to be resolved. Now a different issue occurs (since I'm on macOS).

/Users/azanulhaque/Projects/aiven-operator/bin/controller-gen-v0.10.0 object:headerFile="hack/boilerplate.go.txt" paths="./..."
find . -type f -name '*.go' -exec sed -zi 's/"\n\+\t"/"\n"/g' {} +
sed: illegal option -- z
usage: sed script [-Ealnru] [-i extension] [file ...]
        sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]
make: *** [imports] Error 1

@Azanul great! Regarding the new issue: https://github.com/aiven/aiven-operator/blob/main/Makefile#L77

Figured it out. Thanks for the reference.
Progress:

Checking 5% [======>                                                                                                                            ]  3/59  140.9s 
 ↳ node                                                                                                                                                         
   ↳ Downloading hermetic node v20.10.0 ⠙  
Checking 100% [=================================================================================================================================>]  59/59  1.2s 
                                                                                                                                                                
Checked 52 modified files
✔ No issues
Run trunk upgrade to upgrade 8 linters
go vet ./...
go build -o bin/manager main.go

@byashimov If you don't see an issue with controller-gen v0.10.0, I recommend upgrading.

Hey. Thanks for the contribution. We are actually running 0.9.2 with no issues. I'll check your PR after the upcoming release.

This could be an OS issue, I'm using MacOS Sonoma 14.5.