v0

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpgradeConfig

func UpgradeConfig(
	cfgBytes []byte,
	projectVersionerFactory distgo.ProjectVersionerFactory,
	disterFactory distgo.DisterFactory,
	dockerBuilderFactory distgo.DockerBuilderFactory,
	publisherFactory distgo.PublisherFactory) ([]byte, error)

Types

type BuildConfig

type BuildConfig struct {
	// NameTemplate is the template used for the executable output. The following template parameters can be used in the
	// template:
	//   * {{Product}}: the name of the product
	//   * {{Version}}: the version of the project
	//
	// If a value is not specified, "{{Product}}" is used as the default value.
	NameTemplate *string `yaml:"name-template,omitempty"`

	// OutputDir specifies the default build output directory for products executables built by the "build" task. The
	// executables generated by "build" are written to "{{OutputDir}}/{{ID}}/{{Version}}/{{OSArch}}/{{NameTemplate}}".
	//
	// If not specified, "out/build" is used as the default value.
	OutputDir *string `yaml:"output-dir,omitempty"`

	// MainPkg is the location of the main package for the product relative to the project root directory. For example,
	// "./distgo/main".
	MainPkg *string `yaml:"main-pkg,omitempty"`

	// 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: |
	//                      #!/usr/bin/env bash
	//                      YEAR=$(date +%Y)
	//                      echo "-ldflags"
	//                      echo "-X"
	//                      echo "main.year=$YEAR"
	BuildArgsScript *string `yaml:"build-args-script,omitempty"`

	// 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 `yaml:"version-var,omitempty"`

	// 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 `yaml:"environment,omitempty"`

	// 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 `yaml:"os-archs,omitempty"`
}

type DistConfig

type DistConfig struct {
	// OutputDir specifies the default distribution output directory for product distributions created by the "dist"
	// task. The distribution output directory is written to
	// "{{OutputDir}}/{{ID}}/{{Version}}/{{NameTemplate}}", and the distribution artifacts are written to
	// "{{OutputDir}}/{{ID}}/{{Version}}".
	//
	// If a value is not specified, "out/dist" is used as the default value.
	OutputDir *string `yaml:"output-dir,omitempty"`

	// Disters is the configuration for the disters for this product. The YAML representation can be a single DisterConfig
	// or a map[DistID]DisterConfig.
	Disters *DistersConfig `yaml:"disters,omitempty"`
}

type DisterConfig

type DisterConfig struct {
	// Type is the type of the dister. This field must be non-nil and non-empty and resolve to a valid Dister.
	Type *string `yaml:"type,omitempty"`

	// Config is the YAML configuration content for the dister.
	Config *yaml.MapSlice `yaml:"config,omitempty"`

	// NameTemplate is the template used for the executable output. The following template parameters can be used in the
	// template:
	//   * {{Product}}: the name of the product.
	//   * {{Version}}: the version of the project.
	//
	// If a value is not specified, "{{Product}}-{{Version}}" is used as the default value.
	NameTemplate *string `yaml:"name-template,omitempty"`

	// 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 content of this value is written to a file and executed
	// with the project directory as the working directory. The script process inherits the environment variables of the
	// Go process and also has dist-related environment variables. Refer to the documentation for the
	// distgo.DistScriptEnvVariables function for the extra environment variables.
	Script *string `yaml:"script,omitempty"`
}

type DistersConfig

type DistersConfig map[distgo.DistID]DisterConfig

func (*DistersConfig) UnmarshalYAML

