Documentation ¶
Overview ¶
Code generated for package ofcourse by go-bindata DO NOT EDIT. (@generated) sources: templates/Dockerfile templates/Makefile templates/README.md templates/cmd/check/main.go templates/cmd/in/main.go templates/cmd/out/main.go templates/go.mod templates/pipeline.yml templates/resource/resource.go templates/resource/resource_test.go
Package ofcourse reduces boilerplate for implementing Concourse resources.
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func Check(resource Resource)
- func EnvVarMap() map[string]string
- func In(resource Resource)
- func MustAsset(name string) []byte
- func Out(resource Resource)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type CheckInput
- type Environment
- type InInput
- type Logger
- type Metadata
- type NameVal
- type OutInput
- type Params
- type Resource
- type Source
- type Version
Constants ¶
const ( // SilentLevel for logging. SilentLevel = "silent" // ErrorLevel for logging. ErrorLevel = "error" // WarnLevel for logging. WarnLevel = "warn" // InfoLevel for logging. InfoLevel = "info" // DebugLevel for logging. DebugLevel = "debug" )
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func Check ¶
func Check(resource Resource)
Check takes an implementation of Resource as its input. The Main function for the /opt/resource/check command that is run by Concourse should create an instance of the resource and pass it to this function.
func EnvVarMap ¶
EnvVarMap returns the current environment as a map[string]string. This may be used for generating test environments based on the current environment.
func In ¶
func In(resource Resource)
In takes an implementation of Resource as its input. The Main function for the /opt/resource/in command that is run by Concourse should create an instance of the resource and pass it to this function.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func Out ¶
func Out(resource Resource)
Out takes an implementation of Resource as its input. The Main function for the /opt/resource/out command that is run by Concourse should create an instance of the resource and pass it to this function.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type CheckInput ¶
CheckInput represents the stdin to an /opt/resource/check command.
type Environment ¶
Environment represents the environment of a `check`, `in`, or `out` process. It is passed to Resource functions to enable easier testing than if calling `os.Getenv` within the function.
func NewEnvironment ¶
func NewEnvironment(variables ...map[string]string) Environment
NewEnvironment returns the current environment, or one from the optional variables.
type InInput ¶
type InInput struct { Source Source `json:"source"` Params Params `json:"params"` Version Version `json:"version"` }
InInput represents the stdin to an /opt/resource/in command.
type Logger ¶
type Logger struct {
Level int
}
Logger is passed to resource functions so that they can log to the Concourse UI without printing to stdout, as doing so would corrupt the JSON output expected by Concourse. Resources using this library may set their log level in the source configuration of the pipeline using the parameter `log_level`, which may have a case insensitive value of "error", "warn", "info", or "debug". Respective to those log levels, the output colors are red, yellow, green, and blue.
func NewLogger ¶
NewLogger returns a logger instance with the given log level, defaulting to "info" if the given level is not recognized.
type Metadata ¶
type Metadata []NameVal
Metadata represents Concourse metadata, which is a set of key/value pairs that are used for printing extra information to the Concourse UI on `get` or `put`.
type Params ¶
type Params map[string]interface{}
Params is the pipeline `get` or `put` parameters for the resource.
type Resource ¶
type Resource interface { Check(src Source, ver Version, env Environment, log *Logger) ([]Version, error) In(outDir string, src Source, par Params, ver Version, env Environment, log *Logger) (Version, Metadata, error) Out(inDir string, src Source, par Params, env Environment, log *Logger) (Version, Metadata, error) }
Resource is a type that contains Check, In, and Out methods. The user of this library must implement this interface.