Add ability to copy files to and delete files from runner

This commit is contained in:
Jan-Eric Hellenberg
2021-05-31 16:31:15 +02:00
parent 242d0175a2
commit 02b3f52a11
23 changed files with 757 additions and 240 deletions

View File

@ -25,7 +25,7 @@ type apiQuerier interface {
DeleteRunner(runnerId string) (err error)
// ExecuteCommand runs a command in the passed allocation.
ExecuteCommand(allocationID string, ctx context.Context, command []string,
ExecuteCommand(allocationID string, ctx context.Context, command []string, tty bool,
stdin io.Reader, stdout, stderr io.Writer) (int, error)
// loadRunners loads all allocations of the specified job.
@ -66,13 +66,13 @@ func (nc *nomadApiClient) DeleteRunner(runnerId string) (err error) {
}
func (nc *nomadApiClient) ExecuteCommand(allocationID string,
ctx context.Context, command []string,
ctx context.Context, command []string, tty bool,
stdin io.Reader, stdout, stderr io.Writer) (int, error) {
allocation, _, err := nc.client.Allocations().Info(allocationID, nil)
if err != nil {
return 1, err
}
return nc.client.Allocations().Exec(ctx, allocation, TaskName, true, command, stdin, stdout, stderr, nil, nil)
return nc.client.Allocations().Exec(ctx, allocation, TaskName, tty, command, stdin, stdout, stderr, nil, nil)
}
func (nc *nomadApiClient) loadRunners(jobId string) (allocationListStub []*nomadApi.AllocationListStub, err error) {