Skip to content

Commit

Permalink
Merge pull request #61 from slam/slam/build-create-env
Browse files Browse the repository at this point in the history
Add --env flag to `bk build create`
  • Loading branch information
lox authored Jun 20, 2019
2 parents 2f250c9 + 1fcb89a commit 93807ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/bk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ func run(args []string, exit func(int)) {
Flag("branch", "The branch to use for the build").
StringVar(&buildCreateCtx.Branch)

buildCreateCmd.
Flag("env", "Environment to pass to the build").
StringsVar(&buildCreateCtx.Env)

// --------------------------
// browse command

Expand Down
4 changes: 4 additions & 0 deletions cmd_build_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ type BuildCreateCommandContext struct {
Branch string
Commit string
Message string
Env []string
}

func BuildCreateCommand(ctx BuildCreateCommandContext) error {
params := buildkiteBuildParams{
Branch: ctx.Branch,
Commit: ctx.Commit,
Message: ctx.Message,
Env: ctx.Env,
}

bk, err := ctx.BuildkiteGraphQLClient()
Expand Down Expand Up @@ -164,6 +166,7 @@ type buildkiteBuildParams struct {
Commit string
Branch string
Message string
Env []string
}

func createBuildkiteBuild(client *graphql.Client, params buildkiteBuildParams) (buildkiteBuildDetails, error) {
Expand All @@ -182,6 +185,7 @@ func createBuildkiteBuild(client *graphql.Client, params buildkiteBuildParams) (
"message": params.Message,
"commit": params.Commit,
"branch": params.Branch,
"env": params.Env,
}})
if err != nil {
return buildkiteBuildDetails{}, err
Expand Down

0 comments on commit 93807ec

Please sign in to comment.