Documentation ¶
Index ¶
- Constants
- Variables
- func BuildPackage(pkg Package, t PackageTarget) (string, error)
- func BuildPackages(pkg Package, targets ...PackageTarget) error
- func BuildPlugin(cfg PluginConfig) error
- func CIBuildProblem(err error) error
- func CIMessage(messageType string, data interface{})
- func CIProgress(message string)
- func CopyFile(srcFile, dstFile string) error
- func GitBranch() (string, error)
- func GitHash() (string, error)
- func GitPush(target string) error
- func GitPushToRemote(remote, target string) error
- func GitShortHash() (string, error)
- func GitTag(tag, msg string) error
- func MakeExecutable(file string) error
- func MustGetGit() (branch, commit, shortCommit string)
- func OnMasterBranch() bool
- func OnReleaseBranch() bool
- func Release(pkg Package) error
- func RunIntegrationTestsInDocker(name, dockerComposePath string) error
- func RunSpecsWithReporting(t *testing.T, suiteName string)
- func RunUnitTests(tags []string) error
- func RunningOnTeamCity() bool
- func SetTeamCityBuildNumber(version, buildNumber string)
- func SetTeamCityParameter(name, value string)
- func TagAndPushDockerImages(sourceImage, imageName, imageTagPrefix, buildNumber, majorVersion, ... string) ([]string, error)
- func ToS3ReleasePath(pkgName, serviceID string, version semver.Version) string
- func Unzip(src string, dest string) ([]string, error)
- func UploadToS3(bucket, src, target string) (bool, error)
- func ZipFiles(filename string, files []string) error
- type Build
- type Package
- type PackageTarget
- type PluginConfig
Constants ¶
const (
// DefaultOutDir defines the default location for build packages
DefaultOutDir = "./bin"
)
Variables ¶
var ( TargetLinux386 = PackageTarget{"linux", "386"} TargetLinuxAmd64 = PackageTarget{"linux", "amd64"} TargetWindows386 = PackageTarget{"windows", "386"} TargetWindowsAmd64 = PackageTarget{"windows", "amd64"} TargetDarwinAmd64 = PackageTarget{"darwin", "amd64"} TargetLocal = PackageTarget{"", ""} DefaultPackageTargets = []PackageTarget{ TargetLinux386, TargetLinuxAmd64, TargetWindows386, TargetWindowsAmd64, } ReleaserTemplate *template.Template )
Functions ¶
func BuildPackage ¶
func BuildPackage(pkg Package, t PackageTarget) (string, error)
BuildPackage builds a package and returns the path to the output.
func BuildPackages ¶
func BuildPackages(pkg Package, targets ...PackageTarget) error
BuildPackages performs a go build on the supplied package.
func BuildPlugin ¶
func BuildPlugin(cfg PluginConfig) error
func CIBuildProblem ¶
CIBuildProblem reports an error in a way TeamCity can understand. If err is nil, this method does nothing. This method returns the error to support chaining.
func CIMessage ¶
func CIMessage(messageType string, data interface{})
CIMessage writes a message out in a format TeamCity can understand. The data parameter can be a string or a map[string]string.
func CIProgress ¶
func CIProgress(message string)
func GitPushToRemote ¶
func GitShortHash ¶
func MakeExecutable ¶
func MustGetGit ¶
func MustGetGit() (branch, commit, shortCommit string)
func OnMasterBranch ¶
func OnMasterBranch() bool
func OnReleaseBranch ¶
func OnReleaseBranch() bool
func RunIntegrationTestsInDocker ¶
RunIntegrationTestsInDocker executes integration tests using docker-compose.
func RunSpecsWithReporting ¶
func RunningOnTeamCity ¶
func RunningOnTeamCity() bool
func SetTeamCityBuildNumber ¶
func SetTeamCityBuildNumber(version, buildNumber string)
func SetTeamCityParameter ¶
func SetTeamCityParameter(name, value string)
func TagAndPushDockerImages ¶
func TagAndPushDockerImages(sourceImage, imageName, imageTagPrefix, buildNumber, majorVersion, minorVersion string) ([]string, error)
TagAndPushDockerImages uses the environment parameters IMAGE_NAME, BUILD_NUMBER, MAJOR_VERSION, and MINOR_VERSION to create images with the following tags: IMAGE_NAME:MAJOR_VERSION.MINOR_VERSION-BUILD_NUMBER IMAGE_NAME:MAJOR_VERSION.MINOR_VERSION IMAGE_NAME:MAJOR_VERSION IMAGE_NAME:latest If IMAGE_TAG_PREFIX is set, it will be inserted at the beginning of the tag. This task expects there to be an existing image named IMAGE_NAME:git-commit-hash This task returns a slice containing the deployed images, in order from most specific to least specific.
func ToS3ReleasePath ¶
ToS3ReleasePath returns a path for upload to S3 in the format 'releases/{serviceID}/{version.Major}.{version.Minor}.{version.Patch}/{pkgName}'.
func Unzip ¶
Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).
func UploadToS3 ¶
UploadToS3 uploads a file to an AWS S3 bucket
Types ¶
type Build ¶
type Build struct { Package Package PackageTarget PackageTarget }
Build combines a Package and a PackageTarget
type Package ¶
type Package struct { Name string Version semver.Version // Alternative to setting Version, to avoid vendoring annoyances VersionString string PackagePath string OutDir string // If present, will be compiled into a template and passed a Build to construct the name of the compiled binary. OutTemplate string DockerRepo string Shrink bool Main string // The path to main.go or build dir BuildArgs []string CGOEnabled bool }
Package provides information for building a binary image
func NewPackage ¶
NewPackage creates a new package with default values configured. The default values set by this operation are:
PackagePath: "github.com/naveegoinc/{name}" OutDir: "./bin" DockerRepo: "docker.naveego.com:4333" Main: "main.go"
Given the variables name="helloworld" and version="v1.0.0", the return package would have the following values:
Name: "helloworld" Version: "v1.0.0" PackagePath: "github.com/naveegoinc/helloworld" OutDir: "./bin" DockerRepo: "docker.naveego.com:4333" Main: "main.go"
type PackageTarget ¶
PackageTarget defines
func (PackageTarget) String ¶
func (t PackageTarget) String() string
type PluginConfig ¶
type PluginConfig struct { Package Package Targets []PackageTarget Files []string }