Use native pipeline discovery and independent secrets bootstrap

This commit is contained in:
2026-11-17 22:06:29 +00:00
parent 341fe93e3b
commit 6593ccbeaf
21 changed files with 208 additions and 270 deletions

View File

@@ -18,12 +18,14 @@ type secretsBootstrap struct {
called bool
}
func (b *secretsBootstrap) load(pipelinePath string, loader func(string) (*configkit.SecretsReport, error), diagnostics io.Writer) error {
var conventionalSecretsDirectory = "/usr/local/etc/narratio/secrets"
func (b *secretsBootstrap) load(loader func(string) (*configkit.SecretsReport, error), diagnostics io.Writer) error {
if b == nil || b.called {
return nil
}
b.called = true
directory, required, err := selectedSecretsDirectory(pipelinePath, b.selection)
directory, required, err := selectedSecretsDirectory(b.selection)
if err != nil {
return err
}
@@ -53,7 +55,7 @@ func (b *secretsBootstrap) load(pipelinePath string, loader func(string) (*confi
return fmt.Errorf("bootstrap secrets directory: %w", loadErr)
}
func selectedSecretsDirectory(pipelinePath string, selection *string) (string, bool, error) {
func selectedSecretsDirectory(selection *string) (string, bool, error) {
if selection != nil {
if strings.TrimSpace(*selection) == "" {
return "", true, fmt.Errorf("--secrets-dir requires a non-empty path")
@@ -64,9 +66,5 @@ func selectedSecretsDirectory(pipelinePath string, selection *string) (string, b
}
return filepath.Clean(path), true, nil
}
root, err := filepath.Abs(pipelinePath)
if err != nil {
return "", false, fmt.Errorf("resolve pipeline path for secrets discovery: %w", err)
}
return filepath.Join(filepath.Dir(root), "secrets"), false, nil
return conventionalSecretsDirectory, false, nil
}