params

package
v0.0.0-...-64567a0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerDepSLS           DockerDepType   = "sls"
	DockerDepBin           DockerDepType   = "bin"
	DockerDepRPM           DockerDepType   = "rpm"
	DockerDepDocker        DockerDepType   = "docker"
	DefaultDockerImageType DockerImageType = "default"
	SLSDockerImageType     DockerImageType = "sls"
)

Variables

This section is empty.

Functions

func GetManifest

func GetManifest(groupID, name, version, productType string, extensions map[string]interface{}) (string, error)

Types

type Almanac

type Almanac struct {
	// Metadata contains the metadata provided to the Almanac publish task.
	Metadata map[string]string
	// Tags contains the tags provided to the Almanac publish task.
	Tags []string
}

type BinDistInfo

type BinDistInfo struct {
	// OmitInitSh specifies whether or not the distribution should omit the auto-generated "init.sh" invocation
	// script. If true, the "init.sh" script will not be generated and included in the output distribution.
	OmitInitSh bool

	// InitShTemplateFile is the relative path to the template that should be used to generate the "init.sh" script.
	// If the value is absent, the default template will be used.
	InitShTemplateFile string
}

func (*BinDistInfo) Type

func (i *BinDistInfo) Type() DistInfoType

type Build

type Build struct {
	// Skip specifies whether the build step should be skipped entirely. Its primary use is for products that handle
	// their own build logic in the "dist" step ("dist-only" products).
	Skip bool

	// Script is the content of a script that is written to file a file and run before this product is built. The
	// contents of this value are written to a file with a header `#!/bin/bash` and executed. The script process
	// inherits the environment variables of the Go process and also has the following environment variables
	// defined:
	//
	//   PROJECT_DIR: the root directory of project
	//   PRODUCT: product name,
	//   VERSION: product version
	//   IS_SNAPSHOT: 1 if the version contains a git hash as part of the string, 0 otherwise
	Script string

	// MainPkg is the location of the main package for the product relative to the root directory. For example,
	// "./distgo/main".
	MainPkg string

	// OutputDir is the directory to which the executable is written.
	OutputDir string

	// BuildArgsScript is the content of a script that is written to a file and run before this product is built
	// to provide supplemental build arguments for the product. The contents of this value are written to a file
	// with a header `#!/bin/bash` and executed. The script process inherits the environment variables of the Go
	// process. Each line of output of the script is provided to the "build" command as a separate argument. For
	// example, the following script would add the arguments "-ldflags" "-X" "main.year=$YEAR" to the build command:
	//
	//   build-args-script: |
	//                      YEAR=$(date +%Y)
	//                      echo "-ldflags"
	//                      echo "-X"
	//                      echo "main.year=$YEAR"
	BuildArgsScript string

	// VersionVar is the path to a variable that is set with the version information for the build. For example,
	// "github.com/palantir/godel/cmd/godel.Version". If specified, it is provided to the "build" command as an
	// ldflag.
	VersionVar string

	// Environment specifies values for the environment variables that should be set for the build. For example,
	// the following sets CGO to false:
	//
	//   environment:
	//     CGO_ENABLED: "0"
	Environment map[string]string

	// OSArchs specifies the GOOS and GOARCH pairs for which the product is built. If blank, defaults to the GOOS
	// and GOARCH of the host system at runtime.
	OSArchs []osarch.OSArch
}

type DefaultDockerImageInfo

type DefaultDockerImageInfo struct{}

func (*DefaultDockerImageInfo) Type

type Dist

type Dist struct {
	// OutputDir is the directory to which the distribution is written.
	OutputDir string

	// InputDir is the path (from the project root) to a directory whose contents will be copied into the output
	// distribution directory at the beginning of the "dist" command. Can be used to include static resources and
	// other files required in a distribution.
	InputDir string

	// InputProducts is a slice of the names of products in the project (other than the current one) whose binaries
	// are required for the "dist" task. The "dist" task will ensure that the outputs of "build" exist for all of
	// the products specified in this slice (and will build the products as part of the task if necessary) and make
	// the outputs available to the "dist" script as environment variables. Note that the "dist" task only
	// guarantees that the products will be built and their locations will be available in the environment variables
	// provided to the script -- it is the responsibility of the user to write logic in the dist script to copy the
	// generated binaries.
	InputProducts []string

	// Script is the content of a script that is written to file a file and run after the initial distribution
	// process but before the artifact generation process. The contents of this value are written to a file with a
	// header `#!/bin/bash` with the contents of the global `dist-script-include` prepended and executed. The script
	// process inherits the environment variables of the Go process and also has the following environment variables
	// defined:
	//
	//   DIST_DIR: the absolute path to the root directory of the distribution created for the current product
	//   PROJECT_DIR: the root directory of project
	//   PRODUCT: product name
	//   VERSION: product version
	//   IS_SNAPSHOT: 1 if the version contains a git hash as part of the string, 0 otherwise
	Script string

	// Info specifies the type of the distribution to be built and configuration for it. If unspecified, defaults to
	// a DistInfo of type SLSDistType.
	Info DistInfo

	// Publish is the configuration for the "publish" task.
	Publish Publish
}

