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

Use direct entrypoint instead of tmp script mount #31

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions HadesScheduler/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package docker
import (
"context"
"fmt"
"os"
"time"

"github.com/Mtze/HadesCI/shared/payload"
Expand Down Expand Up @@ -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, "")
Expand Down
24 changes: 0 additions & 24 deletions HadesScheduler/docker/utils.go

This file was deleted.