conforming to llb api
Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
parent
7ca84282be
commit
ee938111c6
@ -44,15 +44,17 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve
|
|||||||
if opts.KeepGitDir {
|
if opts.KeepGitDir {
|
||||||
gitOpts = append(gitOpts, llb.KeepGitDir())
|
gitOpts = append(gitOpts, llb.KeepGitDir())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secret
|
// Secret
|
||||||
if authToken := v.Lookup("auth.token"); authToken.Exists() {
|
if authToken := v.Lookup("authToken"); authToken.Exists() {
|
||||||
authTokenSecret, err := pctx.Secrets.FromValue(authToken)
|
authTokenSecret, err := pctx.Secrets.FromValue(authToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
gitOpts = append(gitOpts, llb.AuthTokenSecret(authTokenSecret.ID()))
|
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)
|
authHeaderSecret, err := pctx.Secrets.FromValue(authHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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))
|
gitOpts = append(gitOpts, withCustomName(v, "FetchGit %s@%s", remoteRedacted, ref))
|
||||||
|
|
||||||
st := llb.Git(
|
st := llb.Git(remote, ref, gitOpts...)
|
||||||
remote,
|
|
||||||
ref,
|
|
||||||
gitOpts...,
|
|
||||||
)
|
|
||||||
|
|
||||||
result, err := s.Solve(ctx, st, pctx.Platform.Get())
|
result, err := s.Solve(ctx, st, pctx.Platform.Get())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -75,6 +73,6 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve
|
|||||||
|
|
||||||
fs := pctx.FS.New(result)
|
fs := pctx.FS.New(result)
|
||||||
return compiler.NewValue().FillFields(map[string]interface{}{
|
return compiler.NewValue().FillFields(map[string]interface{}{
|
||||||
"contents": fs.MarshalCUE(),
|
"output": fs.MarshalCUE(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,10 @@ package engine
|
|||||||
// Pull a directory from a git remote
|
// Pull a directory from a git remote
|
||||||
#GitPull: {
|
#GitPull: {
|
||||||
$dagger: task: _name: "GitPull"
|
$dagger: task: _name: "GitPull"
|
||||||
remote: string
|
remote: string
|
||||||
ref: string
|
ref: string
|
||||||
auth: {
|
authToken?: #Secret
|
||||||
token?: #Secret
|
authHeader?: #Secret
|
||||||
header?: #Secret
|
keepGitDir: true | *false
|
||||||
}
|
output: #FS
|
||||||
output: #FS
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user