Documentation
¶
Overview ¶
Package changelog contains functions to parse and validate the OPT changelog
Index ¶
- Constants
- Variables
- func FetchVersion(ctx context.Context, client stiface.Client, bucketName, objectName string) (semver.Version, error)
- func GoPath() string
- func ParseChangelogFile(filePath string) ([]byte, error)
- func ValidateChangelogVersions(clVersions []CLVersion) error
- func ValidateRelease(clVersions []CLVersion, currentVersion semver.Version) error
- type CLVersion
- type Changelog
Constants ¶
const ProdBucketName = "cloud-ingest-pub"
const ProdObjectName = "agent/current/VERSIONINFO.txt"
Variables ¶
var RepoPath = path.Join("src", "github.com", "GoogleCloudPlatform", "cloud-ingest")
Functions ¶
func FetchVersion ¶
func FetchVersion(ctx context.Context, client stiface.Client, bucketName, objectName string) (semver.Version, error)
FetchVersion fetches the version stored in the specified VERSIONINFO.txt GCS object. Expects the first line of the file to be formatted as follows:
Version: <version number, e.g. v0.5.2>
FetchVersion returns an error if it is unable to fetch the version.
func ParseChangelogFile ¶
ParseChangelogFile parses the changelog in the given file and returns the JSON output as a slice of bytes. If the function is unable to parse the given changelog, an error is returned.
func ValidateChangelogVersions ¶
ValidateChangelogVersions validates the given changelog versions, ensuring that the given versions are increasing and following the semver spec. Returns an error if the changelog is not valid.
func ValidateRelease ¶
ValidateRelease ensures that the latest version in the changelog is not less than or equal to the currently released version. If the release version is not valid, or if an error occurs, an error is returned.
Types ¶
type CLVersion ¶
type CLVersion struct {
Version string `json:"version,omitempty"`
}
func ParseChangelogVersions ¶
ParseChangelogVersions parses versions from the given json representation of a changelog. An error is returned if it is unable to parse the versions.