func (cfgs *DistersConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

type DockerBuilderConfig

type DockerBuilderConfig struct {
	// Type is the type of the DockerBuilder. This field must be non-nil and non-empty and resolve to a valid DockerBuilder.
	Type *string `yaml:"type,omitempty"`
	// Config is the YAML configuration content for the DockerBuilder.
	Config *yaml.MapSlice `yaml:"config,omitempty"`
	// DockerfilePath is the path to the Dockerfile that is used to build the Docker image. The path is interpreted
	// relative to ContextDir. The content of the Dockerfile supports using Go templates. The following template
	// parameters can be used in the template:
	//   * {{Product}}: the name of the product
	//   * {{Version}}: the version of the project
	//   * {{ProductTaskOutputInfo}}: the ProductTaskOutputInfo struct
	DockerfilePath *string `yaml:"dockerfile-path,omitempty"`
	ContextDir     *string `yaml:"context-dir,omitempty"`
	// InputProductsDir is the directory in the context dir in which input products are written.
	InputProductsDir *string `yaml:"input-products-dir,omitempty"`
	// InputBuilds specifies the products whose build outputs should be made available to the Docker build task. The
	// specified products will be hard-linked into the context directory. The referenced products must be this product
	// or one of its declared dependencies.
	InputBuilds *[]distgo.ProductBuildID `yaml:"input-builds,omitempty"`
	// InputDists specifies the products whose dist outputs should be made available to the Docker build task. The
	// specified dists will be hard-linked into the context directory. The referenced products must be this product
	// or one of its declared dependencies.
	InputDists *[]distgo.ProductDistID `yaml:"input-dists,omitempty"`
	// TagTemplates specifies the templates that should be used to render the tag(s) for the Docker image. If multiple
	// values are specified, the image will be tagged with all of them.
	TagTemplates *[]string `yaml:"tag-templates,omitempty"`
}

type DockerBuildersConfig

type DockerBuildersConfig map[distgo.DockerID]DockerBuilderConfig

type DockerConfig

type DockerConfig struct {
	// Repository is the repository that is made available to the tag and Dockerfile templates.
	Repository *string `yaml:"repository,omitempty"`

	// DockerBuilderParams contains the Docker params for this distribution.
	DockerBuildersConfig *DockerBuildersConfig `yaml:"docker-builders,omitempty"`
}

type ProductConfig

type ProductConfig struct {
	// Build specifies the build configuration for the product.
	Build *BuildConfig `yaml:"build,omitempty"`

	// Run specifies the run configuration for the product.
	Run *RunConfig `yaml:"run,omitempty"`

	// Dist specifies the dist configuration for the product.
	Dist *DistConfig `yaml:"dist,omitempty"`

	// Publish specifies the publish configuration for the product.
	Publish *PublishConfig `yaml:"publish,omitempty"`

	// Docker specifies the Docker configuration for the product.
	Docker *DockerConfig `yaml:"docker,omitempty"`

	// Dependencies specifies the first-level dependencies of this product. Stores the IDs of the products.
	Dependencies *[]distgo.ProductID `yaml:"dependencies,omitempty"`
}

ProductConfig represents user-specified configuration on how to build a specific product.

type ProjectConfig

type ProjectConfig struct {
	// Products maps product names to configurations.
	Products map[distgo.ProductID]ProductConfig `yaml:"products,omitempty"`

	// ProductDefaults specifies the default values that should be used for unspecified values in the products map. If a
	// field in a top-level key in a "ProductConfig" value in the "Products" map is nil and the corresponding value in
	// ProductDefaults is non-nil, the value in ProductDefaults is used.
	ProductDefaults ProductConfig `yaml:"product-defaults,omitempty"`

	// ScriptIncludes specifies a string that is appended to every script that is written out. Can be used to define
	// functions or constants for all scripts.
	ScriptIncludes string `yaml:"script-includes,omitempty"`

	// ProjectVersioner specifies the operation that is used to compute the version for the project. If unspecified,
	// defaults to using the git project versioner (refer to the "projectversioner/git" package for details on the
	// implementation of this operation).
	ProjectVersioner *ProjectVersionConfig `yaml:"project-versioner,omitempty"`

	// Exclude matches the paths to exclude when determining the projects to build.
	Exclude matcher.NamesPathsCfg `yaml:"exclude,omitempty"`
}

type ProjectVersionConfig

type ProjectVersionConfig struct {
	// Type is the type of the project versioner. This field must be non-empty and resolve to a valid ProjectVersioner.
	Type string `yaml:"type,omitempty"`

	// Config is the YAML configuration content for the project versioner.
	Config yaml.MapSlice `yaml:"config,omitempty"`
}

type PublishConfig

type PublishConfig struct {
	// GroupID is the product-specific configuration equivalent to the global GroupID configuration.
	GroupID *string `yaml:"group-id,omitempty"`

	// PublishInfo contains extra configuration for the publish operation. The key is the type of publish and the value
	// is the configuration for that publish operation type.
	PublishInfo *map[distgo.PublisherTypeID]PublisherConfig `yaml:"info,omitempty"`
}

type PublisherConfig

type PublisherConfig struct {
	Config *yaml.MapSlice `yaml:"config,omitempty"`
}

type RunConfig

type RunConfig struct {
	// Args contain the arguments provided to the product when invoked using the "run" task.
	Args *[]string `yaml:"args,omitempty"`
}

Jump to

Keyboard shortcuts

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