diff --git a/HadesScheduler/docker/docker.go b/HadesScheduler/docker/docker.go index c211a39..45c27df 100644 --- a/HadesScheduler/docker/docker.go +++ b/HadesScheduler/docker/docker.go @@ -3,7 +3,6 @@ package docker import ( "context" "fmt" - "os" "time" "github.com/Mtze/HadesCI/shared/payload" @@ -104,21 +103,8 @@ func executeStep(ctx context.Context, client *client.Client, step payload.Step, // Create the bash script if there is one if step.Script != "" { - scriptPath, err := writeBashScriptToFile(step.Script) - if err != nil { - log.WithError(err).Error("Failed to write bash script to a temporary file") - return err - } - defer os.Remove(scriptPath) - - host_config.Mounts = append(host_config.Mounts, mount.Mount{ - Type: mount.TypeBind, - Source: scriptPath, - Target: "/tmp/script.sh", - }) - // Overwrite the default entrypoint - container_config.Entrypoint = []string{"/bin/bash", "/tmp/script.sh"} + container_config.Entrypoint = []string{"/bin/bash", "-c", step.Script} } resp, err := client.ContainerCreate(ctx, &container_config, &host_config, nil, nil, "") diff --git a/HadesScheduler/docker/utils.go b/HadesScheduler/docker/utils.go deleted file mode 100644 index 4809120..0000000 --- a/HadesScheduler/docker/utils.go +++ /dev/null @@ -1,24 +0,0 @@ -package docker - -import ( - "os" - "strings" -) - -func writeBashScriptToFile(bashScriptLines ...string) (string, error) { - bashScriptContent := strings.Join(bashScriptLines, "\n") - tmpFile, err := os.CreateTemp("", "bash-script-*.sh") - if err != nil { - return "", err - } - - _, err = tmpFile.Write([]byte(bashScriptContent)) - if err != nil { - tmpFile.Close() - return "", err - } - - path := tmpFile.Name() - tmpFile.Close() - return path, nil -}