caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
58.65k stars 4.05k forks source link

2.7.5 does not build #5888

Closed primus852 closed 1 year ago

primus852 commented 1 year ago

In Docker, this

ARG CADDY_VERSION=2.7.5

# Build Caddy with the Mercure and Vulcain modules
# Temporary fix for https://github.com/dunglas/mercure/issues/770
FROM caddy:${CADDY_VERSION}-builder-alpine AS app_caddy_builder

RUN xcaddy build ${CADDY_VERSION} --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy

leads to this

...
25.15 go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
25.28 2023/10/12 21:58:23 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath 
55.08 # github.com/caddyserver/caddy/v2/modules/caddyhttp
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:462:9: cannot use func(eh parser.ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {…} (value of type func(eh parser.ExprHelper, target *expr.Expr, args []*expr.Expr) (*expr.Expr, *common.Error)) as parser.MacroExpander value in return statement
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:479:13: eh.GlobalCall undefined (type parser.ExprHelper has no field or method GlobalCall)
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:479:37: eh.Ident undefined (type parser.ExprHelper has no field or method Ident)
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:479:66: cannot use matchArgs (variable of type []*expr.Expr) as []ast.Expr value in argument to eh.NewList
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:488:9: cannot use func(eh parser.ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {…} (value of type func(eh parser.ExprHelper, target *expr.Expr, args []*expr.Expr) (*expr.Expr, *common.Error)) as parser.MacroExpander value in return statement
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:495:14: eh.GlobalCall undefined (type parser.ExprHelper has no field or method GlobalCall)
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:495:38: eh.Ident undefined (type parser.ExprHelper has no field or method Ident)
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:509:9: cannot use func(eh parser.ExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *common.Error) {…} (value of type func(eh parser.ExprHelper, target *expr.Expr, args []*expr.Expr) (*expr.Expr, *common.Error)) as parser.MacroExpander value in return statement
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:545:14: eh.GlobalCall undefined (type parser.ExprHelper has no field or method GlobalCall)
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:545:38: eh.Ident undefined (type parser.ExprHelper has no field or method Ident)
55.08 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddyhttp/celmatcher.go:545:38: too many errors
56.94 2023/10/12 21:58:54 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2023-10-12-2157.682781338
56.94 2023/10/12 21:58:54 [FATAL] exit status 1

I believe this was still working with 2.7.4 yesterday... I am a beginner with Caddy and so not understand what is happening. Any help is appreciated.

Thank you

boncelor commented 1 year ago

Similar crash here, I could build removing the Vulcain and Mercure extensions so some dependency mismatch going on with the latest update. I guess @dunglas will update them in Mercure

kowap commented 1 year ago

I have exactly the same problem. it was still working yesterday

Снимок экрана 2023-10-13 в 10 48 18
dunglas commented 1 year ago

Could you try forcing the cel-go version to v0.15.1?

Maybe we xcaddy build --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with=github.com/google/cel-go@v0.15.1

primus852 commented 1 year ago

Tried it, but results in

...
14.90   trying github.com/dunglas/mercure/caddy@v0.14.5
15.10 go: downloading github.com/dunglas/mercure/caddy v0.14.5
15.10 go: downloading github.com/dunglas/vulcain/caddy v0.4.3
15.22 go: downgraded github.com/dunglas/mercure/caddy v0.15.4 => v0.14.5
15.22 go: downgraded github.com/dunglas/vulcain/caddy v0.5.1 => v0.4.3
15.22 go: downgraded github.com/google/cel-go v0.18.1 => v0.15.1
15.22 2023/10/13 07:58:48 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v
15.30 go: downloading github.com/go-chi/chi v4.1.2+incompatible
15.30 go: downloading gopkg.in/natefinch/lumberjack.v2 v2.2.1
15.38 go: downloading golang.org/x/sync v0.4.0
15.38 go: downloading github.com/mastercactapus/proxyprotocol v0.0.4
15.38 go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0
15.38 go: downloading go.opentelemetry.io/contrib/propagators/autoprop v0.42.0
15.46 go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0
15.46 go: downloading go.opentelemetry.io/otel v1.16.0
15.46 go: downloading go.opentelemetry.io/otel/sdk v1.16.0
15.48 go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0
15.56 go: downloading go.opentelemetry.io/otel/trace v1.16.0
15.62 go: downloading github.com/BurntSushi/toml v1.3.2
15.62 go: downloading github.com/alecthomas/chroma/v2 v2.9.1
15.62 go: downloading github.com/yuin/goldmark v1.5.6
15.62 go: downloading github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
15.63 go: downloading github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594
15.73 go: downloading github.com/go-chi/chi/v5 v5.0.10
15.73 go: downloading github.com/fxamacker/cbor/v2 v2.5.0
15.73 go: downloading github.com/google/go-tpm v0.9.0
15.77 go: downloading github.com/smallstep/go-attestation v0.4.4-0.20230627102604-cf579e53cbd2
15.80 go: downloading go.opentelemetry.io/contrib/propagators/aws v1.17.0
15.80 go: downloading go.opentelemetry.io/contrib/propagators/b3 v1.17.0
15.81 go: downloading go.opentelemetry.io/contrib/propagators/jaeger v1.17.0
15.81 go: downloading go.opentelemetry.io/contrib/propagators/ot v1.17.0
15.82 go: downloading go.opentelemetry.io/otel/metric v1.16.0
15.82 go: downloading go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0
15.84 go: downloading go.opentelemetry.io/proto/otlp v0.19.0
15.85 go: downloading github.com/rs/xid v1.5.0
15.85 go: downloading github.com/sirupsen/logrus v1.9.3
15.90 go: downloading github.com/x448/float16 v0.8.4
15.90 go: downloading github.com/go-logr/logr v1.2.4
15.92 go: downloading github.com/cenkalti/backoff/v4 v4.2.1
15.93 go: downloading github.com/go-logr/stdr v1.2.2
15.94 go: downloading github.com/google/go-tspi v0.3.0
15.95 go: downloading github.com/alecthomas/chroma v0.10.0
15.99 go: downloading github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2
16.17 go: downloading github.com/grpc-ecosystem/grpc-gateway v1.16.0
16.25 go: downloading github.com/google/certificate-transparency-go v1.1.6
16.25 go: downloading github.com/dlclark/regexp2 v1.10.0
16.77 go: caddy imports
16.77   github.com/google/cel-go: cannot find module providing package github.com/google/cel-go
17.00 2023/10/13 07:58:50 [FATAL] exit status 1

Used RUN xcaddy build ${CADDY_VERSION} --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/google/cel-go@v0.15.1 with CADDY_VERSION=2.7.5

dunglas commented 1 year ago

The problem is that xcaddy installs github.com/google/cel-go v0.18.1 while Caddy only supports v0.15.1. I know why xcaddy does that because both Caddy, Mercure, and Vulcain explicitly require v0.15.1.

Maybe is xcaddy doing a go get -u somewhere?

dunglas commented 1 year ago

Ok, the problem was an inconsistency in the version of cel-go in github.com/dunglas/mercure/caddy. I just pushed a new release that should fix the issue.

primus852 commented 1 year ago

Can confirm

xcaddy build v2.7.5 --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy

now builds successfully!

Thank you for the quick help, MUCH APPRECIATED!

greenpau commented 12 months ago

Encountered the same issue when upgraded from 2.7.4 to 2.7.5.

What is the version of cel-go that we should be using with caddy?

francislavoie commented 12 months ago

@greenpau as always, refer to https://github.com/caddyserver/caddy/blob/master/go.mod