secret

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package secret resolves ((source:name)) references through the commands a deployment's config file names: ordered lookup paths, first found wins, "missing" moves on and any other failure stops (Concourse's atc/creds/secret_var_lookup.go).

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("secret not found")

ErrNotFound is every lookup path answering "missing".

Functions

This section is empty.

Types

type Config

type Config struct {
	Source map[string]Source `yaml:"source"`
}

Config is the `secret:` section of a `steps web --config` file.

type Path

type Path struct {
	Path string `yaml:"path"`
	When string `yaml:"when"`
}

Path is one lookup path, tried only for the references its when: allows.

type Ref

type Ref struct {
	Pipeline, Job, Resource, Source, Name string
}

Ref is one reference as the step that needs it sees it.

func (Ref) String

func (r Ref) String() string

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver holds the compiled sources.

func Parse

func Parse(raw []byte) (*Resolver, error)

Parse refuses unknown keys because a misspelled missing: would quietly become a fall-through to the wrong credential.

func (*Resolver) ForChecks

func (r *Resolver) ForChecks(ttl time.Duration) *Run

ForChecks is a memo whose answers expire: a poll has no run to scope one to, and without it a trigger: true resource prompts every interval (Concourse's --secret-cache-duration).

func (*Resolver) ForRun

func (r *Resolver) ForRun() *Run

ForRun starts a run's memo.

func (*Resolver) Has

func (r *Resolver) Has(name string) bool

Has reports whether a source of that name is configured.

func (*Resolver) Locate added in v0.4.0

func (r *Resolver) Locate(ctx context.Context, ref Ref) (string, error)

Locate is Lookup without the value: the location that answered, for `steps validate --live` to show a fall-through, or a lapsed login, before a job is half paid for.

func (*Resolver) Lookup

func (r *Resolver) Lookup(ctx context.Context, ref Ref) (string, error)

Lookup resolves one reference: the first lookup path its source finds wins, "missing" tries the next, anything else stops. The value never appears in an error.

type Run

type Run struct {
	// contains filtered or unexported fields
}

Run memoizes one run's lookups, single-flight, so a step re-placed after a spot reclaim, or two steps asking for the same name, prompt once.

func (*Run) Lookup

func (run *Run) Lookup(ctx context.Context, ref Ref) (string, error)

Lookup answers from the memo; a failure is not kept, so a declined prompt can be retried by the next attempt.

type Source

type Source struct {
	Command string        `yaml:"command"`
	Timeout time.Duration `yaml:"timeout"`
	Missing string        `yaml:"missing"`
	Lookup  []Path        `yaml:"lookup"`
}

Source is one named place secrets come from.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL