Skip to content
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

Merged
merged 9 commits into from
May 5, 2017

Conversation

schmichael
Copy link
Member

@schmichael schmichael commented Apr 25, 2017

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:

  1. Adds an Exec method to the executor to execute script checks inside exec/java containers
  2. Detects old executors for tasks with script checks and restarts them
  3. Makes exec/java script checks use the Executor.Exec method

@dadgar: I hate basically all of the names I chose in this PR (eg pre06ScriptCheckReason), so please feel free to suggest changes! While having DriverHandle.Exec call Executor.Exec has nice symmetry, using the word Exec over and over might be confusing as well...

@schmichael schmichael requested a review from dadgar April 25, 2017 18:56
@@ -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)
Copy link
Contributor

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?

Copy link
Member Author

@schmichael schmichael May 4, 2017

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.

}

// 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)
Copy link
Contributor

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"))
Copy link
Contributor

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

Copy link
Member Author

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.

@schmichael
Copy link
Member Author

Ready for re-review.

@dadgar
Copy link
Contributor

dadgar commented May 5, 2017

LGTM

@schmichael schmichael merged commit 499ada5 into master May 5, 2017
@schmichael schmichael deleted the b-2554-container-exec branch May 5, 2017 17:31
@github-actions
Copy link

github-actions bot commented Apr 1, 2023

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants