-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zachary Scott
committed
Aug 10, 2018
1 parent
a78fed5
commit 86289a1
Showing
6 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/CircleCI-Public/circleci-cli/proxy" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func newStepCommand() *cobra.Command { | ||
stepCmd := &cobra.Command{ | ||
Use: "step", | ||
Short: "Execute steps", | ||
Hidden: true, | ||
} | ||
|
||
haltCmd := &cobra.Command{ | ||
Use: "halt", | ||
Short: "halt current task and treat as a successful", | ||
RunE: haltRunE, | ||
Hidden: true, | ||
} | ||
|
||
stepCmd.AddCommand(haltCmd) | ||
|
||
return stepCmd | ||
} | ||
|
||
func haltRunE(cmd *cobra.Command, args []string) error { | ||
return proxy.Exec("step halt", args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package proxy | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"syscall" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
func Exec(command string, args []string) error { | ||
agent, err := exec.LookPath("picard") | ||
if err != nil { | ||
return errors.Wrap(err, "Could not find `picard` executable on $PATH; please ensure that build-agent is installed") | ||
} | ||
|
||
err = syscall.Exec(agent, args, os.Environ()) // #nosec | ||
return errors.Wrap(err, "failed to execute picard command") | ||
} |