Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
c4663856c4
|
|||
217e9c5a4d
|
|||
4c1eff5988
|
|||
478e3662bc
|
|||
4ceceae6a7
|
|||
9583c9fa5e
|
|||
b1f64fdd74
|
|||
49dab03d9e
|
@@ -2,7 +2,7 @@ module ci
|
||||
|
||||
go 1.19
|
||||
|
||||
require git.front.kjuulh.io/kjuulh/dagger-go v0.0.24
|
||||
require git.front.kjuulh.io/kjuulh/dagger-go v0.0.30
|
||||
|
||||
require (
|
||||
dagger.io/dagger v0.3.1 // indirect
|
||||
|
@@ -67,6 +67,14 @@ git.front.kjuulh.io/kjuulh/dagger-go v0.0.23 h1:6VXEfKu/JodrgFAf5fIwuyqstkDnunHh
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.23/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.24 h1:ibNRgODcSY0xraafFvO+vBvAQnGlQKV4U9vyfNZcKIw=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.24/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.26 h1:IOaiCwvlnoV/livETEgbHjYEFNfaaN85sj4mv2j4E4E=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.26/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.27 h1:FseygX0nNNAGiE7CxSv2qMpo9HagKA0BgW3q8hxKD+A=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.27/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.29 h1:W8I8M8pIddZigw10PKRV3+RATjo8/yBaomfuChHym5A=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.29/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.30 h1:ME1Eg1GHoPDHQ7idkwVRydchlodLoN5B1uRGyBm880E=
|
||||
git.front.kjuulh.io/kjuulh/dagger-go v0.0.30/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8=
|
||||
github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
|
@@ -4,7 +4,7 @@ name: "drone-dagger-test"
|
||||
|
||||
steps:
|
||||
- name: "build"
|
||||
image: harbor.server.kjuulh.io/kjuulh/dagger-go:1667172485156
|
||||
image: harbor.server.kjuulh.io/kjuulh/dagger-go:1667177624526
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
|
@@ -34,7 +34,8 @@ func BuildGolangBin() *cobra.Command {
|
||||
},
|
||||
BuildPath: "main.go",
|
||||
BinName: "main",
|
||||
ExecuteOnEntrypoint: true,
|
||||
CGOEnabled: false,
|
||||
ExecuteOnEntrypoint: false,
|
||||
}).
|
||||
Execute(ctx)
|
||||
},
|
||||
|
@@ -26,6 +26,7 @@ type GolangBinOpts struct {
|
||||
BinName string
|
||||
BaseImage string
|
||||
ExecuteOnEntrypoint bool
|
||||
CGOEnabled bool
|
||||
}
|
||||
|
||||
func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
@@ -54,6 +55,12 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
}
|
||||
c = container.Workdir(c, "/src")
|
||||
|
||||
if opts.CGOEnabled {
|
||||
c = c.WithEnvVariable("CGO_ENABLED", "1")
|
||||
} else {
|
||||
c = c.WithEnvVariable("CGO_ENABLED", "0")
|
||||
}
|
||||
|
||||
build, err = golang.Cache(ctx, client, c)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -73,7 +80,7 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
if opts.BaseImage == "" {
|
||||
opts.BaseImage = "harbor.server.kjuulh.io/docker-proxy/library/busybox"
|
||||
opts.BaseImage = "harbor.server.kjuulh.io/docker-proxy/library/alpine"
|
||||
}
|
||||
|
||||
binpath := "/usr/bin"
|
||||
@@ -100,11 +107,11 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
return golang.Test(ctx, build)
|
||||
},
|
||||
},
|
||||
//byg.Step{
|
||||
// Execute: func(_ byg.Context) error {
|
||||
// return golang.Test(ctx, build)
|
||||
// },
|
||||
//},
|
||||
).
|
||||
Step(
|
||||
"upload-image",
|
||||
|
Reference in New Issue
Block a user