-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Execute exec/java script checks in containers #2585
Conversation
client/driver/raw_exec.go
Outdated
@@ -247,7 +255,7 @@ func (h *rawExecHandle) Update(task *structs.Task) error { | |||
} | |||
|
|||
func (h *rawExecHandle) Exec(ctx context.Context, cmd string, args []string) ([]byte, int, error) { | |||
return execChroot(ctx, "", cmd, args) | |||
return execScript(ctx, h.taskDir.Dir, h.taskEnv, cmd, args) |
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.
Why not call the Exec on the executor?
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.
Well there was no reason to have the exact same code here and in UniversalExecutor.Exec, so I at least combined them.
I could have raw_exec (and rkt, the other driver that behaves this way) call the executor, but honestly it's just more runtime overhead to run the exact same code. If it actually has a functional difference in the future it will be easy to change then.
client/task_runner.go
Outdated
} | ||
|
||
// SaveState is used to snapshot our state | ||
func (r *TaskRunner) SaveState() error { | ||
r.persistLock.Lock() | ||
defer r.persistLock.Unlock() | ||
|
||
r.logger.Printf("[XXX] task_runner: %q", r.config.Version) |
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.
Remove
} | ||
|
||
// ver06 is used for checking for pre-0.6 script checks | ||
var ver06 = version.Must(version.NewVersion("0.6.0dev")) |
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.
Does the library handle dev? Is 0.6.0
> 0.6.0dev
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.
Yup! Added a big huge test to make sure.
Ready for re-review. |
LGTM |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #2554
The original PR #2467 for the Consul Refactor executed exec/java script checks in a chroot but with none of the other containerization done by the exec/java drivers.
This PR does three things:
@dadgar: I hate basically all of the names I chose in this PR (eg
pre06ScriptCheckReason
), so please feel free to suggest changes! While havingDriverHandle.Exec
callExecutor.Exec
has nice symmetry, using the wordExec
over and over might be confusing as well...