with mkdir

This commit is contained in:
Kasper Juul Hermansen 2022-10-31 00:13:07 +01:00
parent 3bf5168347
commit b06ed52413
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
4 changed files with 16 additions and 9 deletions

View File

@ -2,7 +2,7 @@ module ci
go 1.19 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 ( require (
dagger.io/dagger v0.3.1 // indirect dagger.io/dagger v0.3.1 // indirect

View File

@ -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.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 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.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/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 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= 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: steps:
- name: "build" - name: "build"
image: harbor.front.kjuulh.io/kjuulh/dagger-go:1667165411134 image: harbor.front.kjuulh.io/kjuulh/dagger-go:1667165924347
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run path: /var/run
@ -17,7 +17,7 @@ steps:
from_secret: "harbor_docker_password" from_secret: "harbor_docker_password"
commands: commands:
- sleep 5 - sleep 5
- ls /usr/bin/ - dagger-go build golangbin
services: services:
- name: docker - name: docker

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"log" "log"
"path"
"strconv" "strconv"
"time" "time"
@ -74,8 +75,12 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
opts.BaseImage = "harbor.front.kjuulh.io/docker-proxy/library/busybox" 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 := container.LoadImage(client, opts.BaseImage)
c = c.Exec(dagger.ContainerExecOpts{
Args: []string{"mkdir", "-p", binpath},
})
c, err := container.MountFileFromLoaded(ctx, c, bin, usrbin) c, err := container.MountFileFromLoaded(ctx, c, bin, usrbin)
if err != nil { if err != nil {
return err return err
@ -85,11 +90,11 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
return nil return nil
}, },
}, },
//byg.Step{ byg.Step{
// Execute: func(_ byg.Context) error { Execute: func(_ byg.Context) error {
// return golang.Test(ctx, build) return golang.Test(ctx, build)
// }, },
//}, },
). ).
Step( Step(
"upload-image", "upload-image",