Skip to content

Commit

Permalink
fix(worker): find key by name
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt committed Jan 17, 2020
1 parent 48218c9 commit 9512ea2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions engine/worker/internal/action/builtin_gitclone.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func RunGitClone(ctx context.Context, wk workerruntime.Runtime, a sdk.Action, se
if privateKey != nil && privateKey.Value != "" {
// The private key parameter, contains the name of the private key to use.
// Let's look up in the secret list to find the content of the private key
privateKeyContent := sdk.VariableFind(secrets, privateKey.Value)
privateKeyContent := sdk.VariableFind(secrets, privateKey.Name)

if privateKeyContent == nil {
return sdk.Result{}, fmt.Errorf("unknown key \"%s\"", privateKey.Value)
return sdk.Result{}, fmt.Errorf("unknown key \"%s\"", privateKey.Name)
}

installedKey, err := wk.InstallKey(sdk.Variable{
Expand Down
8 changes: 7 additions & 1 deletion engine/worker/internal/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,13 @@ func setupWorkingDirectory(ctx context.Context, fs afero.Fs, wd string) (afero.F
}
}

if err := os.Setenv("HOME", wd); err != nil {
var absWD string
if x, ok := fs.(*afero.BasePathFs); ok {
absWD, _ = x.RealPath(wd)
} else {
absWD = wd
}
if err := os.Setenv("HOME", absWD); err != nil {
return nil, err
}

Expand Down

0 comments on commit 9512ea2

Please sign in to comment.