Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcaddy doesn't build specified version #54

Closed
ghost opened this issue Mar 6, 2021 · 13 comments · Fixed by #93
Closed

xcaddy doesn't build specified version #54

ghost opened this issue Mar 6, 2021 · 13 comments · Fixed by #93

Comments

@ghost
Copy link

ghost commented Mar 6, 2021

I noticed xcaddy isn't building the specified version. If I specify, for instance, xcaddy build v2.3.0 --with github.com/caddy-dns/cloudflare, I will get v2.4.0-beta.1 instead.

Here's the full build log:

xnaas@xnaasSRV:~/caddy$ ./xcaddy build v2.3.0 --with github.com/caddy-dns/cloudflare
2021/03/06 15:09:06 [INFO] Temporary folder: /tmp/buildenv_2021-03-06-1509.072091571
2021/03/06 15:09:06 [INFO] Writing main module: /tmp/buildenv_2021-03-06-1509.072091571/main.go
2021/03/06 15:09:06 [INFO] Initializing Go module
2021/03/06 15:09:06 [INFO] exec (timeout=10s): /home/xnaas/.gvm/gos/go1.16/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2021/03/06 15:09:06 [INFO] Pinning versions
2021/03/06 15:09:06 [INFO] exec (timeout=0s): /home/xnaas/.gvm/gos/go1.16/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.3.0
go: downloading github.com/caddyserver/caddy/v2 v2.3.0
go: downloading github.com/prometheus/client_golang v1.9.0
go: downloading github.com/caddyserver/certmagic v0.12.1-0.20201215190346-201f83a06067
go: downloading go.uber.org/zap v1.16.0
go: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/golang/protobuf v1.4.3
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/common v0.15.0
go: downloading github.com/prometheus/procfs v0.2.0
go: downloading golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e
go: downloading go.uber.org/atomic v1.6.0
go: downloading go.uber.org/multierr v1.5.0
go: downloading google.golang.org/protobuf v1.24.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/klauspost/cpuid v1.2.5
go: downloading github.com/libdns/libdns v0.1.0
go: downloading github.com/mholt/acmez v0.1.1
go: downloading github.com/miekg/dns v1.1.30
go: downloading golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
go: downloading golang.org/x/text v0.3.3
go get: added github.com/caddyserver/caddy/v2 v2.3.0
2021/03/06 15:10:19 [INFO] exec (timeout=0s): /home/xnaas/.gvm/gos/go1.16/bin/go get -d -v github.com/caddy-dns/cloudflare
go: downloading github.com/caddy-dns/cloudflare v0.0.0-20210227191100-728f5b67d095
go: downloading github.com/libdns/cloudflare v0.1.0
go: downloading github.com/caddyserver/caddy/v2 v2.4.0-beta.1
go: downloading github.com/libdns/libdns v0.2.0
go: downloading github.com/caddyserver/certmagic v0.12.1-0.20210211020017-ebb8d8b435b4
go: downloading github.com/mholt/acmez v0.1.3
go get: added github.com/caddy-dns/cloudflare v0.0.0-20210227191100-728f5b67d095
go get: upgraded github.com/caddyserver/caddy/v2 v2.3.0 => v2.4.0-beta.1
2021/03/06 15:10:20 [INFO] Build environment ready
2021/03/06 15:10:20 [INFO] Building Caddy
2021/03/06 15:10:20 [INFO] exec (timeout=0s): /home/xnaas/.gvm/gos/go1.16/bin/go mod tidy
go: downloading github.com/go-chi/chi v4.1.2+incompatible
go: downloading github.com/smallstep/certificates v0.15.4
go: downloading github.com/smallstep/nosql v0.3.0
go: downloading github.com/smallstep/cli v0.15.2
go: downloading github.com/smallstep/truststore v0.9.6
go: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
go: downloading github.com/klauspost/cpuid/v2 v2.0.1
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/google/cel-go v0.6.0
go: downloading github.com/lucas-clemente/quic-go v0.19.3
go: downloading google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262
go: downloading github.com/stretchr/testify v1.5.1
go: downloading golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f
go: downloading honnef.co/go/tools v0.0.1-2019.2.3
go: downloading github.com/klauspost/compress v1.11.3
go: downloading github.com/Masterminds/sprig/v3 v3.1.0
go: downloading github.com/alecthomas/chroma v0.8.2
go: downloading github.com/naoina/toml v0.1.1
go: downloading github.com/yuin/goldmark v1.2.1
go: downloading github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb
go: downloading go.step.sm/crypto v0.6.0
go: downloading gopkg.in/square/go-jose.v2 v2.5.1
go: downloading github.com/BurntSushi/toml v0.3.1
go: downloading github.com/dgraph-io/badger v1.5.3
go: downloading github.com/google/go-cmp v0.4.0
go: downloading go.etcd.io/bbolt v1.3.3
go: downloading github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200413122845-09dd2e1a4195
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/Masterminds/goutils v1.1.0
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/google/uuid v1.1.1
go: downloading github.com/huandu/xstrings v1.3.1
go: downloading github.com/imdario/mergo v0.3.8
go: downloading github.com/mitchellh/copystructure v1.0.0
go: downloading github.com/Masterminds/semver/v3 v3.1.0
go: downloading github.com/spf13/cast v1.3.1
go: downloading github.com/marten-seemann/qpack v0.2.1
go: downloading github.com/golang/mock v1.4.4
go: downloading github.com/onsi/ginkgo v1.14.0
go: downloading github.com/onsi/gomega v1.10.1
go: downloading golang.org/x/tools v0.0.0-20200106190116-7be0a674c9fc
go: downloading github.com/naoina/go-stringutil v0.1.0
go: downloading github.com/kylelemons/godebug v1.1.0
go: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: downloading github.com/urfave/cli v1.22.2
go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading github.com/rs/xid v1.2.1
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
go: downloading github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f
go: downloading github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2
go: downloading github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3
go: downloading github.com/cheekybits/genny v1.0.0
go: downloading github.com/marten-seemann/qtls v0.10.0
go: downloading github.com/marten-seemann/qtls-go1-15 v0.1.1
go: downloading github.com/mitchellh/reflectwalk v1.0.0
go: downloading github.com/dlclark/regexp2 v1.2.0
go: downloading github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
go: downloading github.com/manifoldco/promptui v0.3.1
go: downloading github.com/konsorten/go-windows-terminal-sequences v1.0.3
go: downloading github.com/kr/pretty v0.1.0
go: downloading github.com/aws/aws-sdk-go v1.30.29
go: downloading cloud.google.com/go v0.51.0
go: downloading github.com/googleapis/gax-go v2.0.0+incompatible
go: downloading github.com/googleapis/gax-go/v2 v2.0.5
go: downloading google.golang.org/api v0.15.0
go: downloading google.golang.org/grpc v1.27.1
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: downloading github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9
go: downloading github.com/cpuguy83/go-md2man v1.0.10
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0
go: downloading github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721
go: downloading github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897
go: downloading github.com/sergi/go-diff v1.0.0
go: downloading github.com/golang/snappy v0.0.1
go: downloading github.com/DataDog/zstd v1.4.1
go: downloading github.com/nxadm/tail v1.4.4
go: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
go: downloading github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1
go: downloading github.com/samfoo/ansi v0.0.0-20160124022901-b6bd2ded7189
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
go: downloading github.com/russross/blackfriday v1.5.2
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/OneOfOne/xxhash v1.2.2
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/russross/blackfriday/v2 v2.0.1
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/chzyer/logex v1.1.10
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading github.com/mattn/go-colorable v0.1.6
go: downloading golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/lunixbochs/vtclean v1.0.0
go: downloading go.opencensus.io v0.22.2
go: downloading google.golang.org/appengine v1.6.5
go: downloading github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: downloading github.com/jmespath/go-jmespath v0.3.0
go: downloading github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
2021/03/06 15:10:27 [INFO] exec (timeout=0s): /home/xnaas/.gvm/gos/go1.16/bin/go build -o /home/xnaas/caddy/caddy -ldflags -w -s -trimpath
2021/03/06 15:10:43 [INFO] Build complete: ./caddy
2021/03/06 15:10:43 [INFO] Cleaning up temporary folder: /tmp/buildenv_2021-03-06-1509.072091571

