-
Notifications
You must be signed in to change notification settings - Fork 31
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 version command #12
Conversation
`astro version` will print the version of astro at the command line. Version information will be set using ldflags at release time. For more information, see: https://stackoverflow.com/questions/11354518/golang-application-auto-build-versioning Automated releasing will be implemented in a separate PR.
54691ae
to
ec8314c
Compare
CHANGELOG.md
Outdated
* Propagate SIGINT and SIGTERM to terraform processes (#49) | ||
* Support detach flag with terraform 0.12 (#45) | ||
* Fix plan output for terraform 0.12 (#41) | ||
* Fix bug in initialization of allowed values (#43) | ||
* Don't pass varialbes to modules that don't delcare them (#40) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put this in a separate PR? They have nothing to do with this one.
(Also, typo: "variables")
astro/cli/astro/cmd/version.go
Outdated
@@ -0,0 +1,62 @@ | |||
/* | |||
* Copyright (c) 2018 Uber Technologies, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2019
astro/tests/integration_test.go
Outdated
@@ -71,10 +71,18 @@ func stringVersionMatches(v string, versionConstraint string) bool { | |||
} | |||
|
|||
// compiles the astro binary and returns the path to it. | |||
func compileAstro(dir string) (string, error) { | |||
func compileAstro(dir string, ldflags []string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just make this buildFlags []string
and allow people to pass arbitrary flags.
astro/tests/integration_test.go
Outdated
if err != nil { | ||
panic(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In tests just do:
require.NoError(t, err)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
astro/tests/integration_test.go
Outdated
if err != nil { | ||
panic(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.NoError(t, err)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks
astro/tests/integration_test.go
Outdated
assert.Equal(t, "astro version 1.2.3 (ab123) built 2019-01-01T10:00:00\n", stdoutBytes.String()) | ||
} | ||
|
||
func TestPlanErorrsWithoutConfig(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we test apply
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test below.
astro/tests/integration_test.go
Outdated
func TestApplyErorrsWithoutConfig(t *testing.T) { | ||
dir, err := ioutil.TempDir("/tmp", "astro-tests") | ||
require.NoError(t, err) | ||
defer os.RemoveAll(dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
You could also make these two tests into a table test (if you wanted... 😉 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
astro version
will print the version of astro at the command line.Version information will be set using ldflags at release time. For more
information, see:
https://stackoverflow.com/questions/11354518/golang-application-auto-build-versioning
Automated releases will be implemented in a separate PR (#14).