Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --env flag to bk build create #61

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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