Skip to content

Commit e0cd7ca

Browse files
committed
WIP
1 parent 49d5d3f commit e0cd7ca

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Available commands are:
2121
meta-data Get/set data from Buildkite jobs
2222
pipeline Make changes to the pipeline of the currently running build
2323
step Make changes to a step (this includes any jobs that were created from the step)
24-
bootstrap Run a Buildkite job locally
24+
bootstrap [DEPRECATED] Run a Buildkite job locally
25+
exec-job Run a Buildkite job locally
2526
help Shows a list of commands or help for one command
2627
2728
Use "buildkite-agent <command> --help" for more information about a command.

clicommand/agent_start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ var AgentStartCommand = cli.Command{
418418
cli.StringFlag{
419419
Name: "bootstrap-script",
420420
Value: "",
421-
Usage: "The command that is executed for bootstrapping a job, defaults to the exec-job sub-command of this binary",
421+
Usage: "[DEPRECATED] The command that is executed for bootstrapping a job, defaults to the exec-job sub-command of this binary",
422422
EnvVar: "BUILDKITE_BOOTSTRAP_SCRIPT_PATH",
423423
},
424424
cli.StringFlag{
@@ -656,7 +656,7 @@ var AgentStartCommand = cli.Command{
656656
cfg.NoPTY = true
657657
}
658658

659-
// Set a useful default for the bootstrap script
659+
// Set a useful default for the job exec script
660660
if cfg.JobExecutorScript == "" {
661661
exePath, err := os.Executable()
662662
if err != nil {

clicommand/exec-job.go

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ type ExecJobConfig struct {
8787
Debug bool `cli:"debug"`
8888
Shell string `cli:"shell"`
8989
Experiments []string `cli:"experiment" normalize:"list"`
90-
Phases []string `cli:"phases" normalize:"list"`
90+
Phases []string `cli:"phases" normalize:"list" deprecated-and-renamed-to:"exec-phases"`
91+
ExecPhases []string `cli:"exec-phases" normalize:"list"`
9192
Profile string `cli:"profile"`
9293
CancelSignal string `cli:"cancel-signal"`
9394
RedactedVars []string `cli:"redacted-vars" normalize:"list"`
@@ -322,6 +323,11 @@ var execJobFlags = []cli.Flag{
322323
},
323324
cli.StringSliceFlag{
324325
Name: "phases",
326+
Usage: "[DEPRECATED] The specific phases to execute. The order they're defined is irrelevant.",
327+
EnvVar: "BUILDKITE_BOOTSTRAP_PHASES",
328+
},
329+
cli.StringSliceFlag{
330+
Name: "exec-phases",
325331
Usage: "The specific phases to execute. The order they're defined is irrelevant.",
326332
EnvVar: "BUILDKITE_BOOTSTRAP_PHASES",
327333
},
@@ -509,16 +515,12 @@ func execJobAction(c *cli.Context) {
509515
os.Exit(exitCode)
510516
}
511517

512-
var (
513-
BootstrapCommand = genBootstrap()
514-
ExecJobCommand = genExecJob()
515-
)
516-
517518
func genBootstrap() cli.Command {
518519
var help strings.Builder
519520
help.WriteString("⚠️ ⚠️ ⚠️\n")
520521
help.WriteString("DEPRECATED: Use `buildkite-agent exec-job` instead\n")
521522
help.WriteString("⚠️ ⚠️ ⚠️\n\n")
523+
522524
err := execJobHelpTpl.Execute(&help, "bootstrap")
523525
if err != nil {
524526
// This can only hapen if we've mangled the template or its parsing
@@ -532,7 +534,13 @@ func genBootstrap() cli.Command {
532534
Usage: "[DEPRECATED] Run a Buildkite job locally",
533535
Description: help.String(),
534536
Flags: execJobFlags,
535-
Action: execJobAction,
537+
Action: func(c *cli.Context) {
538+
fmt.Println("⚠️ WARNING ⚠️")
539+
fmt.Println("This command (`buildkite-agent bootstrap`) is deprecated and will be removed in a future release")
540+
fmt.Println("Please use `buildkite-agent exec-job` instead")
541+
fmt.Println("")
542+
execJobAction(c)
543+
},
536544
}
537545
}
538546

@@ -551,12 +559,11 @@ func genExecJob() cli.Command {
551559
Usage: "Run a Buildkite job locally",
552560
Description: help.String(),
553561
Flags: execJobFlags,
554-
Action: func(c *cli.Context) {
555-
fmt.Println("⚠️ WARNING ⚠️")
556-
fmt.Println("This command (`buildkite-agent bootstrap`) is deprecated and will be removed in a future release")
557-
fmt.Println("Please use `buildkite-agent exec-job` instead.")
558-
fmt.Println("")
559-
execJobAction(c)
560-
},
562+
Action: execJobAction,
561563
}
562564
}
565+
566+
var (
567+
BootstrapCommand = genBootstrap()
568+
ExecJobCommand = genExecJob()
569+
)

job/integration/executor_tester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (b *ExecutorTester) Run(t *testing.T, env ...string) error {
263263

264264
buf := &buffer{}
265265

266-
if os.Getenv("DEBUG_BOOTSTRAP") == "1" {
266+
if os.Getenv("DEBUG_JOB_EXEC") == "1" {
267267
w := newTestLogWriter(t)
268268
b.cmd.Stdout = io.MultiWriter(buf, w)
269269
b.cmd.Stderr = io.MultiWriter(buf, w)

0 commit comments

Comments
 (0)