type DistInfo

type DistInfo interface {
	Type() DistInfoType
}

type DistInfoType

type DistInfoType string
const (
	SLSDistType       DistInfoType = "sls"         // distribution that uses the Standard Layout Specification
	BinDistType       DistInfoType = "bin"         // distribution that includes all of the binaries for a product
	RPMDistType       DistInfoType = "rpm"         // RPM distribution
	OSArchBinDistType DistInfoType = "os-arch-bin" // distribution that consists of the binaries for a specific OS/Architecture
	ManualDistType    DistInfoType = "manual"      // distribution that consists of a distribution whose output is created by the distribution script
)

type DockerDep

type DockerDep struct {
	Product    string
	Type       DockerDepType
	TargetFile string
}

type DockerDepType

type DockerDepType string

func ToDockerDepType

func ToDockerDepType(dep string) (DockerDepType, error)

type DockerImage

type DockerImage struct {
	// Repository and Tag are the part of the image coordinates.
	// For example, in alpine:latest, alpine is the repository
	// and the latest is the tag
	Repository string
	Tag        string
	// ContextDir is the directory in which the docker build task is executed.
	ContextDir      string
	BuildArgsScript string
	// DistDeps is a slice of DockerDistDep.
	// DockerDistDep contains a product, dist type and target file.
	// For a particular product's dist type, we create a link from its output
	// inside the ContextDir with the name specified in target file.
	// This will be used to order the dist tasks such that all the dependent
	// products' dist tasks will be executed first, after which the dist tasks for the
	// current product are executed.
	Deps []DockerDep
	Info DockerImageInfo
}

type DockerImageInfo

type DockerImageInfo interface {
	Type() DockerImageType
}

type DockerImageType

type DockerImageType string

type ManualDistInfo

type ManualDistInfo struct {
	// Extension is the extension used by the target output generated by the dist script: for example, "tgz",
	// "zip", etc. Extension is used to locate the output generated by the dist script. The output should be a file
	// of the form "{{product-name}}-{{version}}.{{Extension}}". If Extension is empty, it is assumed that the
	// output has no extension and is of the form "{{product-name}}-{{version}}".
	Extension string
}

func (*ManualDistInfo) Type

func (i *ManualDistInfo) Type() DistInfoType

type OSArchsBinDistInfo

type OSArchsBinDistInfo struct {
	// OSArchs specifies the GOOS and GOARCH pairs for which TGZ distributions are created. If blank, defaults to
	// the GOOS and GOARCH of the host system at runtime.
	OSArchs []osarch.OSArch
}

func (*OSArchsBinDistInfo) Type

func (i *OSArchsBinDistInfo) Type() DistInfoType

type Product

type Product struct {
	// Build specifies the build configuration for the product.
	Build Build
	// Run specifies the run configuration for the product.
	Run Run
	// Dist specifies the dist configurations for the product.
	Dist []Dist
	// DockerImages specifies the docker build configurations for the product.
	DockerImages []DockerImage
	// Publish specifies the publish configuration that is applied to distributions that do not specify their own
	// publish configurations.
	Publish Publish
}

type ProductBuildSpec

type ProductBuildSpec struct {
	Product
	ProjectDir     string
	ProductName    string
	ProductVersion string
	VersionInfo    git.ProjectInfo
}

ProductBuildSpec defines all of the parameters for building a specific product.

func NewProductBuildSpec

func NewProductBuildSpec(projectDir, productName string, gitProductInfo git.ProjectInfo, productCfg Product, projectCfg Project) ProductBuildSpec

NewProductBuildSpec returns a fully initialized ProductBuildSpec that is a combination of the provided parameters. If any of the required fields in the provided configuration is blank, the returned ProjectBuildSpec will have default values populated in the returned object.

