legacy

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpgradeConfig

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

Types

type Almanac

type Almanac struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline"`

	// Metadata contains the metadata provided to the Almanac publish task.
	Metadata map[string]string `yaml:"metadata"`

	// Tags contains the tags provided to the Almanac publish task.
	Tags []string `yaml:"tags"`
}

type BinDist

type BinDist struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline,omitempty"`

	// OmitInitSh specifies whether or not the distribution should omit the auto-generated initialization script for the
	// product (a script in the "bin" directory that chooses the binary to invoke based on the host platform). If the
	// value is present and false, then the initialization script will be generated; otherwise, it will not.
	OmitInitSh *bool `yaml:"omit-init-sh,omitempty"`
	// 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 `yaml:"init-sh-template-file,omitempty"`
}

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

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

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

	// OutputDir is the directory to which the executable is written.
	OutputDir string `yaml:"output-dir,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: |
	//                      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/v2/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 Dist

type Dist struct {
	// OutputDir is the directory to which the distribution is written.
	OutputDir string `yaml:"output-dir,omitempty"`

	// Path 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 `yaml:"input-dir,omitempty"`

	// 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 `yaml:"input-products,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 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 `yaml:"script,omitempty"`

	// DistType specifies the type of the distribution to be built and configuration for it. If unspecified,
	// defaults to a DistInfo of type OSArchBinDistType.
	DistType DistInfo `yaml:"dist-type,omitempty"`

	// Publish is the configuration for the "publish" task.
	Publish Publish `yaml:"publish,omitempty"`
}

type DistInfo

type DistInfo struct {
	// Type is the type of the distribution. Value should be a valid value defined by DistInfoType.
	Type string `yaml:"type,omitempty"`

	// Info is the configuration content of the dist info.
	Info interface{} `yaml:"info,omitempty"`
}

func (*DistInfo) UnmarshalYAML

func (cfg *DistInfo) UnmarshalYAML(unmarshal func(interface{}) error) error

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 `yaml:"product,omitempty"`
	Type       string `yaml:"type,omitempty"`
	TargetFile string `yaml:"target-file,omitempty"`
}

type DockerImage

type DockerImage struct {
	Repository      string          `yaml:"repository,omitempty"`
	Tag             string          `yaml:"tag,omitempty"`
	ContextDir      string          `yaml:"context-dir,omitempty"`
	Deps            []DockerDep     `yaml:"dependencies,omitempty"`
	Info            DockerImageInfo `yaml:"info,omitempty"`
	BuildArgsScript string          `yaml:"build-args-script,omitempty"`
}

type DockerImageInfo

type DockerImageInfo struct {
	Type string      `yaml:"type,omitempty"`
	Data interface{} `yaml:"data,omitempty"`
}

func (*DockerImageInfo) UnmarshalYAML

func (cfg *DockerImageInfo) UnmarshalYAML(unmarshal func(interface{}) error) error

type ManualDist

type ManualDist struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline,omitempty"`

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

type OSArchBinDist

type OSArchBinDist struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline,omitempty"`

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

type Product

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

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

	// Dist specifies the dist configurations for the product.
	Dist RawDistConfigs `yaml:"dist,omitempty"`

	// DockerImages specifies the docker build configurations for the product.
	DockerImages []DockerImage `yaml:"docker,omitempty"`

	// DefaultPublish specifies the publish configuration that is applied to distributions that do not specify their
	// own publish configurations.
	DefaultPublish Publish `yaml:"publish,omitempty"`
}

type Project

type Project struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline,omitempty"`

	// Products maps product names to configurations.
	Products map[string]Product `yaml:"products,omitempty"`

	// 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 `yaml:"build-output-dir,omitempty"`

	// 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 `yaml:"dist-output-dir,omitempty"`

	// 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 `yaml:"dist-script-include,omitempty"`

	// GroupID is the identifier used as the group ID for the POM.
	GroupID string `yaml:"group-id,omitempty"`

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

type Publish

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

	// Almanac contains the parameters for Almanac publish operations. Optional.
	Almanac Almanac `yaml:"almanac,omitempty"`
}

type RPMDist

type RPMDist struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline,omitempty"`

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

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

	// BeforeInstallScript is the content of shell script to run before this RPM is installed. Optional.
	BeforeInstallScript string `yaml:"before-install-script,omitempty"`

	// AfterInstallScript is the content of shell script to run immediately after this RPM is installed. Optional.
	AfterInstallScript string `yaml:"after-install-script,omitempty"`

	// AfterRemoveScript is the content of shell script to clean up after this RPM is removed. Optional.
	AfterRemoveScript string `yaml:"after-remove-script,omitempty"`
}

type RawDistConfigs

type RawDistConfigs []Dist

func (*RawDistConfigs) UnmarshalYAML

func (out *RawDistConfigs) UnmarshalYAML(unmarshal func(interface{}) error) error

type Run

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

type SLSDist

type SLSDist struct {
	versionedconfig.ConfigWithLegacy `yaml:",inline,omitempty"`

	// 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 `yaml:"init-sh-template-file,omitempty"`

	// 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 `yaml:"manifest-template-file,omitempty"`

	// ServiceArgs is the string provided as the service arguments for the default init.sh file generated for the distribution.
	ServiceArgs string `yaml:"service-args,omitempty"`

	// ProductType is the SLS product type for the distribution.
	ProductType string `yaml:"product-type,omitempty"`

	// ManifestExtensions contain the SLS manifest extensions for the distribution.
	ManifestExtensions map[string]interface{} `yaml:"manifest-extensions,omitempty"`

	// Reloadable will enable the `init.sh reload` command which sends SIGHUP to the process.
	Reloadable bool `yaml:"reloadable,omitempty"`

	// 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.NamesPathsCfg `yaml:"yml-validation-exclude,omitempty"`
}

type SLSDockerImageInfo

type SLSDockerImageInfo struct {
	Legacy bool `yaml:"legacy-config,omitempty"`

	GroupID      string                 `yaml:"group-id,omitempty"`
	ProuductType string                 `yaml:"product-type,omitempty"`
	Extensions   map[string]interface{} `yaml:"manifest-extensions,omitempty"`
}

Jump to

Keyboard shortcuts

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