Documentation
¶
Index ¶
- Constants
- Variables
- func MonitorTtySize(ctx context.Context, out *streams.Out, cli *client.Client, id string, ...) error
- func Run(params RunParams) error
- type BasicAuthCredentials
- type CertificateAuthority
- type Collector
- type Config
- type JobFile
- type Networks
- type Proxy
- type RegistryClient
- type RunParams
- type Updater
- func (u *Updater) Close() (err error)
- func (u *Updater) RunCmd(ctx context.Context, cmd, user string, env ...string) error
- func (u *Updater) RunShell(ctx context.Context, proxyURL string, apiUrl string, job *model.Job, ...) error
- func (u *Updater) Wait(ctx context.Context, condition container.WaitCondition) error
Constants ¶
const CollectorConfigPath = "/etc/otelcol-contrib/config.yaml"
const CollectorImageName = "ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:latest"
CollectorImageName is the default Docker image used
const ConfigFilePath = "/config.json"
ConfigFilePath is the path to proxy config file.
const ProxyImageName = "ghcr.io/github/dependabot-update-job-proxy/dependabot-update-job-proxy:latest"
ProxyImageName is the default Docker image used by the proxy
const (
StorageImageName = "ghcr.io/dependabot/dependabot-storage"
)
Variables ¶
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"}, }
var ErrInvalidVolume = fmt.Errorf("invalid volume syntax")
var (
ErrWriteAccess = fmt.Errorf("for security, credentials used in update are not allowed to have write access to GitHub API")
)
Functions ¶
Types ¶
type BasicAuthCredentials ¶
type BasicAuthCredentials struct {
Username string `json:"username"`
Password string `json:"password"`
}
BasicAuthCredentials represents credentials required for HTTP basic auth
type CertificateAuthority ¶
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.
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 Networks ¶
type Networks struct {
NoInternet network.CreateResponse
Internet network.CreateResponse
// contains filtered or unexported fields
}
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
// 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
}
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 ¶
Close kills and deletes the container and deletes updater mount paths related to the run.
func (*Updater) RunCmd ¶ added in v1.22.0
RunCmd executes the update scripts as the dependabot user, blocks until complete.