infra

package
v1.95.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const CollectorConfigPath = "/etc/otelcol-contrib/config.yaml"
View Source
const CollectorImageName = "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest"

CollectorImageName is the default Docker image used

View Source
const ConfigFilePath = "/config.json"

ConfigFilePath is the path to proxy config file.

View Source
const ProxyImageName = "ghcr.io/dependabot/proxy:latest"

ProxyImageName is the default Docker image used by the proxy

View Source
const (
	StorageImageName = "ghcr.io/dependabot/dependabot-storage"
)

Variables

View Source
var CertSubject = pkix.Name{
	CommonName:         "Dependabot Internal CA",
	OrganizationalUnit: []string{"Dependabot"},
	Organization:       []string{"GitHub Inc."},
	Locality:           []string{"San Francisco"},
	Province:           []string{"California"},
	Country:            []string{"US"},
}
View Source
var ErrInvalidVolume = fmt.Errorf("invalid volume syntax")
View Source
var ErrSeccompUnavailable = errors.New("Docker host does not advertise seccomp support")
View Source
var (
	ErrWriteAccess = fmt.Errorf("for security, credentials used in update are not allowed to have write access to GitHub API")
)

Functions

func MonitorTtySize

func MonitorTtySize(ctx context.Context, out *streams.Out, cli *client.Client, id string, isExec bool) error

MonitorTtySize updates the container tty size when the terminal tty changes size

func Run

func Run(params RunParams) error

func RunContext added in v1.95.0

func RunContext(ctx context.Context, params RunParams) error

RunContext runs a job until completion, cancellation, or its configured timeout.

Types

type BasicAuthCredentials

type BasicAuthCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

BasicAuthCredentials represents credentials required for HTTP basic auth

type CertificateAuthority

type CertificateAuthority struct {
	Cert string `json:"cert"`
	Key  string `json:"key"`
}

CertificateAuthority includes the MITM CA certificate and private key

func GenerateCertificateAuthority

func GenerateCertificateAuthority() (CertificateAuthority, error)

GenerateCertificateAuthority generates a new proxy keypair CA

type Collector added in v1.38.0

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

func NewCollector added in v1.38.0

func NewCollector(ctx context.Context, cli *client.Client, net *Networks, params *RunParams, proxy *Proxy) (*Collector, error)

NewCollector starts the OpenTelemetry collector container.

func (*Collector) Close added in v1.38.0

func (c *Collector) Close() error

Close stops and removes the container.

func (*Collector) TailLogs added in v1.62.1

func (c *Collector) TailLogs(ctx context.Context, cli *client.Client)

type Config

type Config struct {
	Credentials []model.Credential   `json:"all_credentials"`
	CA          CertificateAuthority `json:"ca"`
}

Config is the structure of the proxy's config file

type JobFile added in v1.35.0

type JobFile struct {
	Job *model.Job `json:"job"`
}

JobFile is the payload passed to file updater containers.

func (JobFile) ToJSON added in v1.35.0

func (j JobFile) ToJSON() (string, error)

type Networks

type Networks struct {
	NoInternet network.CreateResponse
	Internet   network.CreateResponse
	// contains filtered or unexported fields
}

func NewNetworks

func NewNetworks(ctx context.Context, cli *client.Client) (*Networks, error)

func (*Networks) Close

func (n *Networks) Close() error

type Proxy

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

func NewProxy

func NewProxy(ctx context.Context, cli *client.Client, params *RunParams, nets *Networks) (*Proxy, error)

func (*Proxy) Close

func (p *Proxy) Close() (err error)

func (*Proxy) TailLogs

func (p *Proxy) TailLogs(ctx context.Context, cli *client.Client)

type RegistryClient added in v1.58.0

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

func NewRegistryClient added in v1.58.0

func NewRegistryClient(image string) *RegistryClient

func (*RegistryClient) DigestExists added in v1.58.0

func (r *RegistryClient) DigestExists(repoDigests []string) (bool, error)

func (*RegistryClient) GetLatestDigest added in v1.58.0

func (r *RegistryClient) GetLatestDigest(image string) (string, error)

type RunParams

type RunParams struct {
	// Input file
	Input string
	// job definition passed to the updater
	Job *model.Job
	// expectations asserted at the end of a test
	Expected []model.Output
	// directory to copy into the updater container as the repo
	LocalDir string
	// credentials passed to the proxy
	Creds []model.Credential
	// CredentialsResolved disables environment expansion and credential capture in smoke test output.
	CredentialsResolved bool
	// local directory used for caching
	CacheDir string
	// write output to a file
	Output string
	// ProxyCertPath is the path to a cert for the proxy to trust
	ProxyCertPath string
	// attempt to pull images if they aren't local?
	PullImages bool
	// run an interactive shell?
	Debug bool
	// generate performance metrics?
	Flamegraph bool
	// Volumes are used to mount directories in Docker
	Volumes []string
	// Timeout specifies an optional maximum duration the CLI will run an update.
	// If Timeout is <= 0 it will never time out.
	Timeout time.Duration
	// ExtraHosts adds /etc/hosts entries to the proxy for testing.
	ExtraHosts []string
	// UpdaterImage is the image to use for the updater
	UpdaterImage string
	// ProxyImage is the image to use for the proxy
	ProxyImage string
	// CollectorImage is the image to use for the OpenTelemetry collector
	CollectorImage string
	// CollectorConfigPath is the path to the OpenTelemetry collector configuration file
	CollectorConfigPath string
	// StorageImage is the image to use for the storage service
	StorageImage string
	// Writer is where API calls will be written to
	Writer    io.Writer
	InputName string
	InputRaw  []byte
	ApiUrl    string
	// UpdaterEnvironmentVariables are additional environment variables to set in the update container
	UpdaterEnvironmentVariables []string
}

func (*RunParams) Validate added in v1.33.0

func (p *RunParams) Validate() error

type Updater

type Updater struct {

	// ExitCode is set once an Updater command has completed.
	ExitCode *int
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater(ctx context.Context, cli *client.Client, net *Networks, params *RunParams, prox *Proxy, collector *Collector) (*Updater, error)

NewUpdater starts the update container interactively running /bin/sh, so it does not stop.

func (*Updater) Close

func (u *Updater) Close() (err error)

Close kills and deletes the container and deletes updater mount paths related to the run.

func (*Updater) RunCmd added in v1.22.0

func (u *Updater) RunCmd(ctx context.Context, cmd, user string, env ...string) error

RunCmd executes the update scripts as the dependabot user, blocks until complete.

func (*Updater) RunShell

func (u *Updater) RunShell(ctx context.Context, proxyURL string, apiUrl string, job *model.Job, additionalEnvVars []string) error

RunShell executes an interactive shell, blocks until complete.

func (*Updater) Wait

func (u *Updater) Wait(ctx context.Context, condition container.WaitCondition) error

Wait blocks until the condition is true.

Jump to

Keyboard shortcuts

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