Skip to content

Commit

Permalink
Allow setting --commit on slugcmplr release (#88)
Browse files Browse the repository at this point in the history
`slugcmplr` can be invoked on a separate (but equal) commit to the one
that is eventually released. This can lead to pushing commit IDs which
do not match any commit ID on the default branch for a project.

This can occur especially in scenarios where slugs are pre-emptively
built on auto generated merge-commits between a branch and its target.

This change allows for a manual override of the commit associated with a
release.
  • Loading branch information
CGA1123 authored Jan 2, 2022
1 parent ebdb8c2 commit 7a8137f
Show file tree
Hide file tree
Showing 92 changed files with 2,308 additions and 521 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ different from the one you built from. This will work as long as the
applications are in the same Heroku team. (This is becuase the slug must be
accessible to the application).

You can optionally pass `--commit [COMMIT]` to associate this release with a
separate commit from the one used to build this slug initially.

## Authentication

The `slugcmplr` CLI looks for credentials to `api.heroku.com` in your `.netrc`
Expand Down
7 changes: 6 additions & 1 deletion cmd/slugcmplr/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type release struct {
}

func releaseCmd(verbose bool) *cobra.Command {
var buildDir, application string
var buildDir, application, commit string
cmd := &cobra.Command{
Use: "release",
Short: "release a slug",
Expand Down Expand Up @@ -49,6 +49,10 @@ func releaseCmd(verbose bool) *cobra.Command {
r.Application = application
}

if commit != "" {
r.Commit = commit
}

log(out, "application: %v", r.Application)
log(out, "slug: %v", r.Slug)

Expand Down Expand Up @@ -101,6 +105,7 @@ func releaseCmd(verbose bool) *cobra.Command {
cmd.Flags().StringVar(&buildDir, "build-dir", "", "The build directory")
cmd.MarkFlagRequired("build-dir") // nolint:errcheck

cmd.Flags().StringVar(&commit, "commit", "", "Override the commit this release is associated with")
cmd.Flags().StringVar(&application, "app", "", "Override the application to release to")

return cmd
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/spf13/cobra/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 8 additions & 26 deletions vendor/github.com/spf13/cobra/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/spf13/cobra/args.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 30 additions & 18 deletions vendor/github.com/spf13/cobra/bash_completions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 30 additions & 1 deletion vendor/github.com/spf13/cobra/bash_completionsV2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/spf13/cobra/command_notwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/spf13/cobra/command_win.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7a8137f

Please sign in to comment.