caddy-dns / cloudflare

Caddy module: dns.providers.cloudflare
Apache License 2.0
436 stars 59 forks source link

docker compose up error value in struct literal #74

Closed southpaw-decoy closed 5 months ago

southpaw-decoy commented 6 months ago

I am getting the follow error when trying to build with this.

Docker file :

FROM caddy:2.7.5-builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

FROM caddy:2.7.5

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

error message when running docker computer up :

97.12 2024/02/19 01:20:54 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath
368.7 # github.com/caddyserver/caddy/v2/modules/caddytls
368.7 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddytls/automation.go:254:18: cannot use func(name string) error {…} (value of type func(name string) error) as func(ctx context.Context, name string) error value in struct literal
463.9 2024/02/19 01:27:01 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2024-02-19-0119.312075203
463.9 2024/02/19 01:27:01 [FATAL] exit status 1

------

failed to solve: process "/bin/sh -c xcaddy build     --with github.com/caddy-dns/cloudflare" did not complete successfully: exit code: 1
Zekemaz commented 6 months ago

Hello, I am getting the same error while running xcaddy build. My pipeline breaks because of it

[build 2/2] RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest   && xcaddy build "v2.7.5"     --output /tmp/caddy     --with github.com/caddy-dns/ovh     --with github.com/caddy-dns/cloudflare     --with github.com/caddyserver/transform-encoder:
18.11 go: downloading github.com/google/s2a-go v0.1.7
18.11 go: downloading go.opencensus.io v0.24.0
18.16 go: downloading cloud.google.com/go/compute v1.23.0
18.19 go: downloading google.golang.org/appengine v1.6.7
18.21 go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
18.37 2024/02/19 08:48:30 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /tmp/caddy -ldflags -w -s -trimpath 
30.56 # github.com/caddyserver/caddy/v2/modules/caddytls
30.56 /go/pkg/mod/github.com/caddyserver/caddy/v2@v2.7.5/modules/caddytls/automation.go:254:18: cannot use func(name string) error {…} (value of type func(name string) error) as func(ctx context.Context, name string) error value in struct literal
30.75 2024/02/19 08:48:43 [INFO] Cleaning up temporary folder: /tmp/buildenv_2024-02-19-0848.1573577225
30.75 2024/02/19 08:48:43 [FATAL] exit status 1

Has anybody a clue as to why this is happening ?

Thank you

mohammed90 commented 5 months ago

As I said on caddyserver/xcaddy#177 issue, this is not a bug in either xcaddy or this module. It's due to a breaking change in caddyserver/certmagic v0.20.0 library that Caddy had to accommodate. To build v2.7.5, use this command to force the older version of certmagic:

xcaddy build v2.7.5 --with github.com/caddyserver/certmagic@v0.19.2

Why are you using v2.7.5 though?

mohammed90 commented 5 months ago

Wait -- I have the fix