-
Notifications
You must be signed in to change notification settings - Fork 264
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
StackFile support #167
StackFile support #167
Conversation
Good job @trane9991 . It seems you quickly got a grasp of our new way of wrapping around AWS (i.e. cloud commands), although there are still some rough edges and things to improve on our side. Thanks for the work so far! We do not have a section on how to contribute to awless, so I will give you random hints that can help (you might already know):
To validate the project we then have:
More importantly, we now have acceptance tests for each cloud commands. In your case, this would be in the file Also I am wondering if the |
This reverts commit 4b73b22.
add Makefile add yaml vendor
Had to sort tags/parameters for the tests predictability
Hey, |
Makefile
Outdated
@@ -0,0 +1,11 @@ | |||
test: | |||
@echo Running tests | |||
@go test $$(go list ./... | grep -v /vendor/) |
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.
Since we expect Golang 1.9.x to be used, excluding vendor should not be necessary anymore. So a go test ./...
here should suffice and will be quicker.
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.
Right, I will remove it
aws/spec/stack.go
Outdated
// https://github.com/wallix/awless/issues/145 | ||
// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-cfn-artifacts.html | ||
func (cmd *UpdateStack) BeforeRun(ctx map[string]interface{}) error { | ||
// don't do anything if StackFile not provided |
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.
Wondering if we can we avoid duplication and do an extract method on the BeforeRun of Update and Create .... if the end result is not too ugly and makes sense ;) ?
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.
Make complete sense, I thought about it too, just didn't have time yet, to play with it a bit more.
acceptance/aws/stack_test.go
Outdated
newFilePath := strings.Join([]string{file.Name(), ext}, ".") | ||
if err = os.Rename(file.Name(), newFilePath); 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.
Shall we instead of a extra rename use just https://golang.org/pkg/io/ioutil/#TempDir, Join ioutil.WriteFile?
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.
Sure, make sense.
acceptance/aws/stack_test.go
Outdated
} | ||
|
||
func generateTmpFileWithExt(content, ext string) (*os.File, string, func()) { | ||
file, err := ioutil.TempFile("", "awless-at-tmpfile") |
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.
I would then put the signature of the method with a varargs like generateTmpFileWithExt(content, filename ... string)
for an optional filename (i.e. with any extension if needed) so that the caller control the name if needed and makes clear the intent
Did a quick review. Thanks for the work. Before merging if you don't mind it would be good to:
|
Negative tests is a very good idea. I tried it locally, but it would be nice to also add them to the tests. @simcap do you mean the example of final usage with the |
Yeap, a full one liner or (multi liner) capturing the different way you do manage stack creation/ and update ... You might have that in your bash history (removing sensitive param if needed of course) |
Anyway, I am just curious on how you manage the CI (i guess) pipeline with AWS and awless (even if I have some ideas). There might be stuff we could still improve or take into account. If you write an article about it let us know. |
Yep, I'm using it with the CI. I'm planning to prepare slides about the process somewhere later in December, I will share it with you once it is ready. Also, I will share usage example on the Issue comment, once finish with this PR. |
Thanks. Examples are mostly to put in the changelog along the new feature. |
Hey@simcap, |
Thanks. If you confirm that you have tested live error cases (empty, rubbish, unexisting files) and they have a clear and helpful output, I will merge it today. |
add a bit better error messages
@simcap |
@simcap thanks 🙇 |
Hey,
I know you guys are busy with preparation for ReInvent, but I prepared small PR with
stack-file
support. No need to merge it now, but I will appreciate some review and feedback.One thing that is missing is the CLI usage/description for
stack-file
, since, AFAIK all the descriptions generated automatically from appropriate AWS documentation, butstack-file
not on the docs.BTW, in this PR many vendor files are removed, I think it is because you forgot to run
dep prune
implements Issue #145