Add cron tasks to distillery

This commit is contained in:
Tom Wiesing 2022-12-07 10:30:48 +01:00
parent 790460f9de
commit f52fe6abf3
No known key found for this signature in database
19 changed files with 353 additions and 141 deletions

View file

@ -7,6 +7,7 @@ import (
"context"
"io"
"io/fs"
"os"
"path/filepath"
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
@ -29,6 +30,19 @@ type Stack struct {
DockerExecutable string // Path to the native docker executable to use
}
var errStackKill = errors.New("Stack.Kill: Kill returned non-zero exit code")
func (ds Stack) Kill(ctx context.Context, progress io.Writer, service string, signal os.Signal) error {
code, err := ds.compose(ctx, stream.NonInteractive(progress), "kill", service, "-s", signal.String())
if err != nil {
return err
}
if code != 0 {
return errStackKill
}
return nil
}
var errStackUpdatePull = errors.New("Stack.Update: Pull returned non-zero exit code")
var errStackUpdateBuild = errors.New("Stack.Update: Build returned non-zero exit code")