Move Notarius path and executable resolution into its adapter
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -91,7 +90,7 @@ func (extractStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (re
|
||||
if err != nil || timeout <= 0 {
|
||||
return nil, fmt.Errorf("extract: invalid notarius timeout %q", notariusConfig.Timeout)
|
||||
}
|
||||
resolvedBinary, err := resolveExecutable(notariusConfig.Binary)
|
||||
resolvedBinary, err := notarius.ResolveExecutable(notariusConfig.Binary)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("extract: resolve notarius binary: %w", err)
|
||||
}
|
||||
@@ -310,14 +309,6 @@ func extractionFingerprint(
|
||||
return hex.EncodeToString(digest[:]), nil
|
||||
}
|
||||
|
||||
func resolveExecutable(value string) (string, error) {
|
||||
resolved, err := exec.LookPath(strings.TrimSpace(value))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return absolutePath(resolved)
|
||||
}
|
||||
|
||||
func absolutePath(value string) (string, error) {
|
||||
trimmed := strings.TrimSpace(value)
|
||||
if trimmed == "" {
|
||||
|
||||
Reference in New Issue
Block a user