From b06ed524137b02b132b1cc75f07192e648756685 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Mon, 31 Oct 2022 00:13:07 +0100 Subject: [PATCH] with mkdir --- ci/go.mod | 2 +- ci/go.sum | 2 ++ gobin_default_template.yaml | 4 ++-- pkg/pipelines/golang-bin.go | 17 +++++++++++------ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ci/go.mod b/ci/go.mod index b3d436c..a2a185c 100644 --- a/ci/go.mod +++ b/ci/go.mod @@ -2,7 +2,7 @@ module ci go 1.19 -require git.front.kjuulh.io/kjuulh/dagger-go v0.0.21 +require git.front.kjuulh.io/kjuulh/dagger-go v0.0.22 require ( dagger.io/dagger v0.3.1 // indirect diff --git a/ci/go.sum b/ci/go.sum index a1eda69..e017a20 100644 --- a/ci/go.sum +++ b/ci/go.sum @@ -61,6 +61,8 @@ git.front.kjuulh.io/kjuulh/dagger-go v0.0.20 h1:iw/gnsaGe4SzqbRT6i14LPvu/Cpbe7Xi git.front.kjuulh.io/kjuulh/dagger-go v0.0.20/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8= git.front.kjuulh.io/kjuulh/dagger-go v0.0.21 h1:r6OuEyxx7yhgD+lrIMDhal4fDuVS5anWrXO5lyPMXPg= git.front.kjuulh.io/kjuulh/dagger-go v0.0.21/go.mod h1:N/EXT0aOJzph/9AXuFlaA2ZuKU0P8WzaDZQXLlAL0D8= +git.front.kjuulh.io/kjuulh/dagger-go v0.0.22 h1:ajOhF6B7M43dPE1BAFoi55yOCSBwCxZYHH0CgFIm0bk= +git.front.kjuulh.io/kjuulh/dagger-go v0.0.22/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= diff --git a/gobin_default_template.yaml b/gobin_default_template.yaml index 8a7e070..92d58e4 100644 --- a/gobin_default_template.yaml +++ b/gobin_default_template.yaml @@ -4,7 +4,7 @@ name: "drone-dagger-test" steps: - name: "build" - image: harbor.front.kjuulh.io/kjuulh/dagger-go:1667165411134 + image: harbor.front.kjuulh.io/kjuulh/dagger-go:1667165924347 volumes: - name: dockersock path: /var/run @@ -17,7 +17,7 @@ steps: from_secret: "harbor_docker_password" commands: - sleep 5 - - ls /usr/bin/ + - dagger-go build golangbin services: - name: docker diff --git a/pkg/pipelines/golang-bin.go b/pkg/pipelines/golang-bin.go index 1dab33f..abeb1c1 100644 --- a/pkg/pipelines/golang-bin.go +++ b/pkg/pipelines/golang-bin.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "path" "strconv" "time" @@ -74,8 +75,12 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline { opts.BaseImage = "harbor.front.kjuulh.io/docker-proxy/library/busybox" } - usrbin := fmt.Sprintf("/usr/bin/%s", opts.BinName) + binpath := "/usr/bin" + usrbin := path.Join(binpath, opts.BinName) c := container.LoadImage(client, opts.BaseImage) + c = c.Exec(dagger.ContainerExecOpts{ + Args: []string{"mkdir", "-p", binpath}, + }) c, err := container.MountFileFromLoaded(ctx, c, bin, usrbin) if err != nil { return err @@ -85,11 +90,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",