type ProductBuildSpecWithDeps

type ProductBuildSpecWithDeps struct {
	Spec ProductBuildSpec
	Deps map[string]ProductBuildSpec
}

func NewProductBuildSpecWithDeps

func NewProductBuildSpecWithDeps(spec ProductBuildSpec, allSpecs map[string]ProductBuildSpec) (ProductBuildSpecWithDeps, error)

func (*ProductBuildSpecWithDeps) AllSpecs

type Project

type Project struct {
	// Products maps product names to configurations.
	Products map[string]Product
	// BuildOutputDir specifies the default build output directory for products executables built by the "build"
	// command. The executables generated by "build" will be written to this directory unless the location is
	// overridden by the product-specific configuration.
	BuildOutputDir string
	// DistOutputDir specifies the default distribution output directory for product distributions created by the
	// "dist" command. The distribution directory and artifact generated by "dist" will be written to this directory
	// unless the location is overridden by the product-specific configuration.
	DistOutputDir string
	// DistScriptInclude is script content that is prepended to any non-empty ProductDistCfg.Script. It can be used
	// to define common functionality used in the distribution script for multiple different products.
	DistScriptInclude string
	// GroupID is the identifier used as the group ID for the POM.
	GroupID string
	// Exclude matches the paths to exclude when determining the projects to build.
	Exclude matcher.Matcher
}

func (Project) FilteredProducts

func (d Project) FilteredProducts() map[string]Product

type Publish

type Publish struct {
	// GroupID is the product-specific configuration equivalent to the global GroupID configuration.
	GroupID string
	// Almanac contains the parameters for Almanac publish operations. Optional.
	Almanac Almanac
}

type RPMDistInfo

type RPMDistInfo struct {
	// Release is the release identifier that forms part of the name/version/release/architecture quadruplet
	// uniquely identifying the RPM package. Default is "1".
	Release string
	// ConfigFiles is a slice of absolute paths within the RPM that correspond to configuration files. RPM
	// identifies these as mutable. Default is no files.
	ConfigFiles []string
	// BeforeInstallScript is the content of shell script to run before this RPM is installed. Optional.
	BeforeInstallScript string
	// AfterInstallScript is the content of shell script to run immediately after this RPM is installed. Optional.
	AfterInstallScript string
	// AfterRemoveScript is the content of shell script to clean up after this RPM is removed. Optional.
	AfterRemoveScript string
}

func (*RPMDistInfo) Type

func (i *RPMDistInfo) Type() DistInfoType

type Run

type Run struct {
	// Args contain the arguments provided to the product when invoked using the "run" task.
	Args []string
}

type SLSDistInfo

type SLSDistInfo struct {
	// InitShTemplateFile is the path to a template file that is used as the basis for the init.sh script of the
	// distribution. The path is relative to the project root directory. The contents of the file is processed using
	// Go templates and is provided with a distgo.ProductBuildSpec struct. If omitted, the default init.sh script
	// is used.
	InitShTemplateFile string

	// ManifestTemplateFile is the path to a template file that is used as the basis for the manifest.yml file of
	// the distribution. The path is relative to the project root directory. The contents of the file is processed
	// using Go templates and is provided with a distgo.ProductBuildSpec struct.
	ManifestTemplateFile string

	// ServiceArgs is the string provided as the service arguments for the default init.sh file generated for the distribution.
	ServiceArgs string

	// ProductType is the SLS product type for the distribution.
	ProductType string

	// ManifestExtensions contain the SLS manifest extensions for the distribution.
	ManifestExtensions map[string]interface{}

	// Reloadable will enable the `init.sh reload` command which sends SIGHUP to the process.
	Reloadable bool

	// YMLValidationExclude specifies a matcher used to specify YML files or paths that should not be validated as
	// part of creating the distribution. By default, the SLS distribution task verifies that all "*.yml" and
	// "*.yaml" files in the distribution are syntactically valid. If a distribution is known to ship with YML files
	// that are not valid YML, this parameter can be used to exclude those files from validation.
	YMLValidationExclude matcher.Matcher
}

func (*SLSDistInfo) Type

func (i *SLSDistInfo) Type() DistInfoType

type SLSDockerImageInfo

type SLSDockerImageInfo struct {
	GroupID      string
	ProuductType string
	Extensions   map[string]interface{}
}

func (*SLSDockerImageInfo) Type

func (info *SLSDockerImageInfo) Type() DockerImageType

Jump to

Keyboard shortcuts

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