Documentation ¶
Index ¶
- Variables
- func AddFile(a Archive, file string) error
- func AzureBlobstoreDelete(config AzureBlobstoreConfig, blobs []azblob.BlobItem) error
- func AzureBlobstoreList(config AzureBlobstoreConfig) ([]azblob.BlobItem, error)
- func AzureBlobstoreUpload(path string, name string, config AzureBlobstoreConfig) error
- func CopyFile(dst, src string, mode os.FileMode)
- func ExpandPackagesNoVendor(patterns []string) []string
- func GOPATH() string
- func GoTool(tool string, args ...string) *exec.Cmd
- func MustRun(cmd *exec.Cmd)
- func MustRunCommand(cmd string, args ...string)
- func PGPKeyID(pgpkey string) (string, error)
- func PGPSignFile(input string, output string, pgpkey string) error
- func Render(templateFile, outputFile string, outputPerm os.FileMode, x interface{})
- func RenderString(templateContent, outputFile string, outputPerm os.FileMode, x interface{})
- func RunGit(args ...string) string
- func WriteArchive(name string, files []string) (err error)
- type Archive
- type AzureBlobstoreConfig
- type Environment
- type TarballArchive
- type ZipArchive
Constants ¶
This section is empty.
Variables ¶
var ( // These flags override values in build env. GitCommitFlag = flag.String("git-commit", "", `Overrides git commit hash embedded into executables`) GitBranchFlag = flag.String("git-branch", "", `Overrides git branch being built`) GitTagFlag = flag.String("git-tag", "", `Overrides git tag being built`) BuildnumFlag = flag.String("buildnum", "", `Overrides CI build number`) PullRequestFlag = flag.Bool("pull-request", false, `Overrides pull request status of the build`) CronJobFlag = flag.Bool("cron-job", false, `Overrides cron job status of the build`) )
var DryRunFlag = flag.Bool("n", false, "dry run, don't execute commands")
Functions ¶
func AzureBlobstoreDelete ¶ added in v1.6.0
func AzureBlobstoreDelete(config AzureBlobstoreConfig, blobs []azblob.BlobItem) error
AzureBlobstoreDelete iterates over a list of files to delete and removes them from the blobstore.
func AzureBlobstoreList ¶ added in v1.6.0
func AzureBlobstoreList(config AzureBlobstoreConfig) ([]azblob.BlobItem, error)
AzureBlobstoreList lists all the files contained within an azure blobstore.
func AzureBlobstoreUpload ¶ added in v1.5.0
func AzureBlobstoreUpload(path string, name string, config AzureBlobstoreConfig) error
AzureBlobstoreUpload uploads a local file to the Azure Blob Storage. Note, this method assumes a max file size of 64MB (Azure limitation). Larger files will need a multi API call approach implemented.
See: https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx#Anchor_3
func ExpandPackagesNoVendor ¶ added in v1.6.0
ExpandPackagesNoVendor expands a cmd/go import path pattern, skipping vendored packages.
func GOPATH ¶
func GOPATH() string
GOPATH returns the value that the GOPATH environment variable should be set to.
func GoTool ¶ added in v1.7.0
GoTool returns the command that runs a go tool. This uses go from GOROOT instead of PATH so that go commands executed by build use the same version of Go as the 'host' that runs build code. e.g.
/usr/lib/go-1.11/bin/go run build/ci.go ...
runs using go 1.11 and invokes go 1.11 tools from the same GOROOT. This is also important because runtime.Version checks on the host should match the tools that are run.
func MustRunCommand ¶
func PGPSignFile ¶ added in v1.5.0
PGPSignFile parses a PGP private key from the specified string and creates a signature file into the output parameter of the input file.
Note, this method assumes a single key will be container in the pgpkey arg, furthermore that it is in armored format.
func RenderString ¶
RenderString renders the given template string into outputFile.
func RunGit ¶
RunGit runs a git subcommand and returns its output. The command must complete successfully.
func WriteArchive ¶
WriteArchive creates an archive containing the given files.
Types ¶
type Archive ¶
type Archive interface { // Directory adds a new directory entry to the archive and sets the // directory for subsequent calls to Header. Directory(name string) error // Header adds a new file to the archive. The file is added to the directory // set by Directory. The content of the file must be written to the returned // writer. Header(os.FileInfo) (io.Writer, error) // Close flushes the archive and closes the underlying file. Close() error }
func NewTarballArchive ¶
func NewTarballArchive(w io.WriteCloser) Archive
func NewZipArchive ¶
func NewZipArchive(w io.WriteCloser) Archive
type AzureBlobstoreConfig ¶ added in v1.5.0
type AzureBlobstoreConfig struct { Account string // Account name to authorize API requests with Token string // Access token for the above account Container string // Blob container to upload files into }
AzureBlobstoreConfig is an authentication and configuration struct containing the data needed by the Azure SDK to interact with a speicifc container in the blobstore.
type Environment ¶ added in v1.4.15
type Environment struct { Name string // name of the environment Repo string // name of GitHub repo Commit, Branch, Tag string // Git info Buildnum string IsPullRequest bool IsCronJob bool }
Environment contains metadata provided by the build environment.
func Env ¶ added in v1.4.15
func Env() Environment
Env returns metadata about the current CI environment, falling back to LocalEnv if not running on CI.
func LocalEnv ¶ added in v1.4.15
func LocalEnv() Environment
LocalEnv returns build environment metadata gathered from git.
func (Environment) String ¶ added in v1.4.15
func (env Environment) String() string
type TarballArchive ¶
type TarballArchive struct {
// contains filtered or unexported fields
}
func (*TarballArchive) Close ¶
func (a *TarballArchive) Close() error
func (*TarballArchive) Directory ¶
func (a *TarballArchive) Directory(name string) error
type ZipArchive ¶
type ZipArchive struct {
// contains filtered or unexported fields
}
func (*ZipArchive) Close ¶
func (a *ZipArchive) Close() error
func (*ZipArchive) Directory ¶
func (a *ZipArchive) Directory(name string) error