6 Commits

Author SHA1 Message Date
c4663856c4 with cgo disabled 2022-10-31 02:02:00 +01:00
217e9c5a4d set another base image 2022-10-31 01:54:39 +01:00
4c1eff5988 with base golang 2022-10-31 01:52:32 +01:00
478e3662bc removed tests 2022-10-31 01:49:21 +01:00
4ceceae6a7 removed typo 2022-10-31 01:48:32 +01:00
9583c9fa5e with updated template 2022-10-31 01:47:02 +01:00
5 changed files with 22 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ module ci
go 1.19
require git.front.kjuulh.io/kjuulh/dagger-go v0.0.26
require git.front.kjuulh.io/kjuulh/dagger-go v0.0.30
require (
dagger.io/dagger v0.3.1 // indirect

View File

@@ -69,6 +69,12 @@ git.front.kjuulh.io/kjuulh/dagger-go v0.0.24 h1:ibNRgODcSY0xraafFvO+vBvAQnGlQKV4
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=

View File

@@ -4,7 +4,7 @@ name: "drone-dagger-test"
steps:
- name: "build"
image: harbor.server.kjuulh.io/kjuulh/dagger-go:1667176154540
image: harbor.server.kjuulh.io/kjuulh/dagger-go:1667177624526
volumes:
- name: dockersock
path: /var/run

View File

@@ -34,6 +34,7 @@ func BuildGolangBin() *cobra.Command {
},
BuildPath: "main.go",
BinName: "main",
CGOEnabled: false,
ExecuteOnEntrypoint: false,
}).
Execute(ctx)

View File

@@ -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",