Documentation ¶
Index ¶
- Constants
- Variables
- func BuiltWithBazel(workDir string) (bool, error)
- func CopyBinaries(rootPath, targetPath string) error
- func CreatePubBotBranchIssue(branchName string) error
- func DockerHubLogin() error
- func GetToolOrg() string
- func GetToolRef() string
- func GetToolRepo() string
- func GetWorkspaceVersion() (string, error)
- func IsDirtyBuild(build string) 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) error
- func ReadBazelVersion(workDir string) (string, error)
- func ReadDockerizedVersion(workDir string) (string, error)
- func URLPrefixForBucket(bucket string) string
- func WriteChecksums(rootPath string) error
- type Archiver
- type ArchiverOptions
- 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 ImagePromoterImages
- type Images
- type PrerequisitesChecker
- type PrerequisitesCheckerOptions
- 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 // TODO(vdf): Need to reference K8s Infra project here DefaultKubernetesStagingProject = "kubernetes-release-test" DefaultRelengStagingProject = "k8s-staging-releng" DefaultDiskSize = "500" BucketPrefix = "kubernetes-release-" BucketPrefixK8sInfra = "k8s-release-" 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 ProductionBucket = "kubernetes-release" // ProductionBucketURL is the url for the ProductionBucket ProductionBucketURL = "https://dl.k8s.io" // Production registry root URL GCRIOPathProd = "k8s.gcr.io" // Staging registry root URL GCRIOPathStaging = "gcr.io/k8s-staging-kubernetes" // Mock staging registry root URL GCRIOPathMock = GCRIOPathStaging + "/mock" // BuildDir is the default build output directory. BuildDir = "_output" // The default bazel build directory. BazelBuildDir = "bazel-bin/build" // Archive path is the root path in the bucket where releases are archived ArchivePath = "archive" // Publishing bot issue repository PubBotRepoOrg = "k8s-release-robot" PubBotRepoName = "sig-release" DockerHubEnvKey = "DOCKERHUB_TOKEN" // Env var containing the docker key DockerHubUserName = "k8sreleng" // Docker Hub username )
const ( ReleaseTypeOfficial string = "official" ReleaseTypeRC string = "rc" ReleaseTypeBeta string = "beta" ReleaseTypeAlpha string = "alpha" )
Variables ¶
var ( ManifestImages = []string{ "conformance", "kube-apiserver", "kube-controller-manager", "kube-proxy", "kube-scheduler", } SupportedArchitectures = []string{ "amd64", "arm", "arm64", "ppc64le", "s390x", } FastArchitectures = []string{ "amd64", } )
var DefaultPrerequisitesCheckerOptions = &PrerequisitesCheckerOptions{ CheckGitHubToken: true, }
Functions ¶
func BuiltWithBazel ¶
BuiltWithBazel determines whether the most recent Kubernetes release was built with Bazel.
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 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 IsDirtyBuild ¶
IsDirtyBuild checks if build version is dirty.
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 ReadBazelVersion ¶
ReadBazelVersion reads the version from a Bazel build.
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 Archiver ¶ added in v0.6.0
type Archiver struct {
// contains filtered or unexported fields
}
Archiver stores the release build directory in a bucket along with it's logs
func NewArchiver ¶ added in v0.6.0
func NewArchiver(opts *ArchiverOptions) *Archiver
NewArchiver create a new archiver with the default implementation
func (*Archiver) ArchiveRelease ¶ added in v0.6.0
ArchiveRelease stores the release directory and logs in a GCP bucket for archival purposes. Log files are sanitized and made private
type ArchiverOptions ¶ added in v0.6.0
type ArchiverOptions struct { ReleaseBuildDir string // Build directory that will be archived LogFile string // Log file to process and include in the archive PrimeVersion string // Final version tag BuildVersion string // Build version from where this release has cut Bucket string // Bucket we will use to archive and read staged data }
ArchiverOptions set the options used when archiving a release
func (*ArchiverOptions) ArchiveBucketPath ¶ added in v0.6.0
func (o *ArchiverOptions) ArchiveBucketPath() string
ArchiveBucketPath returns the bucket path we the release will be stored
func (*ArchiverOptions) Validate ¶ added in v0.6.0
func (o *ArchiverOptions) Validate() error
Validate checks if the set values are correct and complete to start running the archival process
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 ImagePromoterImages ¶ added in v0.4.1
type ImagePromoterImages []struct { Name string `json:"name"` DMap map[string][]string `json:"dmap"` // eg "sha256:ef9493aff21f7e368fb3968b46ff2542b0f6863a5de2b9bc58d8d151d8b0232c": ["v1.17.12-rc.0"] }
ImagePromoterImages abtracts the manifest used by the image promoter
func NewPromoterImageListFromFile ¶ added in v0.4.1
func NewPromoterImageListFromFile(manifestPath string) (imagesList *ImagePromoterImages, err error)
NewPromoterImageListFromFile parses an image promoter manifest file
func (*ImagePromoterImages) Parse ¶ added in v0.4.1
func (imagesList *ImagePromoterImages) Parse(yamlCode []byte) error
Parse reads yaml code into an ImagePromoterManifest object
func (*ImagePromoterImages) ToYAML ¶ added in v0.4.1
func (imagesList *ImagePromoterImages) ToYAML() ([]byte, error)
ToYAML serializes an image list into an YAML file. We serialize the data by hand to emulate the way it's done by the image promoter
func (*ImagePromoterImages) Write ¶ added in v0.4.1
func (imagesList *ImagePromoterImages) Write(filePath string) error
Write writes the promoter image list into an YAML file.
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) 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 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