Documentation ¶
Overview ¶
Package upstream defines how to check version info in upstream repositories.
Upstream types are identified by their _flavour_, represented as a string (see Flavour).
Different Upstream types can have their own parameters, but they must:
- Include the BaseUpstream type
- Define a LatestVersion() function that returns the latest available version as a string
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAWSClient ¶
NewAWSClient return a new aws service client for ec2
Authentication is provided by the standard AWS credentials use the standard `~/.aws/config` and `~/.aws/credentials` files, and support environment variables. See AWS documentation for more details: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/sessions.html
Types ¶
type AMI ¶
type AMI struct { Base `mapstructure:",squash"` // Either owner alias (e.g. "amazon") or owner id Owner string // Name predicate, as used in --filter // Supports wilcards Name string // ServiceClient is the AWS client to talk to AWS API ServiceClient EC2DescribeImagesAPI }
AMI is the Amazon Machine Image upstream
See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html
func (AMI) LatestVersion ¶
LatestVersion returns the latest version of an AMI.
Returns the latest ami id (e.g. `ami-1234567`) from all AMIs matching the predicates, sorted by CreationDate.
If images cannot be listed, or if no image matches the predicates, it will return an error instead.
type Base ¶
type Base struct {
Flavour Flavour `yaml:"flavour"`
}
Base only contains a flavour. "Concrete" upstreams each implement their own fields.
func (*Base) LatestVersion ¶
LatestVersion will always return an error. Base is only used to determine which actual upstream needs to be called, so it cannot return a sensible value.
type Container ¶
type Container struct { Base `mapstructure:",squash"` // Registry URL, e.g. gcr.io/k8s-staging-kubernetes/conformance Registry string // Optional: semver constraints, e.g. < 2.0.0 // Will have no effect if the dependency does not follow Semver Constraints string }
Container upstream representation.
func (Container) LatestVersion ¶
LatestVersion returns the latest tag for the given repository (depending on the Constraints if set).
type Dummy ¶
Dummy upstream always returns a fixed latest version, by default 1.0.0. Can be used for testing.
func (Dummy) LatestVersion ¶
LatestVersion always returns a fixed version.
type EC2DescribeImagesAPI ¶ added in v0.5.4
type EC2DescribeImagesAPI interface {
DescribeImages(ctx context.Context, params *ec2.DescribeImagesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeImagesOutput, error)
}
type EKS ¶
type EKS struct { Base `mapstructure:",squash"` // Optional: semver constraints, e.g. < 1.16.0 Constraints string }
EKS is the Elastic Kubernetes Service upstream
See: https://docs.aws.amazon.com/eks/index.html
func (EKS) LatestVersion ¶
LatestVersion returns the latest available EKS version.
Retrieves all available EKS versions from the parsing HTML from AWS's documentation page This feels brittle and wrong, but AFAIK there is no better way to do this.
type Flavour ¶
type Flavour string
Flavour is an enum of all supported upstreams and their string representation.
const ( // GithubFlavour is for Github releases. GithubFlavour Flavour = "github" // GitLabFlavour is for GitLab releases. GitLabFlavour Flavour = "gitlab" // AMIFlavour is for Amazon Machine Images. AMIFlavour Flavour = "ami" // HelmFlavour is for Helm Charts. HelmFlavour Flavour = "helm" // ContainerFlavour is for Container Images. ContainerFlavour Flavour = "container" // EKSFlavour is for Elastic Kubernetes Service. EKSFlavour Flavour = "eks" // DummyFlavour is for testing. DummyFlavour Flavour = "dummy" DefaultSemVerConstraints = ">= 0.0.0" )
type GitLab ¶
type GitLab struct { Base `mapstructure:",squash"` // GitLab Server if is a self-hosted GitLab instead, default to gitlab.com Server string // GitLab URL, e.g. hashicorp/terraform or helm/helm URL string // Optional: semver constraints, e.g. < 2.0.0 // Will have no effect if the dependency does not follow Semver Constraints string // If branch is specified, the version should be a commit SHA // Will look for new commits on the branch Branch string }
GitLab upstream representation.
func (GitLab) LatestVersion ¶
LatestVersion returns the latest non-draft, non-prerelease GitLab Release for the given repository (depending on the Constraints if set).
To authenticate your requests, use the GITLAB_TOKEN environment variable.
type Github ¶
type Github struct { Base `mapstructure:",squash"` // Github URL, e.g. hashicorp/terraform or helm/helm URL string // Optional: semver constraints, e.g. < 2.0.0 // Will have no effect if the dependency does not follow Semver Constraints string // If branch is specified, the version should be a commit SHA // Will look for new commits on the branch Branch string }
Github upstream representation.
func (Github) LatestVersion ¶
LatestVersion returns the latest non-draft, non-prerelease Github Release for the given repository (depending on the Constraints if set).
Authentication ¶
The Github API allows unauthenticated requests, but the API limits are very strict: https://developer.github.com/v3/#rate-limiting
To authenticate your requests, use the GITHUB_ACCESS_TOKEN environment variable.
type Helm ¶
type Helm struct { Base `mapstructure:",squash"` // Helm repository URL, e.g. https://grafana.github.io/helm-charts Repo string // Helm chart name in this repository Chart string // Optional: semver constraints, e.g. < 2.0.0 // Will have no effect if the dependency does not follow Semver Constraints string }
Helm upstream representation.
func (Helm) LatestVersion ¶
LatestVersion returns the latest non-draft, non-prerelease Helm Release for the given repository (depending on the Constraints if set).