Add native Notarius readiness checks
This commit is contained in:
@@ -57,26 +57,7 @@ func (r *SubprocessRunner) Run(ctx context.Context, req RunRequest) (RunResult,
|
||||
return RunResult{}, fmt.Errorf("notarius credentials: %w", err)
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"run", req.PipelineID,
|
||||
"--config", req.ConfigPath,
|
||||
"--input-file", req.InputPath,
|
||||
"--output-dir", req.OutputRoot,
|
||||
}
|
||||
if req.Cache != nil {
|
||||
args = append(args, "--cache", *req.Cache)
|
||||
}
|
||||
if req.Debug {
|
||||
args = append(args, "--debug")
|
||||
}
|
||||
args = append(args, "--debug-dir", req.DebugDirectory)
|
||||
for _, reference := range references {
|
||||
args = append(args, "--reference", reference.Selector+"="+reference.Path)
|
||||
}
|
||||
if req.ConfigOverlay != nil {
|
||||
args = append(args, "--overlay", *req.ConfigOverlay)
|
||||
}
|
||||
args = append(args, "--format", "json")
|
||||
args := runArgs("run", req, references)
|
||||
processResult, err := r.run(ctx, subprocess.RunRequest{
|
||||
Executable: req.Binary,
|
||||
Args: args,
|
||||
@@ -113,6 +94,32 @@ func (r *SubprocessRunner) Run(ctx context.Context, req RunRequest) (RunResult,
|
||||
return baseResult, nil
|
||||
}
|
||||
|
||||
// runArgs is shared by execution and readiness so selected runtime controls
|
||||
// and references cannot drift between the two commands.
|
||||
func runArgs(command string, req RunRequest, references []ReferenceBinding) []string {
|
||||
args := []string{
|
||||
command, req.PipelineID,
|
||||
"--config", req.ConfigPath,
|
||||
"--input-file", req.InputPath,
|
||||
"--output-dir", req.OutputRoot,
|
||||
}
|
||||
if req.Cache != nil {
|
||||
args = append(args, "--cache", *req.Cache)
|
||||
}
|
||||
if req.Debug {
|
||||
args = append(args, "--debug")
|
||||
}
|
||||
args = append(args, "--debug-dir", req.DebugDirectory)
|
||||
for _, reference := range references {
|
||||
args = append(args, "--reference", reference.Selector+"="+reference.Path)
|
||||
}
|
||||
if req.ConfigOverlay != nil {
|
||||
args = append(args, "--overlay", *req.ConfigOverlay)
|
||||
}
|
||||
args = append(args, "--format", "json")
|
||||
return args
|
||||
}
|
||||
|
||||
func loadCompletionReport(path, pipelineID string) (CompletionReport, error) {
|
||||
var document struct {
|
||||
Pipeline string `json:"pipeline"`
|
||||
|
||||
Reference in New Issue
Block a user