changelog

package
v0.0.0-...-c28e036 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package changelog contains functions to parse and validate the OPT changelog

Index

Constants

View Source
const ProdBucketName = "cloud-ingest-pub"
View Source
const ProdObjectName = "agent/current/VERSIONINFO.txt"

Variables

View Source
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 GoPath

func GoPath() string

func ParseChangelogFile

func ParseChangelogFile(filePath string) ([]byte, error)

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

func ValidateChangelogVersions(clVersions []CLVersion) error

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

func ValidateRelease(clVersions []CLVersion, currentVersion semver.Version) error

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

func ParseChangelogVersions(jsonBytes []byte) ([]CLVersion, error)

ParseChangelogVersions parses versions from the given json representation of a changelog. An error is returned if it is unable to parse the versions.

type Changelog

type Changelog struct {
	Versions []CLVersion `json:"versions"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL