fixed issue with disjunction that wouldnt resolve
Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
parent
0295dc6340
commit
feb685cf81
@ -24,8 +24,10 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve
|
|||||||
Remote string
|
Remote string
|
||||||
Ref string
|
Ref string
|
||||||
KeepGitDir bool
|
KeepGitDir bool
|
||||||
|
Auth struct {
|
||||||
Username string
|
Username string
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := v.Decode(&gitPull); err != nil {
|
if err := v.Decode(&gitPull); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -40,8 +42,8 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve
|
|||||||
gitOpts = append(gitOpts, llb.KeepGitDir())
|
gitOpts = append(gitOpts, llb.KeepGitDir())
|
||||||
}
|
}
|
||||||
|
|
||||||
if gitPull.Username != "" {
|
if gitPull.Auth.Username != "" {
|
||||||
pwd := v.Lookup("password")
|
pwd := v.Lookup("auth.password")
|
||||||
|
|
||||||
pwdSecret, err := pctx.Secrets.FromValue(pwd)
|
pwdSecret, err := pctx.Secrets.FromValue(pwd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -53,16 +55,16 @@ func (c gitPullTask) Run(ctx context.Context, pctx *plancontext.Context, s solve
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
remote.User = url.UserPassword(gitPull.Username, strings.TrimSpace(pwdSecret.PlainText()))
|
remote.User = url.UserPassword(gitPull.Auth.Username, strings.TrimSpace(pwdSecret.PlainText()))
|
||||||
gitPull.Remote = remote.String()
|
gitPull.Remote = remote.String()
|
||||||
} else if authToken := v.Lookup("authToken"); plancontext.IsSecretValue(authToken) {
|
} else if authToken := v.Lookup("auth.authToken"); plancontext.IsSecretValue(authToken) {
|
||||||
authTokenSecret, err := pctx.Secrets.FromValue(authToken)
|
authTokenSecret, err := pctx.Secrets.FromValue(authToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
lg.Debug().Str("authToken", "***").Msg("adding git option")
|
lg.Debug().Str("authToken", "***").Msg("adding git option")
|
||||||
gitOpts = append(gitOpts, llb.AuthTokenSecret(authTokenSecret.ID()))
|
gitOpts = append(gitOpts, llb.AuthTokenSecret(authTokenSecret.ID()))
|
||||||
} else if authHeader := v.Lookup("authHeader"); plancontext.IsSecretValue(authHeader) {
|
} else if authHeader := v.Lookup("auth.authHeader"); plancontext.IsSecretValue(authHeader) {
|
||||||
authHeaderSecret, err := pctx.Secrets.FromValue(authHeader)
|
authHeaderSecret, err := pctx.Secrets.FromValue(authHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -19,7 +19,7 @@ package engine
|
|||||||
remote: string
|
remote: string
|
||||||
ref: string
|
ref: string
|
||||||
keepGitDir: true | *false
|
keepGitDir: true | *false
|
||||||
{
|
auth?: {
|
||||||
username: string
|
username: string
|
||||||
password: #Secret // can be password or personal access token
|
password: #Secret // can be password or personal access token
|
||||||
} | {
|
} | {
|
||||||
|
@ -16,7 +16,7 @@ engine.#Plan & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
image: engine.#Pull & {
|
image: engine.#Pull & {
|
||||||
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
|
source: "alpine:3.15.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify: engine.#Exec & {
|
verify: engine.#Exec & {
|
||||||
@ -27,8 +27,8 @@ engine.#Plan & {
|
|||||||
[ -d /repo2/.git ]
|
[ -d /repo2/.git ]
|
||||||
"""]
|
"""]
|
||||||
mounts: {
|
mounts: {
|
||||||
repo_1: {dest: "/repo1", contents: repo1.output}
|
a: {dest: "/repo1", contents: repo1.output}
|
||||||
repo_2: {dest: "/repo2", contents: repo2.output}
|
b: {dest: "/repo2", contents: repo2.output}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,11 @@ engine.#Plan & {
|
|||||||
testRepo: engine.#GitPull & {
|
testRepo: engine.#GitPull & {
|
||||||
remote: "https://github.com/dagger/dagger.git"
|
remote: "https://github.com/dagger/dagger.git"
|
||||||
ref: "main"
|
ref: "main"
|
||||||
|
auth: {
|
||||||
username: "dagger-test"
|
username: "dagger-test"
|
||||||
password: inputs.secrets.token.contents
|
password: inputs.secrets.token.contents
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
testContent: engine.#Exec & {
|
testContent: engine.#Exec & {
|
||||||
input: alpine.output
|
input: alpine.output
|
||||||
|
Reference in New Issue
Block a user