From ee938111c699c559f746e481a6e3de7f71b94c04 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 20 Dec 2021 13:30:35 -0700 Subject: [PATCH] conforming to llb api Signed-off-by: Richard Jones --- plan/task/gitPull.go | 14 ++++++-------- stdlib/europa/dagger/engine/git.cue | 13 ++++++------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/plan/task/gitPull.go b/plan/task/gitPull.go index 657fae86..789412ec 100644 --- a/plan/task/gitPull.go +++ b/plan/task/gitPull.go @@ -44,15 +44,17 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve if opts.KeepGitDir { gitOpts = append(gitOpts, llb.KeepGitDir()) } + // Secret - if authToken := v.Lookup("auth.token"); authToken.Exists() { + if authToken := v.Lookup("authToken"); authToken.Exists() { authTokenSecret, err := pctx.Secrets.FromValue(authToken) if err != nil { return nil, err } gitOpts = append(gitOpts, llb.AuthTokenSecret(authTokenSecret.ID())) } - if authHeader := v.Lookup("auth.header"); authHeader.Exists() { + + if authHeader := v.Lookup("authHeader"); authHeader.Exists() { authHeaderSecret, err := pctx.Secrets.FromValue(authHeader) if err != nil { return nil, err @@ -62,11 +64,7 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve gitOpts = append(gitOpts, withCustomName(v, "FetchGit %s@%s", remoteRedacted, ref)) - st := llb.Git( - remote, - ref, - gitOpts..., - ) + st := llb.Git(remote, ref, gitOpts...) result, err := s.Solve(ctx, st, pctx.Platform.Get()) if err != nil { @@ -75,6 +73,6 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve fs := pctx.FS.New(result) return compiler.NewValue().FillFields(map[string]interface{}{ - "contents": fs.MarshalCUE(), + "output": fs.MarshalCUE(), }) } diff --git a/stdlib/europa/dagger/engine/git.cue b/stdlib/europa/dagger/engine/git.cue index 957c4091..c21a0b68 100644 --- a/stdlib/europa/dagger/engine/git.cue +++ b/stdlib/europa/dagger/engine/git.cue @@ -13,11 +13,10 @@ package engine // Pull a directory from a git remote #GitPull: { $dagger: task: _name: "GitPull" - remote: string - ref: string - auth: { - token?: #Secret - header?: #Secret - } - output: #FS + remote: string + ref: string + authToken?: #Secret + authHeader?: #Secret + keepGitDir: true | *false + output: #FS }