[solved] Building drone cli from source

Hi I am trying to build drone cli version 0.5.0 from source but I get the error below. Initially I’ve started looking here: https://github.com/drone/drone-cli, but this is deprecated and I used the README file: https://github.com/drone/drone

I am currently running drone version 0.5.0+dev and somehow a ‘carriage return’ is added at the end of the key value when add drone secret. I am after 0.5.0, any idea how I build that version?

Kind regards,

Ayache

Failure details:

Ayaches-MacBook-Pro:drone ayache$ make deps
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/jteeuwen/go-bindata/
go get -u github.com/elazarl/go-bindata-assetfs/
go get -u github.com/drone/mq/

github.com/drone/mq/cmd/mq

fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x240a33ac73ed pc=0x32313]

goroutine 22 [running]:
runtime.throw(0x2c4920, 0x2a)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:547 +0x90 fp=0xc82002ae90 sp=0xc82002ae78
runtime.sigpanic()
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/sigpanic_unix.go:12 +0x5a fp=0xc82002aee0 sp=0xc82002ae90
runtime.injectglist(0x240a33ac730d)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/proc.go:2013 +0x93 fp=0xc82002af10 sp=0xc82002aee0
runtime.gcWakeAllAssists()
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgcmark.go:498 +0x3b fp=0xc82002af20 sp=0xc82002af10
runtime.gcMarkDone()
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgc.go:1136 +0x271 fp=0xc82002af40 sp=0xc82002af20
runtime.gcBgMarkWorker(0xc820022a00)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgc.go:1480 +0x488 fp=0xc82002afb8 sp=0xc82002af40
runtime.goexit()
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc82002afc0 sp=0xc82002afb8
created by runtime.gcBgMarkStartWorkers
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mgc.go:1330 +0x92

goroutine 1 [GC assist wait]:
cmd/link/internal/ld.writelines()
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/ld/dwarf.go:1651 +0xefc
cmd/link/internal/ld.Dwarfemitdebugsections()
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/ld/dwarf.go:2108 +0xa59
cmd/link/internal/amd64.asmb()
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/amd64/asm.go:663 +0x8bb
cmd/link/internal/ld.Ldmain()
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/ld/pobj.go:248 +0x1f5d
cmd/link/internal/amd64.Main()
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/internal/amd64/obj.go:44 +0x19
main.main()
/usr/local/Cellar/go/1.6.2/libexec/src/cmd/link/main.go:27 +0x36f
make: *** [deps_backend] Error 2

drone-cli was deprecated and moved

[DEPRECATED] and moved into drone/drone https://github.com/drone/drone

In terms of building drone/drone on a macbook, unfortunately I don’t get any errors building drone on my macbook. Errors from the runtime package usually indicate an error with the Go runtime, so maybe you need to upgrade to a newer version of Go?

This is the environment I use to build / develop drone:

$ uname -a
15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
$ go version
go version go1.7.4 darwin/amd64

Thanks Brad, upgrading GO to the latest version fixed the issue.

hi @bradrydzewski back again to the tool ( I got distracted for the last few days). I can run make deps successfully now, but it fails on make gen with the error below. Looks like I am not setting the GOPATH correctly and it’s not specified how to in the README file. Any idea?

Many thanks in advance

Ayache

GO Version
Ayaches-MBP:drone ayache$ go version
go version go1.7.4 darwin/amd64

Error

Ayaches-MBP:drone ayache$ make gen
go generate github.com/drone/drone/server/template
can’t load package: package github.com/drone/drone/server/template: cannot find package “github.com/drone/drone/server/template” in any of:
/usr/local/Cellar/go/1.7.4_2/libexec/src/github.com/drone/drone/server/template (from $GOROOT)
/Users/ayache/Projects/GO/HW/src/github.com/drone/drone/server/template (from $GOPATH)
make: *** [gen_template] Error 1

Please see the official Go documentation for setting up a valid Go environment, including the GOPATH https://golang.org/doc/

thanks @bradrydzewski for your prompt response. I have managed to build drone from source successfully. But the version I get when build from source is drone version 0.5.0+dev. We had issues with this version when publishing secrets ( a new line is added at the end of base64 value). I was told 0.5.0 doesn’t have this issue. I thought building from source would give me 0.5.0. Is there such version?

Many thanks in advance

Ayache

the version number embedded in the binary follows the pattern 0.5.0+{metadata} where the metadata is the build number. If you are building locally, the build number does not exist since that comes from the CI system, so dev is used instead. This is why all local builds will always be 0.5.0+dev

Please also note there is an official drone/drone:0.5 image available. You can use the official distribution instead of building from source. There is really no reason to build from scratch unless you plan to contribute to the project.

@bradrydzewski Thanks for suggesting the office image. I am after drone client 0.5 version.

the 0.5 drone client is also available for download. Instructions and links can be found:
http://readme.drone.io/usage/getting-started-cli/

Thanks @bradrydzewski the latest released CLI still referencing +dev in its version: 0.5.0+dev. That something needs to be looked at. I have actually found an issue with add/list secret commands when providing drone server with following URL pattern. https://[hostname]/.*. Somehow it breaks if the URL ends with / or a path. To me the CLI should be after the drone server hostname not the actual URL. I’ve started learning GO last weekend, almost done with the introduction and I should be able to provide a fix and create PR for it. Watch this space :slight_smile: