Documentation ¶
Index ¶
- Constants
- Variables
- func AllArchesForOSes(osList sets.String) sets.String
- func AllOSes() sets.String
- func ArchListFromString(targetArches string, osList sets.String) (sets.String, error)
- func BucketPathForRelease(bucketPrefix, buildType, releaseVersion, gitRef string) string
- func CmctlIsShipped(releaseVersion string) bool
- func IsClientOS(os string) bool
- func IsServerOS(os string) bool
- func LookupBranchRef(org, repo, branch string) (string, error)
- func LookupRefSHA(org, repo, ref string) (string, error)
- func NameForObjectPath(path, prefix string) string
- func OSListFromString(targetOSes string) (sets.String, error)
- type ArtifactMetadata
- type Bucket
- type Metadata
- type Staged
- type StagedArtifact
- type Unpacked
Constants ¶
const ( // MetadataFileName is the name of the file in the root of a staged // release. MetadataFileName = "metadata.json" // TarsBazelTarget is the Bazel target used to build release tar files in // the cert-manager repository. TarsBazelTarget = "//build/release-tars" // DefaultBucketName is the default GCS bucket used to store release // artifacts. This is re-used throughout the cmd/ package and used as the // default value for flags. DefaultBucketName = "cert-manager-release" // DefaultReleaseProject is the default project to run Cloud Build jobs in // to stage and publish releases. DefaultReleaseProject = "cert-manager-release" // DefaultBucketPathPrefix is the default prefix prepended to paths written // to Google Cloud Storage. DefaultBucketPathPrefix = "stage/gcb" // DefaultImageRepository is the default image repository used for artifact // images. DefaultImageRepository = "quay.io/jetstack" // DefaultGitHubOrg is the default organisation containing the cert-manager // repository. DefaultGitHubOrg = "cert-manager" // DefaultGitHubRepo is the default repository containing the cert-manager // code. DefaultGitHubRepo = "cert-manager" // DefaultHelmChartGitHubOwner is the name of the owner of the default // GitHub repository for Helm charts. DefaultHelmChartGitHubOwner = "jetstack" // DefaultHelmChartGitHubRepo is the name of the default GitHub repository // for Helm charts. DefaultHelmChartGitHubRepo = "jetstack-charts" // DefaultHelmChartGitHubBranch is the name of the main branch in the GitHub // repository for Helm charts. DefaultHelmChartGitHubBranch = "main" // BuildTypeRelease denotes that a build is targeting an actual named // release and is not just a development build that has been created using // the release tool. BuildTypeRelease = "release" // BuildTypeDevel denotes that a build did not explicitly set a // --release-version and so it is not suitable for being used as part of a // published release. BuildTypeDevel = "devel" // BuildSourceMake indicates that the files were built by make, rather than Bazel BuildSourceMake = "make" )
Variables ¶
var ( // ServerPlatforms is the list of OSes and architectures to build docker images // for during the release. // This is used to drive the `--platforms` flag passed to 'bazel build' as // well as to determine which image artifacts should be uploaded. ServerPlatforms = map[string][]string{ "linux": []string{"amd64", "arm", "arm64", "ppc64le", "s390x"}, } // ClientPlatforms is the list of OSes and architectures to build client CLI tools // for during the release. // This is used to determine which artifacts should be uploaded. ClientPlatforms = map[string][]string{ "linux": []string{"amd64", "arm", "arm64", "ppc64le", "s390x"}, "darwin": []string{"amd64", "arm64"}, "windows": []string{"amd64"}, } // ArchitecturesPerOS is the list of OSes and architectures that we can build // This is used to drive the `--platforms` flag passed to 'bazel build' ArchitecturesPerOS = map[string][]string{ "linux": []string{"amd64", "arm", "arm64", "ppc64le", "s390x"}, "darwin": []string{"amd64", "arm64"}, "windows": []string{"amd64"}, } )
Functions ¶
func AllArchesForOSes ¶
AllArchesForOSes returns all architectures targetted by any of the given OSes. Panics if any of the OSes are unknown
func AllOSes ¶
AllOSes returns a slice of all known operating systems which cert-manager targets including both server and client targets.
func ArchListFromString ¶
ArchListFromString parses and validates a comma-separated list of arches, returning a slice of valid arches if all are OK. Returns an error on an unknown architecture or an architecture which isn't a valid target for the given OSes for this invocation (e.g. will error if osList == []string{"windows"} and targetArches == "s390x") Panics if given an unknown OS
func BucketPathForRelease ¶
BucketPathForRelease will assemble an output directory path for the given release parameters.
func CmctlIsShipped ¶
Cmctl is only shipped with v1.14.X and below.
func IsClientOS ¶
IsClientOS returns true if cert-manager builds client binaries for the given platform
func IsServerOS ¶
IsServerOS returns true if cert-manager can be deployed to the given OS on the server side
func LookupBranchRef ¶
LookupBranchRef will lookup the git commit ref of the HEAD of the branch in the given repository. It does this by querying the GitHub v3 API at: https://api.github.com/repos/{org}/{repo}/git/ref/heads/{branch}
func LookupRefSHA ¶
LookupRefSHA will lookup the git commit SHA of the given ref in the given repository. It does this by querying the GitHub v3 API at: https://api.github.com/repos/{org}/{repo}/commits/{ref} Works with branches (will fetch the SHA of HEAD) or tags
func NameForObjectPath ¶
NameForObjectPath will return the name of the release that a given object path is a member of by inspecting the path and trimming the prefix.
Types ¶
type ArtifactMetadata ¶
type ArtifactMetadata struct { // Name of the artifact within the release directory. Name string `json:"name"` // SHA256 is a hash of the artifact, computed during the staging process. SHA256 string `json:"sha256"` // OS, if specified, is the OS parameter that this artifact was built for. // This could be 'linux', 'darwin', 'windows' etc. OS string `json:"os,omitempty"` // Architecture, if specified, is the architecture that this artifact was // built for. // This could be 'amd64', 'arm', 'arm64' etc. Architecture string `json:"architecture,omitempty"` }
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func (*Bucket) GetRelease ¶
GetRelease will fetch a single release from the bucket with the given name. A release's name is the name of the directory the metadata.json file for is the release is contained within.
func (*Bucket) ListReleases ¶
ListReleases will list releases in a bucket. If 'version' is provided, the list will be filtered to only releases with the specified version. If 'version' AND 'gitRef' are provided, the list will be filtered to only releases with the specified version built at the specified commit ref. Specifying 'gitRef' without 'version' is not supported.
type Metadata ¶
type Metadata struct { // ReleaseVersion, if set, is an explicit version used to build the release // artifacts. // By default, the release version will be computed by the Bazel release // process and the build type will be 'devel' instead of 'release'. ReleaseVersion string `json:"releaseVersion"` // Required git commit reference to build. GitCommitRef string `json:"gitCommitRef"` // GCS URIs of the artifacts that are a part of this build. Artifacts []ArtifactMetadata `json:"artifacts"` // BuildSource denotes what built the staged files, making it easier to identify // how they were produced. This is used as part of the migration from Bazel to // Make. An empty BuildSource is assumed to mean Bazel produced the files. BuildSource string `json:"buildSource,omitempty"` }
Metadata about a staged release.
type Staged ¶
type Staged struct {
// contains filtered or unexported fields
}
Staged is a release build staged in a GCS bucket. It provides convenience methods to interact with release build and inspect metadata.
func NewStagedRelease ¶
func (Staged) ArtifactsOfKind ¶
func (s Staged) ArtifactsOfKind(kind string) []StagedArtifact
ArtifactsOfKind returns a list of staged artifacts of the type denoted by `kind`. A kind may be 'server', 'manifests', 'test' etc.
type StagedArtifact ¶
type StagedArtifact struct { Metadata ArtifactMetadata ObjectHandle *storage.ObjectHandle }
StagedArtifact represents a single artifact within a release, with some associated metadata read from the release metadata.json file.
type Unpacked ¶
type Unpacked struct { ReleaseName string ReleaseVersion string GitCommitRef string Charts []manifests.Chart YAMLs []manifests.YAML CtlBinaryBundles []binaries.Archive // Only in v1.14.X and below. ComponentImageBundles map[string][]*images.Tar }
Unpacked wraps a staged release that has been fetched and unpacked locally. It provides methods to interact with the release in order to prepare it for publishing.