Documentation ¶
Index ¶
- Constants
- func AllChecksumsForBytes(input []byte) (md5sum, sha1sum, sha256sum string, err error)
- func AllChecksumsForFile(filename string) (md5sum, sha1sum, sha256sum string, err error)
- func BuildExtras(meta Metadata, workdir string) (err error)
- func BytesMd5(input []byte) (checksum string, err error)
- func BytesSha1(input []byte) (checksum string, err error)
- func BytesSha256(input []byte) (checksum string, err error)
- func CollectFileAndSignature(cwd string, filename string) (err error)
- func DebugPrint(filename, tag string)
- func DefaultSession() (awssession *session.Session, err error)
- func DirsForURL(uri string) (dirs []string, err error)
- func FileMd5(filename string) (checksum string, err error)
- func FileSha1(filename string) (checksum string, err error)
- func FileSha256(filename string) (checksum string, err error)
- func GetFunc(shellCommand string) (result string, err error)
- func GitSSHUrlFromPackage(packageName string) (gitpath string)
- func GoxInstall(gopath string) (err error)
- func ParseTemplateForMetadata(templateText string, metadata Metadata) (outputText string, err error)
- func SignGPG(binary string, signingEntity string, meta Metadata) (err error)
- func TestMetadata_GetLanguage(t *testing.T)
- func Upload(client *http.Client, url string, data io.Reader, md5sum string, sha1sum string, ...) (err error)
- func UploadChecksum(parsedDestination, checksum, sumtype string, client *http.Client, ...) (err error)
- func UploadChecksums(client *http.Client, destination, filename string, meta Metadata, ...) (err error)
- func UploadFile(client *http.Client, destination string, filename string, meta Metadata, ...) (err error)
- func UploadSignature(client *http.Client, destination string, filename string, meta Metadata, ...) (err error)
- func VerifyBinary(binary string, meta Metadata) (ok bool, err error)
- func VerifyGPG(binary string, meta Metadata) (ok bool, err error)
- type BuildInfo
- type BuildTarget
- type ExtraArtifact
- type Golang
- func (g Golang) Build(gopath string, meta Metadata, skipTargets string, local bool) (err error)
- func (Golang) Checkout(gopath string, meta Metadata, branch string) (err error)
- func (Golang) CreateWorkDir(workDir string) (gopath string, err error)
- func (Golang) Prep(gopath string, meta Metadata, local bool) (err error)
- func (Golang) Test(gopath string, gomodule string, timeout string, local bool) (err error)
- type Gomason
- func (g *Gomason) GetCredentials(meta Metadata) (username, password string, err error)
- func (g *Gomason) HandleArtifacts(meta Metadata, gopath string, cwd string, sign bool, publish bool, ...) (err error)
- func (g *Gomason) HandleExtras(meta Metadata, gopath string, cwd string, sign bool, publish bool, ...) (err error)
- func (g *Gomason) PublishFile(meta Metadata, filePath string) (err error)
- func (g *Gomason) SignBinary(meta Metadata, binary string) (err error)
- type Language
- type Metadata
- type NoLanguage
- func (NoLanguage) Build(workdor string, meta Metadata, skipTargets string, localBuild bool) error
- func (NoLanguage) Checkout(workdir string, meta Metadata, branch string) error
- func (NoLanguage) CreateWorkDir(string) (workdir string, err error)
- func (NoLanguage) Prep(workdir string, meta Metadata, local bool) error
- func (NoLanguage) Test(workdir string, module string, timeout string, localTest bool) error
- type PublishInfo
- type PublishTarget
- type S3Meta
- type SignInfo
- type TestRepo
- type UserConfig
- type UserInfo
- type UserSignInfo
Constants ¶
const AWS_ID_ENV_VAR = "AWS_ACCESS_KEY_ID"
AWS_ID_ENV_VAR Default env var for AWS access key
const AWS_REGION_ENV_VAR = "AWS_DEFAULT_REGION"
AWS_REGION_ENV_VAR Default env var for AWS region.
const AWS_SECRET_ENV_VAR = "AWS_SECRET_ACCESS_KEY"
AWS_SECRET_ENV_VAR Default env var for AWS secret key
const (
// LanguageGolang a canonical string representation of the golang language
LanguageGolang = "golang"
)
const METADATA_FILENAME = "metadata.json"
METADATA_FILENAME The default gomason metadata file name
const VERSION = "2.13.1"
VERSION is the current gomason version
Variables ¶
This section is empty.
Functions ¶
func AllChecksumsForBytes ¶
AllChecksumsForBytes is a convenience method for returning the md5, sha1, sha256 checksums for a byte array.
func AllChecksumsForFile ¶
AllChecksumsForFile is a convenience method that generates and returns md5, sha1, and sha256 checksums for a given file
func BuildExtras ¶
BuildExtras builds the extra artifacts specified in the metadata file
func BytesSha256 ¶
BytesSha256 generates the sha256sum for a byte array
func CollectFileAndSignature ¶
CollectFileAndSignature grabs a file and the signature if it exists and copies it from the temp workspace into the CWD where gomason was called. Does nothing at all if the file is currently in cwd.
func DebugPrint ¶
func DebugPrint(filename, tag string)
func DefaultSession ¶
DefaultSession creates a default AWS session from local config path. Hooks directly into credentials if present, or Credentials Provider if configured.
func DirsForURL ¶
DirsForURL given a URL, return a list of path elements suitable for creating directories/ folders
func FileSha256 ¶
FileSha256 generates the Sha256 sum for a file.
func GetFunc ¶
GetFunc runs a shell command that is a getter function. This could certainly be dangerous, so be careful how you use it.
func GitSSHUrlFromPackage ¶
GitSSHUrlFromPackage Turns a go package name into a ssh git url.
func GoxInstall ¶
GoxInstall Installs github.com/mitchellh/gox, the go cross compiler.
func ParseTemplateForMetadata ¶
func ParseTemplateForMetadata(templateText string, metadata Metadata) (outputText string, err error)
ParseTemplateForMetadata parses a raw string as if it was a text/template template and uses the Metadata from metadata file as it's data source. e.g. injecting Version into upload targets (PUT url) when publishing.
func Upload ¶
func Upload(client *http.Client, url string, data io.Reader, md5sum string, sha1sum string, sha256sum string, username string, password string) (err error)
Upload actually does the upload. It uploads pure data.
func UploadChecksum ¶
func UploadChecksum(parsedDestination, checksum, sumtype string, client *http.Client, username, password string) (err error)
UploadChecksum uploads the checksum of the given type for the given file
func UploadChecksums ¶
func UploadChecksums(client *http.Client, destination, filename string, meta Metadata, username string, password string) (err error)
UploadChecksums uploads the checksums for a file. This is useful if the repository is not configured to do so automatically.
func UploadFile ¶
func UploadFile(client *http.Client, destination string, filename string, meta Metadata, username string, password string) (err error)
UploadFile uploads a file off the filesystem
func UploadSignature ¶
func UploadSignature(client *http.Client, destination string, filename string, meta Metadata, username string, password string) (err error)
UploadSignature uploads the detached signature for a file
func VerifyBinary ¶
VerifyBinary will verify the signature of a signed binary.
Types ¶
type BuildInfo ¶
type BuildInfo struct { PrepCommands []string `json:"prepcommands,omitempty"` Targets []BuildTarget `json:"targets,omitempty"` Extras []ExtraArtifact `json:"extras,omitempty"` }
BuildInfo stores information used for building the code.
type BuildTarget ¶
type BuildTarget struct { Name string `json:"name"` Cgo bool `json:"cgo,omitempty"` Flags map[string]string `json:"flags,omitempty"` Ldflags string `json:"ldflags,omitempty"` Legacy bool `json:"legacy,omitempty"` }
BuildTarget contains information on each build target
type ExtraArtifact ¶
type ExtraArtifact struct { Template string `json:"template"` FileName string `json:"filename"` Executable bool `json:"executable"` }
ExtraArtifact is an extra file built from a template at build time
type Golang ¶
type Golang struct{}
Golang struct. For golang, workdir is GOPATH
func (Golang) Checkout ¶
Checkout Actually checks out the code you're trying to test into your temporary GOPATH
func (Golang) CreateWorkDir ¶
CreateWorkDir Creates an empty but workable GOPATH in the directory specified. Returns the full GOPATH
type Gomason ¶
type Gomason struct {
Config UserConfig
}
Gomason Object that does all the building
func NewGomason ¶
NewGomason creates a new Gomason object for the current user
func (*Gomason) GetCredentials ¶
GetCredentials gets credentials, first from the metadata file, and then from the user config in ~/.gomason if it exists. If no credentials are found in any of the places, it returns the empty stings for usernames and passwords. This is not recommended, but it might be useful in some cases. Who knows? We makes the tools, we don't tell you how to use them. (we do, however make suggestions.) :D
func (*Gomason) HandleArtifacts ¶
func (g *Gomason) HandleArtifacts(meta Metadata, gopath string, cwd string, sign bool, publish bool, collect bool, skipTargets string, local bool) (err error)
HandleArtifacts loops over the expected files built by Build() and optionally signs them and publishes them along with their signatures (if signing).
If not publishing, the binaries (and their optional signatures) are collected and dumped into the directory where gomason was called. (Typically the root of a go project).
func (*Gomason) HandleExtras ¶
func (g *Gomason) HandleExtras(meta Metadata, gopath string, cwd string, sign bool, publish bool, collect bool, local bool) (err error)
HandleExtras loops over the expected files built by Build() and optionally signs them and publishes them along with their signatures (if signing).
If not publishing, the binaries (and their optional signatures) are collected and dumped into the directory where gomason was called. (Typically the root of a go project).
func (*Gomason) PublishFile ¶
PublishFile publishes the binary to wherever you have it configured to go
type Language ¶
type Language interface { CreateWorkDir(string) (string, error) Checkout(workdir string, meta Metadata, branch string) error Prep(workdir string, meta Metadata, local bool) error Test(workdir string, module string, timeout string, local bool) error Build(workdir string, meta Metadata, skipTargets string, local bool) error }
Language is a generic interface for doing what gomason does - abstracting build, test, signing, and publishing of binaries
type Metadata ¶
type Metadata struct { Name string `json:"name"` Version string `json:"version"` Package string `json:"package"` Description string `json:"description"` Repository string `json:"repository"` ToolRepository string `json:"tool-repository"` InsecureGet bool `json:"insecure_get"` Language string `json:"language,omitempty"` BuildInfo BuildInfo `json:"building,omitempty"` SignInfo SignInfo `json:"signing,omitempty"` PublishInfo PublishInfo `json:"publishing,omitempty"` Options map[string]interface{} `json:"options,omitempty"` }
Metadata type to represent the metadata file
func ReadMetadata ¶
ReadMetadata Reads a metadata file and returns the Metadata object thus described
func (Metadata) GetLanguage ¶
GetLanguage returns the language set in metadata, or the default 'golang'.
type NoLanguage ¶
type NoLanguage struct{}
NoLanguage essentially an abstract class for the Language interface
func (NoLanguage) Checkout ¶
func (NoLanguage) Checkout(workdir string, meta Metadata, branch string) error
Checkout Stub for the Checkout action
func (NoLanguage) CreateWorkDir ¶
func (NoLanguage) CreateWorkDir(string) (workdir string, err error)
CreateWorkDir Stub for the CreateWorkDir action
type PublishInfo ¶
type PublishInfo struct { Targets []PublishTarget `json:"targets"` TargetsMap map[string]PublishTarget `json:"-"` Username string `json:"username"` Password string `json:"password"` UsernameFunc string `json:"usernamefunc"` PasswordFunc string `json:"passwordfunc"` SkipSigning bool `json:"skip-signing"` }
PublishInfo holds information for publishing
type PublishTarget ¶
type PublishTarget struct { Source string `json:"src"` Destination string `json:"dst"` Signature bool `json:"sig"` Checksums bool `json:"checksums"` }
PublishTarget a struct representing an individual file to upload
type S3Meta ¶
S3Meta a struct for holding metadata for S3 Objects. There's probably already a struct that holds this, but this is all I need.
type TestRepo ¶
type TestRepo struct{}
TestRepo a fake repository server. Basically an in-memory http server that can be used as a test fixture for testing the internal API. Cool huh?
func (*TestRepo) HandlerTool ¶
func (tr *TestRepo) HandlerTool(w http.ResponseWriter, r *http.Request)
HandlerTool handles requests publishing a tool in the test repo
type UserConfig ¶
type UserConfig struct { User UserInfo Signing UserSignInfo }
UserConfig a struct representing the information stored in ~/.gomason
func GetUserConfig ¶
func GetUserConfig(homedir string) (config UserConfig, err error)
GetUserConfig reads ~/.gomason if present, and returns a struct with its data.
type UserInfo ¶
type UserInfo struct { Email string Username string Password string UsernameFunc string PasswordFunc string }
UserInfo information from the user section in ~/.gomason
type UserSignInfo ¶
type UserSignInfo struct {
Program string
}
UserSignInfo information from the signing section in ~/.gomason