common

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2018 License: MIT Imports: 13 Imported by: 11

README

Common

GoDoc

This package contains utility functions and things shared by both the client and the daemon, such as request structs.

Documentation

Index

Constants

View Source
const (
	// MsgDaemonOK is the OK response upon successfully reaching daemon
	MsgDaemonOK = "I'm a little Webhook, short and stout!"

	// Container is a constant used in HTTP GET query strings
	Container = "container"

	// Stream is a constant used in HTTP GET query strings
	Stream = "stream"
)

Variables

This section is empty.

Functions

func BuildTar added in v0.3.0

func BuildTar(dir string, outputs ...io.Writer) error

BuildTar takes a source and variable writers and walks 'source' writing each file found to the tar writer; the purpose for accepting multiple writers is to allow for multiple outputs (for example a file, or md5 hash) Sourced from https://gist.github.com/sdomino/e6bc0c98f87843bc26bb#file-targz-go

func CheckForDockerCompose

func CheckForDockerCompose(cwd string) bool

CheckForDockerCompose returns error if current directory is a not a docker-compose project

func CheckForDockerfile added in v0.3.0

func CheckForDockerfile(cwd string) bool

CheckForDockerfile returns error if current directory is a not a Dockerfile project

func CheckForGit

func CheckForGit(cwd string) error

CheckForGit returns an error if we're not in a git repository.

func ExtractRepository added in v0.4.0

func ExtractRepository(URL string) (string, error)

ExtractRepository gets the project name from its URL in the form [username]/[project]

func Flush

func Flush(w io.Writer, rc io.ReadCloser, buffer []byte) error

Flush emptires reader into buffer and flushes it to writer

func FlushRoutine

func FlushRoutine(w io.Writer, rc io.ReadCloser, stop chan struct{})

FlushRoutine continuously writes everything in given ReadCloser to a ResponseWriter. Use this as a goroutine.

func GenerateRandomString added in v0.4.0

func GenerateRandomString() (string, error)

GenerateRandomString creates a rand.Reader-generated string for use with simple secrets and identifiers

func GetBranchFromRef added in v0.1.1

func GetBranchFromRef(ref string) string

GetBranchFromRef gets the branch name from a git ref of form refs/...

func GetLocalRepo

func GetLocalRepo() (*git.Repository, error)

GetLocalRepo gets the repo from disk.

func GetSSHRemoteURL

func GetSSHRemoteURL(url string) string

GetSSHRemoteURL gets the URL of the given remote in the form "git@github.com:[USER]/[REPOSITORY].git"

func RemoveContents

func RemoveContents(directory string) error

RemoveContents removes all files within given directory, returns nil if successful

Types

type DaemonRequest

type DaemonRequest struct {
	Stream     bool        `json:"stream"`
	Container  string      `json:"container,omitempty"`
	Project    string      `json:"project"`
	BuildType  string      `json:"build_type"`
	GitOptions *GitOptions `json:"git_options"`
	Secret     string      `json:"secret"`
}

DaemonRequest is the configurable body of a request to the daemon.

type DeploymentStatus added in v0.3.0

type DeploymentStatus struct {
	InertiaVersion       string   `json:"version"`
	Branch               string   `json:"branch"`
	CommitHash           string   `json:"commit_hash"`
	CommitMessage        string   `json:"commit_message"`
	BuildType            string   `json:"build_type"`
	Containers           []string `json:"containers"`
	BuildContainerActive bool     `json:"build_active"`
}

DeploymentStatus lists details about the deployed project

type GitOptions

type GitOptions struct {
	RemoteURL string `json:"remote"`
	Branch    string `json:"branch"`
}

GitOptions represents GitHub-related deployment options

type UserRequest added in v0.3.0

type UserRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
	Admin    bool   `json:"admin"`
}

UserRequest is used for logging in or modifying users

Jump to

Keyboard shortcuts

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