Documentation ¶
Index ¶
- Constants
- Variables
- func CopyBinaries(rootPath, targetPath string) error
- func CreatePubBotBranchIssue(branchName string) error
- func DockerHubLogin() error
- func GetForceBuildKrel() string
- func GetK8sOrg() string
- func GetK8sRef() string
- func GetK8sRepo() string
- func GetToolOrg() string
- func GetToolRef() string
- func GetToolRepo() string
- func GetWorkspaceVersion() (string, error)
- func IsDefaultK8sUpstream() bool
- func IsDirtyBuild(build string) bool
- func IsUpToDate(oldVersion, newVersion semver.Version) bool
- func IsValidReleaseBuild(build string) (bool, error)
- func ListBuildBinaries(gitroot, version string) (list []struct{ ... }, err error)
- func ListBuildImages(gitroot, version string) (imageList []string, err error)
- func ListBuildTarballs(gitroot, version string) (tarList []string, err error)
- func PrepareWorkspaceRelease(directory, buildVersion, bucket string) error
- func PrepareWorkspaceStage(directory string, noMock bool) error
- func ReadDockerizedVersion(workDir string) (string, error)
- func URLPrefixForBucket(bucket string) string
- func WriteChecksums(rootPath string) error
- type ArtifactChecker
- type ArtifactCheckerOptions
- type BranchChecker
- type GitObjectPusher
- func (gp *GitObjectPusher) PushBranch(branchName string) error
- func (gp *GitObjectPusher) PushBranches(branchList []string) error
- func (gp *GitObjectPusher) PushMain() error
- func (gp *GitObjectPusher) PushTag(newTag string) (err error)
- func (gp *GitObjectPusher) PushTags(tagList []string) (err error)
- type GitObjectPusherOptions
- type Images
- func (i *Images) Exists(registry, version string, fast bool) (bool, error)
- func (i *Images) GetManifestImages(registry, version, buildPath string, ...) (map[string][]string, error)
- func (i *Images) Publish(registry, version, buildPath string) error
- func (i *Images) SetImpl(impl imageImpl)
- func (i *Images) Validate(registry, version, buildPath string) error
- type PrerequisitesChecker
- type PrerequisitesCheckerOptions
- type ProvenanceChecker
- type ProvenanceCheckerOptions
- type ProvenanceReader
- type ProvenanceReaderOptions
- type Publisher
- func (p *Publisher) PublishReleaseNotesIndex(gcsIndexRootPath, gcsReleaseNotesPath, version string) error
- func (p *Publisher) PublishToGcs(publishFile, buildDir, markerPath, version string, privateBucket bool) error
- func (p *Publisher) PublishVersion(buildType, version, buildDir, bucket, gcsRoot string, ...) error
- func (p *Publisher) SetClient(client publisherClient)
- func (p *Publisher) VerifyLatestUpdate(publishFile, markerPath, version string) (needsUpdate bool, err error)
- type Repo
- type Repository
- type Version
- type VersionClient
- type VersionType
- type Versions
Constants ¶
const ( DefaultToolRepo = "release" DefaultToolRef = git.DefaultBranch DefaultToolOrg = git.DefaultGithubOrg DefaultK8sOrg = git.DefaultGithubOrg DefaultK8sRepo = git.DefaultGithubRepo DefaultK8sRef = git.DefaultRef // TODO(vdf): Need to reference K8s Infra project here. DefaultKubernetesStagingProject = "kubernetes-release-test" DefaultRelengStagingTestProject = "k8s-staging-releng-test" DefaultRelengStagingProject = "k8s-staging-releng" DefaultDiskSize = "500" KubernetesTar = "kubernetes.tar.gz" // Staged source code tarball of Kubernetes. SourcesTar = "src.tar.gz" // Root path on the bucket for staged artifacts. StagePath = "stage" // Path where the release container images are stored. ImagesPath = "release-images" // GCSStagePath is the directory where release artifacts are staged before // push to GCS. GCSStagePath = "gcs-stage" // ReleaseStagePath is the directory where releases are staged. ReleaseStagePath = "release-stage" // GCEPath is the directory where GCE scripts are created. GCEPath = ReleaseStagePath + "/full/kubernetes/cluster/gce" // GCIPath is the path for the container optimized OS for gcli. GCIPath = ReleaseStagePath + "/full/kubernetes/cluster/gce/gci" // ReleaseTarsPath is the directory where release artifacts are created. ReleaseTarsPath = "release-tars" // WindowsLocalPath is the directory where Windows GCE scripts are created. WindowsLocalPath = ReleaseStagePath + "/full/kubernetes/cluster/gce/windows" // CIBucketLegacy is the default bucket for Kubernetes CI releases. CIBucketLegacy = "kubernetes-release-dev" // CIBucketK8sInfra is the community infra bucket for Kubernetes CI releases. CIBucketK8sInfra = "k8s-release-dev" // TestBucket is the default bucket for mocked Kubernetes releases. TestBucket = "kubernetes-release-gcb" // ProductionBucket is the default bucket for Kubernetes releases. // Owned by SIG k8s Infra: https://git.k8s.io/community/sig-k8s-infra ProductionBucket = "767373bbdcb8270361b96548387bf2a9ad0d48758c35" // ProductionBucketURL is the url for the ProductionBucket. ProductionBucketURL = "https://dl.k8s.io" // Production registry root URL. GCRIOPathProd = image.ProdRegistry // Staging registry root URL prefix. GCRIOPathStagingPrefix = image.StagingRepoPrefix // Staging registry root URL. GCRIOPathStaging = GCRIOPathStagingPrefix + image.StagingRepoSuffix // Mock staging registry root URL. GCRIOPathMock = GCRIOPathStaging + "/mock" // BuildDir is the default build output directory. BuildDir = "_output" // Publishing bot issue repository. PubBotRepoOrg = "kubernetes" PubBotRepoName = "sig-release" DockerHubEnvKey = "DOCKERHUB_TOKEN" // Env var containing the docker key DockerHubUserName = "k8sreleng" // Docker Hub username ProvenanceFilename = "provenance.json" // Name of the SLSA provenance file (used in stage and release) )
const ( ReleaseTypeOfficial string = "official" ReleaseTypeRC string = "rc" ReleaseTypeBeta string = "beta" ReleaseTypeAlpha string = "alpha" )
Variables ¶
var DefaultPrerequisitesCheckerOptions = &PrerequisitesCheckerOptions{ CheckGitHubToken: true, }
var ManifestImages = []string{
"conformance",
"kube-apiserver",
"kube-controller-manager",
"kube-proxy",
"kube-scheduler",
"kubectl",
}
Functions ¶
func CopyBinaries ¶ added in v0.4.1
CopyBinaries takes the provided `rootPath` and copies the binaries sorted by their platform into the `targetPath`.
func CreatePubBotBranchIssue ¶ added in v0.8.0
CreatePubBotBranchIssue creates an issue on GitHub to notify.
func DockerHubLogin ¶ added in v0.8.0
func DockerHubLogin() error
Calls docker login to log into docker hub using a token from the environment.
func GetForceBuildKrel ¶ added in v0.17.8
func GetForceBuildKrel() string
GetForceBuildKrel checks if the 'FORCE_BUILD_KREL' environment variable is set. If 'FORCE_BUILD_KREL' is non-empty, it returns the value. Otherwise, it returns "false".
func GetK8sOrg ¶ added in v0.12.0
func GetK8sOrg() string
GetK8sOrg checks if the 'K8S_ORG' environment variable is set. If 'K8S_ORG' is non-empty, it returns the value. Otherwise, it returns DefaultK8sOrg.
func GetK8sRef ¶ added in v0.12.0
func GetK8sRef() string
GetK8sRef checks if the 'K8S_REF' environment variable is set. If 'K8S_REF' is non-empty, it returns the value. Otherwise, it returns DefaultK8sRef.
func GetK8sRepo ¶ added in v0.12.0
func GetK8sRepo() string
GetK8sRepo checks if the 'K8S_REPO' environment variable is set. If 'K8S_REPO' is non-empty, it returns the value. Otherwise, it returns DefaultK8sRepo.
func GetToolOrg ¶ added in v0.2.5
func GetToolOrg() string
GetToolOrg checks if the 'TOOL_ORG' environment variable is set. If 'TOOL_ORG' is non-empty, it returns the value. Otherwise, it returns DefaultToolOrg.
func GetToolRef ¶ added in v0.8.0
func GetToolRef() string
GetToolRef checks if the 'TOOL_REF' environment variable is set. If 'TOOL_REF' is non-empty, it returns the value. Otherwise, it returns DefaultToolRef.
func GetToolRepo ¶ added in v0.2.5
func GetToolRepo() string
GetToolRepo checks if the 'TOOL_REPO' environment variable is set. If 'TOOL_REPO' is non-empty, it returns the value. Otherwise, it returns DefaultToolRepo.
func GetWorkspaceVersion ¶ added in v0.6.0
func IsDefaultK8sUpstream ¶ added in v0.12.0
func IsDefaultK8sUpstream() bool
IsDefaultK8sUpstream returns true if GetK8sOrg(), GetK8sRepo() and GetK8sRef() point to their default values.
func IsDirtyBuild ¶
IsDirtyBuild checks if build version is dirty.
func IsUpToDate ¶ added in v0.17.0
func IsUpToDate(oldVersion, newVersion semver.Version) bool
func IsValidReleaseBuild ¶
IsValidReleaseBuild checks if build version is valid for release.
func ListBuildBinaries ¶ added in v0.10.0
func ListBuildBinaries(gitroot, version string) (list []struct{ Path, Platform, Arch string }, err error)
ListBuildBinaries returns a list of binaries.
func ListBuildImages ¶ added in v0.10.0
ListBuildImages returns a slice with paths to all images produced by the build.
func ListBuildTarballs ¶ added in v0.10.0
ListBuildTarballs returns a list of the client, node server and other tarballs.
func PrepareWorkspaceRelease ¶ added in v0.6.0
PrepareWorkspaceRelease sets up the workspace by downloading and extracting the staged sources on the provided bucket.
func PrepareWorkspaceStage ¶ added in v0.6.0
PrepareWorkspaceStage sets up the workspace by cloning a new copy of k/k.
func ReadDockerizedVersion ¶
ReadDockerizedVersion reads the version from a Dockerized Kubernetes build.
func URLPrefixForBucket ¶ added in v0.2.6
URLPrefixForBucket returns the URL prefix for the provided bucket string.
func WriteChecksums ¶ added in v0.4.1
WriteChecksums writes the SHA256SUMS/SHA512SUMS files (contains all checksums) as well as a sepearete *.sha[256|512] file containing only the SHA for the corresponding file name.
Types ¶
type ArtifactChecker ¶ added in v0.10.0
type ArtifactChecker struct {
// contains filtered or unexported fields
}
func NewArtifactChecker ¶ added in v0.10.0
func NewArtifactChecker() *ArtifactChecker
func NewArtifactCheckerWithOptions ¶ added in v0.10.0
func NewArtifactCheckerWithOptions(opts *ArtifactCheckerOptions) *ArtifactChecker
func (*ArtifactChecker) CheckBinaryArchitectures ¶ added in v0.10.0
func (ac *ArtifactChecker) CheckBinaryArchitectures() error
CheckBinaryArchitectures ensures all the artifacts produced in each release are of the right architecture.
func (*ArtifactChecker) CheckBinaryTags ¶ added in v0.10.0
func (ac *ArtifactChecker) CheckBinaryTags() error
CheckBinaryTags checks that the binaries produced in the release are correctly tagged with the semver string.
func (*ArtifactChecker) Options ¶ added in v0.10.0
func (ac *ArtifactChecker) Options() *ArtifactCheckerOptions
type ArtifactCheckerOptions ¶ added in v0.10.0
type BranchChecker ¶ added in v0.6.0
type BranchChecker struct {
// contains filtered or unexported fields
}
func NewBranchChecker ¶ added in v0.6.0
func NewBranchChecker() *BranchChecker
NewBranchChecker creates a new release branch checker instance.
func (*BranchChecker) NeedsCreation ¶ added in v0.6.0
func (r *BranchChecker) NeedsCreation( branch, releaseType string, buildVersion semver.Version, ) (createReleaseBranch bool, err error)
NeedsCreation returns if the provided release branch has to be created and checks if it's correct.
func (*BranchChecker) SetImpl ¶ added in v0.6.0
func (r *BranchChecker) SetImpl(impl branchCheckerImpl)
SetImpl can be used to set the internal BranchChecker implementation.
type GitObjectPusher ¶ added in v0.5.0
type GitObjectPusher struct {
// contains filtered or unexported fields
}
GitObjectPusher is an object that pushes things to a gitrepo.
func NewGitPusher ¶ added in v0.5.0
func NewGitPusher(opts *GitObjectPusherOptions) (*GitObjectPusher, error)
NewGitPusher returns a new git object pusher.
func (*GitObjectPusher) PushBranch ¶ added in v0.5.0
func (gp *GitObjectPusher) PushBranch(branchName string) error
PushBranch pushes a branch to the repository
this function is idempotent.
func (*GitObjectPusher) PushBranches ¶ added in v0.6.0
func (gp *GitObjectPusher) PushBranches(branchList []string) error
PushBranches Convenience method to push a list of branches.
func (*GitObjectPusher) PushMain ¶ added in v0.6.0
func (gp *GitObjectPusher) PushMain() error
PushMain pushes the main branch to the origin.
func (*GitObjectPusher) PushTag ¶ added in v0.5.0
func (gp *GitObjectPusher) PushTag(newTag string) (err error)
PushTag pushes a tag to the master repo.
func (*GitObjectPusher) PushTags ¶ added in v0.6.0
func (gp *GitObjectPusher) PushTags(tagList []string) (err error)
PushTags convenience method to push a list of tags to the remote repo.
type GitObjectPusherOptions ¶ added in v0.5.0
type GitObjectPusherOptions struct { // Flago simulate pushes, passes --dry-run to git DryRun bool // Number of times to retry pushes MaxRetries int // Path to the repository RepoPath string }
GitObjectPusherOptions struct to hold the pusher options.
type Images ¶ added in v0.4.1
type Images struct {
// contains filtered or unexported fields
}
Images is a wrapper around container image related functionality.
func (*Images) Exists ¶ added in v0.6.0
Exists verifies that a set of image manifests exists on a specified remote registry. This is a simpler check than Validate, which doesn't presuppose the existence of a local build directory. Used in CI builds to quickly validate if a build is actually required.
func (*Images) GetManifestImages ¶ added in v0.13.0
func (i *Images) GetManifestImages( registry, version, buildPath string, forTarballFn func(path, origTag, newTagWithArch string) error, ) (map[string][]string, error)
GetManifestImages can be used to retrieve the map of built images and architectures.
func (*Images) Publish ¶ added in v0.4.1
PublishImages releases container images to the provided target registry.
type PrerequisitesChecker ¶ added in v0.6.0
type PrerequisitesChecker struct {
// contains filtered or unexported fields
}
PrerequisitesChecker is the main type for checking the prerequisites for a release.
func NewPrerequisitesChecker ¶ added in v0.6.0
func NewPrerequisitesChecker() *PrerequisitesChecker
NewPrerequisitesChecker creates a new PrerequisitesChecker instance.
func (*PrerequisitesChecker) Options ¶ added in v0.10.0
func (p *PrerequisitesChecker) Options() *PrerequisitesCheckerOptions
Options return the options from the prereq checker.
func (*PrerequisitesChecker) Run ¶ added in v0.6.0
func (p *PrerequisitesChecker) Run(workdir string) error
func (*PrerequisitesChecker) SetImpl ¶ added in v0.6.0
func (p *PrerequisitesChecker) SetImpl(impl prerequisitesCheckerImpl)
SetImpl can be used to set the internal PrerequisitesChecker implementation.
type PrerequisitesCheckerOptions ¶ added in v0.10.0
type PrerequisitesCheckerOptions struct {
CheckGitHubToken bool
}
Type prerequisites checker.
type ProvenanceChecker ¶ added in v0.12.0
type ProvenanceChecker struct {
// contains filtered or unexported fields
}
ProvenanceChecker is the main structure to check the provenance.
func NewProvenanceChecker ¶ added in v0.12.0
func NewProvenanceChecker(opts *ProvenanceCheckerOptions) *ProvenanceChecker
func (*ProvenanceChecker) CheckStageProvenance ¶ added in v0.12.0
func (pc *ProvenanceChecker) CheckStageProvenance(buildVersion string) error
CheckStageProvenance validates the provenance for the provided build version.
func (*ProvenanceChecker) GenerateFinalAttestation ¶ added in v0.12.0
func (pc *ProvenanceChecker) GenerateFinalAttestation(buildVersion string, versions *Versions) error
GenerateFinalAttestation combines the stage provenance attestation with a release sbom to create the end-user provenance atteatation.
type ProvenanceCheckerOptions ¶ added in v0.12.0
type ProvenanceReader ¶ added in v0.12.0
type ProvenanceReader struct {
// contains filtered or unexported fields
}
func NewProvenanceReader ¶ added in v0.12.0
func NewProvenanceReader(opts *ProvenanceReaderOptions) *ProvenanceReader
func (*ProvenanceReader) GetBuildSubjects ¶ added in v0.12.0
func (pr *ProvenanceReader) GetBuildSubjects(path, version string) ([]intoto.Subject, error)
GetBuildSubjects returns all artifacts in the output directory as intoto subjects, ready to add to the attestation.
func (*ProvenanceReader) GetStagingSubjects ¶ added in v0.12.0
func (pr *ProvenanceReader) GetStagingSubjects(path string) ([]intoto.Subject, error)
GetStagingSubjects reads artifacts from the GCB workspace and returns them as in-toto subjects, with their paths normalized to their final locations in the staging bucket.
type ProvenanceReaderOptions ¶ added in v0.12.0
type Publisher ¶ added in v0.4.1
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is the structure for publishing anything release related.
func NewPublisher ¶ added in v0.4.1
func NewPublisher() *Publisher
NewPublisher creates a new Publisher instance.
func (*Publisher) PublishReleaseNotesIndex ¶ added in v0.7.0
func (p *Publisher) PublishReleaseNotesIndex( gcsIndexRootPath, gcsReleaseNotesPath, version string, ) error
PublishReleaseNotesIndex updates or creates the release notes index JSON at the target `gcsIndexRootPath`.
func (*Publisher) PublishToGcs ¶ added in v0.4.1
func (p *Publisher) PublishToGcs( publishFile, buildDir, markerPath, version string, privateBucket bool, ) error
PublishToGcs publishes a release to GCS publishFile - the GCS location to look in buildDir - build output directory markerPath - the GCS path to publish a version marker to version - release version.
func (*Publisher) PublishVersion ¶ added in v0.4.1
func (p *Publisher) PublishVersion( buildType, version, buildDir, bucket, gcsRoot string, extraVersionMarkers []string, privateBucket, fast bool, ) error
Publish a new version, (latest or stable) but only if the files actually exist on GCS and the artifacts we're dealing with are newer than the contents in GCS. buildType - One of 'release' or 'ci' version - The version buildDir - build output directory bucket - GCS bucket gcsRoot - The top-level GCS directory builds will be released to
Expected destination format:
gs://<bucket>/<gcsRoot>[/fast]/<version>
func (*Publisher) SetClient ¶ added in v0.4.1
func (p *Publisher) SetClient(client publisherClient)
SetClient can be used to set the internal publisher client.
func (*Publisher) VerifyLatestUpdate ¶ added in v0.4.1
func (p *Publisher) VerifyLatestUpdate( publishFile, markerPath, version string, ) (needsUpdate bool, err error)
VerifyLatestUpdate checks if the new version is greater than the version currently published on GCS. It returns `true` for `needsUpdate` if the remote version does not exist or needs to be updated. publishFile - the version marker to look for markerPath - the GCS path to search for the version marker in version - release version.
type Repo ¶ added in v0.3.0
type Repo struct {
// contains filtered or unexported fields
}
Repo is a wrapper around a kubernetes/release repository.
func (*Repo) CheckState ¶ added in v0.3.0
CheckState verifies that the repository is in the requested state.
func (*Repo) Open ¶ added in v0.3.0
Open assumes the current working directory as repository root and tries to open it.
func (*Repo) SetRepo ¶ added in v0.3.0
func (r *Repo) SetRepo(repo Repository)
SetRepo can be used to set the internal repository implementation.
type Repository ¶ added in v0.3.0
type Repository interface { Describe(opts *git.DescribeOptions) (string, error) CurrentBranch() (branch string, err error) RevParse(rev string) (string, error) Head() (string, error) Remotes() (res []*git.Remote, err error) LsRemote(...string) (string, error) IsDirty() (bool, error) }
Repository is an interface for interacting with a git repository
type Version ¶ added in v0.3.0
type Version struct {
// contains filtered or unexported fields
}
Version is a wrapper around version related functionality.
func (*Version) GetKubeVersion ¶ added in v0.3.0
func (v *Version) GetKubeVersion(versionType VersionType) (string, error)
GetKubeVersion retrieves the version of the provided Kubernetes version type.
func (*Version) GetKubeVersionForBranch ¶ added in v0.3.0
func (v *Version) GetKubeVersionForBranch(versionType VersionType, branch string) (string, error)
GetKubeVersionForBranch returns the remote Kubernetes release version for the provided branch.
func (*Version) SetClient ¶ added in v0.3.0
func (v *Version) SetClient(client VersionClient)
SetClient can be used to manually set the internal Version client.
type VersionClient ¶ added in v0.3.0
VersionClient is a client for getting Kubernetes versions
type VersionType ¶ added in v0.2.6
type VersionType string
VersionType is a simple wrapper around a Kubernetes release version.
const ( // VersionTypeStable references the latest stable Kubernetes // version, for example `v1.17.3`. VersionTypeStable VersionType = "release/stable" // VersionTypeStablePreRelease references the latest stable pre // release Kubernetes version, for example `v1.19.0-alpha.0`. VersionTypeStablePreRelease VersionType = "release/latest" // VersionTypeCILatest references the latest CI Kubernetes version, // for example `v1.19.0-alpha.0.721+f8ff8f44206ff4`. VersionTypeCILatest VersionType = "ci/latest" // VersionTypeCILatestCross references the latest CI cross build Kubernetes // version, for example `v1.19.0-alpha.0.721+f8ff8f44206ff4`. VersionTypeCILatestCross VersionType = "ci/k8s-" + git.DefaultBranch )
func (VersionType) URL ¶ added in v0.3.0
func (t VersionType) URL(version string) string
URL retrieves the full URL of the Kubernetes release version.
type Versions ¶ added in v0.4.0
type Versions struct {
// contains filtered or unexported fields
}
Versions specifies the collection of found release versions.
func GenerateReleaseVersion ¶ added in v0.4.1
func GenerateReleaseVersion( releaseType, version, branch string, branchFromMaster bool, ) (*Versions, error)
GenerateReleaseVersion returns the next build versions for the provided parameters.
func NewReleaseVersions ¶ added in v0.6.0
NewReleaseVersions can be used to create a new `*Versions` instance.
func (*Versions) Alpha ¶ added in v0.4.0
Alpha can be used to get the ReleaseTypeAlpha from the versions.
func (*Versions) Beta ¶ added in v0.4.0
Beta can be used to get the ReleaseTypeBeta from the versions.
func (*Versions) Official ¶ added in v0.4.0
Official can be used to get the ReleaseTypeOfficial from the versions.
func (*Versions) Prime ¶ added in v0.4.0
Prime can be used to get the most prominent release version.