...and the result:

xnaas@xnaasSRV:~/caddy$ ./caddy version
v2.4.0-beta.1 h1:Ed/tIaN3p6z8M3pEiXWJL/T8JmCqV62FrSJCHKquW/I=

This Dockerfile builds like this:

Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '140.82.112.3' to the list of known hosts.
Reset branch 'master'
Your branch is up-to-date with 'origin/master'.
Pulling cache layers for index.docker.io/xnaas/caddy:latest...
Done!
KernelVersion: 4.4.0-1060-aws
Components: [{u'Version': u'19.03.8', u'Name': u'Engine', u'Details': {u'KernelVersion': u'4.4.0-1060-aws', u'Os': u'linux', u'BuildTime': u'2020-03-11T01:24:30.000000000+00:00', u'ApiVersion': u'1.40', u'MinAPIVersion': u'1.12', u'GitCommit': u'afacb8b7f0', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.12.17'}}, {u'Version': u'1.2.13', u'Name': u'containerd', u'Details': {u'GitCommit': u'7ad184331fa3e55e52b890ea95e65ba581ae3429'}}, {u'Version': u'1.0.0-rc10', u'Name': u'runc', u'Details': {u'GitCommit': u'dc9208a3303feef5b3839f4323d9beb36df0a9dd'}}, {u'Version': u'0.18.0', u'Name': u'docker-init', u'Details': {u'GitCommit': u'fec3683'}}]
Arch: amd64
BuildTime: 2020-03-11T01:24:30.000000000+00:00
ApiVersion: 1.40
Platform: {u'Name': u'Docker Engine - Community'}
Version: 19.03.8
MinAPIVersion: 1.12
GitCommit: afacb8b7f0
Os: linux
GoVersion: go1.12.17
Starting build of index.docker.io/xnaas/caddy:latest...
Step 1/8 : FROM caddy:2-builder-alpine AS builder
---> f693e06b19da
Step 2/8 : RUN xcaddy build v2.3.0 --with github.com/caddy-dns/cloudflare
---> Running in 08bdf6993cbf
�[91m2021/02/28 06:02:43 [INFO] Temporary folder: /tmp/buildenv_2021-02-28-0602.668232625
2021/02/28 06:02:43 [INFO] Writing main module: /tmp/buildenv_2021-02-28-0602.668232625/main.go
2021/02/28 06:02:43 [INFO] Initializing Go module
2021/02/28 06:02:43 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy
�[0m
�[91mgo: creating new go.mod: module caddy
�[0m
�[91m2021/02/28 06:02:43 [INFO] Pinning versions
2021/02/28 06:02:43 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.3.0
�[0m
�[91mgo: downloading github.com/caddyserver/caddy/v2 v2.3.0
�[0m
�[91mgo: downloading github.com/prometheus/client_golang v1.9.0
�[0m
�[91mgo: downloading go.uber.org/zap v1.16.0
�[0m
�[91mgo: downloading golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
�[0m
�[91mgo: downloading github.com/caddyserver/certmagic v0.12.1-0.20201215190346-201f83a06067
�[0m
�[91mgo: downloading github.com/libdns/libdns v0.1.0
�[0m
�[91mgo: downloading github.com/miekg/dns v1.1.30
�[0m
�[91mgo: downloading github.com/mholt/acmez v0.1.1
�[0m
�[91mgo: downloading github.com/klauspost/cpuid v1.2.5
�[0m
�[91mgo: downloading go.uber.org/atomic v1.6.0
�[0m
�[91mgo: downloading go.uber.org/multierr v1.5.0
�[0m
�[91mgo: downloading github.com/prometheus/common v0.15.0
�[0m
�[91mgo: downloading github.com/prometheus/client_model v0.2.0
�[0m
�[91mgo: downloading github.com/cespare/xxhash v1.1.0
�[0m
�[91mgo: downloading github.com/golang/protobuf v1.4.3
�[0m
�[91mgo: downloading github.com/prometheus/procfs v0.2.0
�[0m
�[91mgo: downloading golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
�[0m
�[91mgo: downloading github.com/cespare/xxhash/v2 v2.1.1
�[0m
�[91mgo: downloading golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e
�[0m
�[91mgo: downloading google.golang.org/protobuf v1.24.0
�[0m
�[91mgo: downloading github.com/beorn7/perks v1.0.1
�[0m
�[91mgo: downloading golang.org/x/text v0.3.3
�[0m
�[91mgo: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
�[0m
�[91m2021/02/28 06:02:58 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddy-dns/cloudflare
�[0m
�[91mgo: downloading github.com/caddy-dns/cloudflare v0.0.0-20210227191100-728f5b67d095
�[0m
�[91mgo: github.com/caddy-dns/cloudflare upgrade => v0.0.0-20210227191100-728f5b67d095
�[0m
�[91mgo: downloading github.com/libdns/cloudflare v0.1.0
�[0m
�[91mgo: downloading github.com/caddyserver/caddy/v2 v2.4.0-beta.1
�[0m
�[91mgo: downloading github.com/libdns/libdns v0.2.0
�[0m
�[91mgo: downloading github.com/caddyserver/certmagic v0.12.1-0.20210211020017-ebb8d8b435b4
�[0m
�[91mgo: downloading github.com/mholt/acmez v0.1.3
�[0m
�[91m2021/02/28 06:03:00 [INFO] Build environment ready
�[0m
�[91m2021/02/28 06:03:00 [INFO] Building Caddy
�[0m
�[91m2021/02/28 06:03:00 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy
�[0m
�[91mgo: downloading github.com/smallstep/certificates v0.15.4
�[0m
�[91mgo: downloading github.com/klauspost/cpuid/v2 v2.0.1
�[0m
�[91mgo: downloading gopkg.in/yaml.v2 v2.3.0
�[0m
�[91mgo: downloading github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
�[0m
�[91mgo: downloading github.com/alecthomas/chroma v0.8.2
�[0m
�[91mgo: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
�[0m
�[91mgo: downloading github.com/yuin/goldmark v1.2.1
�[0m
�[91mgo: downloading github.com/smallstep/nosql v0.3.0
�[0m
�[91mgo: downloading github.com/dgraph-io/badger v1.5.3
�[0m
�[91mgo: downloading github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
�[0m
�[91mgo: downloading github.com/klauspost/compress v1.11.3
�[0m
�[91mgo: downloading github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262
�[0m
�[91mgo: downloading github.com/Masterminds/sprig/v3 v3.1.0
�[0m
�[91mgo: downloading github.com/go-chi/chi v4.1.2+incompatible
�[0m
�[91mgo: downloading github.com/imdario/mergo v0.3.8
�[0m
�[91mgo: downloading github.com/huandu/xstrings v1.3.1
�[0m
�[91mgo: downloading github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200413122845-09dd2e1a4195
�[0m
�[91mgo: downloading github.com/pkg/errors v0.9.1
�[0m
�[91mgo: downloading github.com/google/go-cmp v0.4.0
�[0m
�[91mgo: downloading github.com/smallstep/truststore v0.9.6
�[0m
�[91mgo: downloading github.com/stretchr/testify v1.5.1
�[0m
�[91mgo: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
�[0m
�[91mgo: downloading github.com/google/cel-go v0.6.0
�[0m
�[91mgo: downloading github.com/kr/pretty v0.1.0
�[0m
�[91mgo: downloading github.com/lucas-clemente/quic-go v0.19.3
�[0m
�[91mgo: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
�[0m
�[91mgo: downloading google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98
�[0m
�[91mgo: downloading go.etcd.io/bbolt v1.3.3
�[0m
�[91mgo: downloading go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee
�[0m
�[91mgo: downloading github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2
�[0m
�[91mgo: downloading golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f
�[0m
�[91mgo: downloading github.com/smallstep/cli v0.15.2
�[0m
�[91mgo: downloading github.com/spf13/cast v1.3.1
�[0m
�[91mgo: downloading github.com/Masterminds/goutils v1.1.0
�[0m
�[91mgo: downloading github.com/mitchellh/copystructure v1.0.0
�[0m
�[91mgo: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb
�[0m
�[91mgo: downloading github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9
�[0m
�[91mgo: downloading github.com/pmezard/go-difflib v1.0.0
�[0m
�[91mgo: downloading github.com/onsi/gomega v1.10.1
�[0m
�[91mgo: downloading github.com/cheekybits/genny v1.0.0
�[0m
�[91mgo: downloading github.com/google/uuid v1.1.1
�[0m
�[91mgo: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
�[0m
�[91mgo: downloading github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
�[0m
�[91mgo: downloading github.com/go-sql-driver/mysql v1.5.0
�[0m
�[91mgo: downloading github.com/onsi/ginkgo v1.14.0
�[0m
�[91mgo: downloading go.step.sm/crypto v0.6.0
�[0m
�[91mgo: downloading honnef.co/go/tools v0.0.1-2019.2.3
�[0m
�[91mgo: downloading github.com/naoina/toml v0.1.1
�[0m
�[91mgo: downloading github.com/mitchellh/reflectwalk v1.0.0
�[0m
�[91mgo: downloading github.com/Masterminds/semver v1.4.2
�[0m
�[91mgo: downloading github.com/kr/text v0.1.0
�[0m
�[91mgo: downloading github.com/rs/xid v1.2.1
�[0m
�[91mgo: downloading github.com/marten-seemann/qtls v0.10.0
�[0m
�[91mgo: downloading github.com/Masterminds/semver/v3 v3.1.0
�[0m
�[91mgo: downloading github.com/dlclark/regexp2 v1.2.0
�[0m
�[91mgo: downloading gopkg.in/square/go-jose.v2 v2.5.1
�[0m
�[91mgo: downloading github.com/marten-seemann/qpack v0.2.1
�[0m
�[91mgo: downloading github.com/naoina/go-stringutil v0.1.0
�[0m
�[91mgo: downloading github.com/marten-seemann/qtls-go1-15 v0.1.1
�[0m
�[91mgo: downloading google.golang.org/grpc v1.27.1
�[0m
�[91mgo: downloading github.com/davecgh/go-spew v1.1.1
�[0m
�[91mgo: downloading github.com/nxadm/tail v1.4.4
�[0m
�[91mgo: downloading google.golang.org/api v0.15.0
�[0m
�[91mgo: downloading github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f
�[0m
�[91mgo: downloading github.com/golang/mock v1.4.4
�[0m
�[91mgo: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
�[0m
�[91mgo: downloading github.com/googleapis/gax-go v2.0.0+incompatible
�[0m
�[91mgo: downloading github.com/golang/snappy v0.0.1
�[0m
�[91mgo: downloading github.com/googleapis/gax-go/v2 v2.0.5
�[0m
�[91mgo: downloading github.com/aws/aws-sdk-go v1.30.29
�[0m
�[91mgo: downloading github.com/BurntSushi/toml v0.3.1
�[0m
�[91mgo: downloading github.com/urfave/cli v1.22.2
�[0m
�[91mgo: downloading github.com/kylelemons/godebug v1.1.0
�[0m
�[91mgo: downloading github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3
�[0m
�[91mgo: downloading github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
�[0m
�[91mgo: downloading github.com/manifoldco/promptui v0.3.1
�[0m
�[91mgo: downloading github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
�[0m
�[91mgo: downloading golang.org/x/tools v0.0.0-20200106190116-7be0a674c9fc
�[0m
�[91mgo: downloading github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721
�[0m
�[91mgo: downloading github.com/mattn/go-isatty v0.0.12
�[0m
�[91mgo: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
�[0m
�[91mgo: downloading github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a
�[0m
�[91mgo: downloading github.com/sirupsen/logrus v1.6.0
�[0m
�[91mgo: downloading github.com/DataDog/zstd v1.4.1
�[0m
�[91mgo: downloading github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1
�[0m
�[91mgo: downloading cloud.google.com/go v0.51.0
�[0m
�[91mgo: downloading github.com/cpuguy83/go-md2man v1.0.10
�[0m
�[91mgo: downloading github.com/cpuguy83/go-md2man/v2 v2.0.0
�[0m
�[91mgo: downloading github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897
�[0m
�[91mgo: downloading github.com/fsnotify/fsnotify v1.4.9
�[0m
�[91mgo: downloading github.com/sergi/go-diff v1.0.0
�[0m
�[91mgo: downloading github.com/samfoo/ansi v0.0.0-20160124022901-b6bd2ded7189
�[0m
�[91mgo: downloading github.com/chzyer/logex v1.1.10
�[0m
�[91mgo: downloading github.com/mattn/go-colorable v0.1.6
�[0m
�[91mgo: downloading github.com/lunixbochs/vtclean v1.0.0
�[0m
�[91mgo: downloading github.com/konsorten/go-windows-terminal-sequences v1.0.3
�[0m
�[91mgo: downloading github.com/OneOfOne/xxhash v1.2.2
�[0m
�[91mgo: downloading github.com/russross/blackfriday v1.5.2
�[0m
�[91mgo: downloading golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
�[0m
�[91mgo: downloading google.golang.org/appengine v1.6.5
�[0m
�[91mgo: downloading go.opencensus.io v0.22.2
�[0m
�[91mgo: downloading github.com/spaolacci/murmur3 v1.1.0
�[0m
�[91mgo: downloading github.com/russross/blackfriday/v2 v2.0.1
�[0m
�[91mgo: downloading github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
�[0m
�[91mgo: downloading github.com/jmespath/go-jmespath v0.3.0
�[0m
�[91mgo: downloading github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
�[0m
�[91m2021/02/28 06:03:20 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath
�[0m
�[91m2021/02/28 06:06:06 [INFO] Build complete: ./caddy
2021/02/28 06:06:06 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2021-02-28-0602.668232625
�[0m
Removing intermediate container 08bdf6993cbf
---> 1d11c1fc1d3e
Step 3/8 : FROM caddy:2-alpine
---> 2160ea65c1af
Step 4/8 : COPY --from=builder /usr/bin/caddy /usr/bin/caddy
---> 9d1120c947ec
Step 5/8 : ENV CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
---> Running in dfa739e6e3cc
Removing intermediate container dfa739e6e3cc
---> c7c07bb98a6b
Step 6/8 : ENV ACMEEMAIL=${ACMEEMAIL}
---> Running in 6ba9e544a88b
Removing intermediate container 6ba9e544a88b
---> 0aabf3f89b89
Step 7/8 : ENV ASAK=${ASAK}
---> Running in c4b089f93336
Removing intermediate container c4b089f93336
---> 74a34bb1e661
Step 8/8 : ENV XADMIN=${XADMIN}
---> Running in 892c8cc0881d
Removing intermediate container 892c8cc0881d
---> ebbb00d89fe7
Successfully built ebbb00d89fe7
Successfully tagged xnaas/caddy:latest
Pushing index.docker.io/xnaas/caddy:latest...
Done!
Build finished

Same problem. I'm getting a beta build, not v2.3.0.

@francislavoie
Copy link
Member

francislavoie commented Mar 6, 2021

Hmm. Just a quick hunch, didn't dig, I think this is because the latest version of the caddy-dns/cloudflare plugin specifies v2.4.0-beta.1 as its minimum version (see caddy-dns/cloudflare@728f5b6).

Try building from this commit instead caddy-dns/cloudflare@eda8e5a

./xcaddy build v2.3.0 --with github.com/caddy-dns/cloudflare@eda8e5aa22232e9c279b0df7531f20c331b331c6

@ghost
Copy link
Author

ghost commented Mar 6, 2021

ah, that would do it — didn't expect a plugin to force an upgrade to a beta version... 🙃

@francislavoie
Copy link
Member

Yeah I didn't think that would happen either, but alas. Is there anything we can do about this @mholt?

@francislavoie
Copy link
Member

@francislavoie
Copy link
Member

francislavoie commented Mar 8, 2021

@mholt my current theory is that because this repo isn't using tagged versions, the go mod resolver is causing the main Caddy module to get bumped up. I think we should tag caddy-dns/cloudflare@eda8e5a as v0.1.0, and caddy-dns/cloudflare@728f5b6 as v0.2.0. That might give it a hint of which version is appropriate to use.

Edit: Oof, nevermind that won't fix it either. I can reproduce the issue with the duckdns plugin, which does use tagged versions:

$ xcaddy build --with github.com/caddy-dns/duckdns
2021/03/08 07:24:47 [INFO] Temporary folder: /tmp/buildenv_2021-03-08-0724.248828941
2021/03/08 07:24:47 [INFO] Writing main module: /tmp/buildenv_2021-03-08-0724.248828941/main.go
2021/03/08 07:24:47 [INFO] Initializing Go module
2021/03/08 07:24:47 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2021/03/08 07:24:47 [INFO] Pinning versions
2021/03/08 07:24:47 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2
go: downloading github.com/caddyserver/caddy/v2 v2.3.0
go: downloading github.com/caddyserver/caddy v1.0.5
go: downloading github.com/caddyserver/certmagic v0.12.1-0.20201215190346-201f83a06067
go: downloading github.com/mholt/acmez v0.1.1
go get: added github.com/caddyserver/caddy/v2 v2.3.0
2021/03/08 07:24:58 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddy-dns/duckdns
go: downloading github.com/caddyserver/caddy/v2 v2.4.0-beta.1
go get: added github.com/caddy-dns/duckdns v0.3.0
go get: upgraded github.com/caddyserver/caddy/v2 v2.3.0 => v2.4.0-beta.1
2021/03/08 07:25:00 [INFO] Build environment ready
2021/03/08 07:25:00 [INFO] Building Caddy
2021/03/08 07:25:00 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy
2021/03/08 07:25:06 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /root/caddy -ldflags -w -s -trimpath
2021/03/08 07:25:41 [INFO] Build complete: ./caddy
2021/03/08 07:25:41 [INFO] Cleaning up temporary folder: /tmp/buildenv_2021-03-08-0724.248828941

In particular, this line is the suspiscious one 🤔

go get: upgraded github.com/caddyserver/caddy/v2 v2.3.0 => v2.4.0-beta.1

Same thing happens when running like this too (basically identical output aside from some go: downloading lines cause they're already cached):

$ xcaddy build v2.3.0 --with github.com/caddy-dns/duckdns

@francislavoie
Copy link
Member

francislavoie commented Mar 8, 2021

Okay. An idea - maybe we run go get on the main Caddy module again after all the other plugins, this should cause the dependencies to downgrade back to the correct versions. I don't see any way in the go get API to not upgrade other modules, so I think the only way is to make it do a downgrade after. Confirmed that this should work by doing it manually on the output with XCADDY_SKIP_CLEANUP:

$ XCADDY_SKIP_CLEANUP=1 xcaddy build v2.3.0 --with github.com/caddy-dns/duckdns
...
2021/03/08 08:13:19 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.3.0
go get: added github.com/caddyserver/caddy/v2 v2.3.0
2021/03/08 08:13:22 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddy-dns/duckdns
go get: added github.com/caddy-dns/duckdns v0.3.0
go get: upgraded github.com/caddyserver/caddy/v2 v2.3.0 => v2.4.0-beta.1
...
2021/03/08 08:13:27 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2021-03-08-0813.549012191

$ cd /tmp/buildenv_2021-03-08-0813.549012191 

$ /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2@v2.3.0
go get: downgraded github.com/caddy-dns/duckdns v0.3.0 => v0.2.2
go get: downgraded github.com/caddyserver/caddy/v2 v2.4.0-beta.1 => v2.3.0

@francislavoie
Copy link
Member

Just tried with cloudflare -- if the command was:

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

i.e. no version of Caddy specified, then go get -d -v github.com/caddyserver/caddy/v2 gets run, so if we do another go get after like in that PR, no downgrade will happen. But if we add @latest if the version was empty then it will do the downgrade. Do we want to do that?

@mholt
Copy link
Member

mholt commented Mar 9, 2021

So Francis and I have chatted about this a bit, and I've checked with Go tooling developers, and the consensus is that the Go tool is doing Minimum Version Selection (MVS), and that this is as expected. When building Caddy with version information, we need to make both Caddy core and all other plugins equal dependencies, meaning, MVS is applied equally to all of them. In this case, the cloudflare module requires v2.4.0-beta.1, and won't build with a Caddy version less than that, so MVS upgrades caddyserver/caddy in the go.mod from 2.3.0 to 2.4.0-beta.1.

I can see why this is surprising/unexpected, but if you try to build the latest cloudflare plugin with v2.3.0 of Caddy core, it will not compile. Alternatively, specify an older version of the cloudflare plugin to get an older version of Caddy.

I really appreciate the effort Francis (and you) have put into investigating this. But I'm not sure there is a good way to "fix" this -- basically, your command asks for something that won't compile, so Go is using MVS to make something that compiles instead.

Feel free to continue discussion if needed; I'll close this though, as it seems to be working as expected.

@mholt mholt closed this as completed Mar 9, 2021
@francislavoie
Copy link
Member

basically, your command asks for something that won't compile

That's not true though, there is a solution to the build requested. MVS is doing the wrong thing and expelling the versions the previous commands asked it to use. Then it becomes a whack-a-mole situation.

There's very clearly problem with either the Go module tooling, or with the approach we're taking to build.

@mholt
Copy link
Member

mholt commented Mar 9, 2021

That's not true though, there is a solution to the build requested. MVS is doing the wrong thing and expelling the versions the previous commands asked it to use. Then it becomes a whack-a-mole situation.

You can report that to the Go team if it's a bug in the tooling. As for the approach we're taking, by all counts using go get for dependencies and then go build for the binary seems to be correct. The knowledgable @bcmills told me, "In general go get can downgrade dependencies, but go build can only strictly upgrade them." I kind of understand why this is, even though we may not find it convenient or obvious.

@francislavoie
Copy link
Member

The problem is that go get is upgrading dependencies we don't want upgraded to resolve MVS. Neither of those statements apply here (re go get downgrading and go build upgrading).

@francislavoie
Copy link
Member

Specifically regarding compatibility for the cloudflare plugin, this should now be resolved with the release of v2.4.0-beta.2, because it now properly has the libdns changes. If you still want to keep v2.3.0 though, you'll still need to use the older commit from the cloudflare repo, but xcaddy should now yield a build with v2.4.0-beta.2 because of caddy-dns/cloudflare@964e47d

@francislavoie
Copy link
Member

@mholt after speaking with Bryan C. Mills in the gopher slack, he pointed out a potential fix for this one. We could put the Caddy module/version in every go get we run, which would likely make the build error out because the version specified in the command would take precedence instead of triggering an upgrade.

For example (as per OP), we could run this:

# Pull in Caddy
$ go get -d -v github.com/caddyserver/caddy/v2@v2.3.0

# Pull in plugin modules
$ go get -d -v github.com/caddyserver/caddy/v2@v2.3.0 github.com/caddy-dns/cloudflare

Erroring out would probably be better than allowing Caddy to upgrade, less surprising. The user could then have a chance to look into specifying an exact version of the plugin which is compatible with the older version of Caddy they're trying to target, i.e:

$ go get -d -v github.com/caddyserver/caddy/v2@v2.3.0 github.com/caddy-dns/cloudflare@eda8e5aa22232e9c279b0df7531f20c331b331c6

francislavoie added a commit to francislavoie/xcaddy that referenced this issue Apr 6, 2022
francislavoie added a commit to francislavoie/xcaddy that referenced this issue Apr 7, 2022
mholt pushed a commit that referenced this issue Apr 7, 2022
* Prevent main Caddy module from upgrading from adding a plugin

Fixes #54

* Better comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants