mirror of
https://github.com/drone/drone-cli.git
synced 2024-09-26 05:50:40 +02:00
ability to inject an SSH key into the build
This commit is contained in:
parent
6743cae6e8
commit
574d424289
@ -44,6 +44,15 @@ var ExecCmd = cli.Command{
|
||||
Usage: "docker certificate directory",
|
||||
Value: "",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "i",
|
||||
Value: "",
|
||||
Usage: "identify file injected in the container",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "trusted",
|
||||
Usage: "enable elevated privilege",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "cache",
|
||||
Usage: "execute cache steps",
|
||||
@ -128,6 +137,10 @@ func execCmd(c *cli.Context) error {
|
||||
Job drone.Job `json:"job"`
|
||||
Config string `json:"config"`
|
||||
}{
|
||||
Repo: drone.Repo{
|
||||
IsTrusted: c.Bool("trusted"),
|
||||
IsPrivate: true,
|
||||
},
|
||||
Job: drone.Job{
|
||||
Status: drone.StatusRunning,
|
||||
Environment: axis,
|
||||
@ -137,7 +150,20 @@ func execCmd(c *cli.Context) error {
|
||||
Status: drone.StatusRunning,
|
||||
Commit: "0000000000", // hack
|
||||
},
|
||||
Workspace: drone.Workspace{},
|
||||
}
|
||||
|
||||
// gets the ssh key if provided
|
||||
if len(c.String("i")) != 0 {
|
||||
key, err = ioutil.ReadFile(c.String("i"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
payload.Workspace.Keys = &drone.Key{
|
||||
Private: string(key),
|
||||
}
|
||||
}
|
||||
|
||||
if len(proj) != 0 {
|
||||
payload.Repo.Link = fmt.Sprintf("https://%s", proj)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user