Skip to content

Commit f46a051

Browse files
Refactor RunJob function in LocalRunner to improve command argument handling and logging
- Moved command argument construction to a more logical order for clarity. - Enhanced logging to display the full command being executed, improving visibility into job execution.
1 parent 02ca604 commit f46a051

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

runner/local.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os/exec"
7+
"strings"
78

89
"github.com/infisical/go-sdk/packages/models"
910
)
@@ -41,23 +42,25 @@ func (l *LocalRunner) RunJob(ctx context.Context, _cmd string, req JobRequest) (
4142
image = req.Image
4243
}
4344

44-
args = append(args, image, _cmd, req.Command)
45-
46-
if req.ArgsJSONBase64 != "" {
47-
args = append(args, req.ArgsJSONBase64)
48-
}
49-
5045
args, err = l.LimitResources(ctx, req, args)
5146
if err != nil {
5247
fmt.Printf("Error limiting resources: %v\n", err)
5348
return "", err
5449
}
5550

51+
args = append(args, image, _cmd, req.Command)
52+
53+
if req.ArgsJSONBase64 != "" {
54+
args = append(args, req.ArgsJSONBase64)
55+
}
56+
5657
// Use overrides if provided, otherwise use default args
5758
if req.Overrides != nil && len(req.Overrides.Args) > 0 {
5859
args = append(args, req.Overrides.Args...)
5960
}
6061

62+
fmt.Printf("Running command: %s\n", strings.Join(args, " "))
63+
6164
cmd := exec.CommandContext(ctx, "docker", args...)
6265

6366
out, err := cmd.CombinedOutput()

0 commit comments

Comments
 (0)