-
Notifications
You must be signed in to change notification settings - Fork 52
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
apply: to check module requirements before run #358
Conversation
modules must now provide a `make check` in their root makefile make check must exit 0 on all modules before proceeding to apply this allows checks for module specific binaries or check tokens permissions
Mind pasting text or posting a screenshot of what the final output looks like after this change? |
Hmm I wonder if we should be checking for return code 2 (a problem with make itself, like specifying a target that doesn't exist) and provide a slightly different message to indicate that it's likely a problem with the module itself. |
Hmm okay. In that case we could check stderr for the string "No rule to make target" |
internal/apply/apply.go
Outdated
@@ -41,21 +50,26 @@ Only a single environment may be suitable for an initial test, but for a real sy | |||
|
|||
flog.Infof("Infrastructure executor: %s", "Terraform") | |||
|
|||
applyAll(rootDir, *projectConfig, environments) | |||
err = modulesWalkCmd("apply", rootDir, projectConfig, []string{"make"}, environments) |
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.
Will this stop on the first one that fails? We should really test all the modules, and then return the state / output of all the tests. It wouldn't be a great experience to have to run the app multiple times, installing stuff between runs.
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.
yeah good point, right now it fails on the first error
Cool! Can we suppress the output as we are executing the command so we can just present Zero's nicer output? I guess we would just have to optionally disable the multi writer in |
internal/apply/apply_test.go
Outdated
|
||
}) | ||
|
||
t.Run("Moudles runs command overides", func(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.
This and below say "Moudles"
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.
That does have a nice ring to it though..
internal/util/util.go
Outdated
} | ||
|
||
go func() { | ||
_, errStdout = io.Copy(os.Stdout, stdoutPipe) | ||
}() | ||
go func() { | ||
_, errStderr = io.Copy(os.Stderr, stderrPipe) | ||
strErrStreams := []io.Writer{errContent} |
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.
is this supposed to be stdErrStreams
?
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.
sorry yeah, should have paid more attention with all these typos
modules must now provide a
make check
in their root makefilemake check must exit 0 on all modules before proceeding to apply
this allows checks for module specific binaries or check tokens permissions