Documentation ¶
Index ¶
- func BuildArgsFromScript(productTaskOutputInfo ProductTaskOutputInfo, buildArgsScript string) ([]string, error)
- func BuildScriptEnvVariables(outputInfo ProductTaskOutputInfo) map[string]string
- func ClassifyProductParams(productParams []ProductParam) (allProducts map[ProductID]struct{}, specifiedProducts map[ProductID]struct{}, ...)
- func CreateScriptContent(script, scriptIncludes string) string
- func DistScriptEnvVariables(distID DistID, outputInfo ProductTaskOutputInfo) map[string]string
- func DockerScriptEnvVariables(dockerID DockerID, outputInfo ProductTaskOutputInfo) map[string]string
- func DryRunPrint(w io.Writer, msg string)
- func DryRunPrintln(w io.Writer, msg string)
- func ExecutableName(productName, goos string) string
- func PrintOrDryRunPrint(w io.Writer, msg string, dryRun bool)
- func PrintlnOrDryRunPrintln(w io.Writer, msg string, dryRun bool)
- func ProductBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[osarch.OSArch]string
- func ProductBuildOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) string
- func ProductDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
- func ProductDistOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo, distID DistID) string
- func ProductDistWorkDirs(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID]string
- func ProductDistWorkDirsAndArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
- func ProductDockerBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[osarch.OSArch]string
- func ProductDockerDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[DistID][]string
- func ProductIDsToStrings(in []ProductID) []string
- func RenderTemplate(tmplContent string, data interface{}, fns ...TemplateFunction) (string, error)
- func RunCommandWithVerboseOption(cmd *exec.Cmd, verbose, dryRun bool, stdout io.Writer) error
- func ToMapSlice(in interface{}) (yaml.MapSlice, error)
- func WriteAndExecuteScript(projectInfo ProjectInfo, script string, additionalEnvVars map[string]string, ...) (rErr error)
- func WriteScript(projectInfo ProjectInfo, script string) (name string, cleanup func() error, rErr error)
- type BuildFunc
- type BuildOSArchID
- type BuildOutputInfo
- type BuildParam
- type ByBuildOSArchID
- type ByDistID
- type ByDockerID
- type ByDockerTagID
- type ByOSArchID
- type ByProductID
- type ByPublisherTypeID
- type ConfigUpgrader
- type DistID
- type DistOutputInfo
- type DistOutputInfos
- type DistParam
- type Dister
- type DisterFactory
- type DisterParam
- type DockerBuilder
- type DockerBuilderFactory
- type DockerBuilderOutputInfo
- func (doi *DockerBuilderOutputInfo) InputBuildOSArchs(productID ProductID) []OSArchID
- func (doi *DockerBuilderOutputInfo) InputBuildProductIDs() []ProductID
- func (doi *DockerBuilderOutputInfo) InputDistDistIDs(productID ProductID) []DistID
- func (doi *DockerBuilderOutputInfo) InputDistProductIDs() []ProductID
- type DockerBuilderParam
- type DockerID
- type DockerOutputInfos
- type DockerParam
- type DockerTagID
- type FlagType
- type InputDirParam
- type OSArchID
- type ProcessFunc
- type ProductBuildID
- type ProductDistID
- type ProductDockerID
- type ProductErrors
- type ProductID
- type ProductOutputInfo
- type ProductParam
- func ProductParamsForBuildProductArgs(inputProducts map[ProductID]ProductParam, productBuildIDs ...ProductBuildID) ([]ProductParam, error)
- func ProductParamsForDistProductArgs(inputProducts map[ProductID]ProductParam, productDistIDs ...ProductDistID) ([]ProductParam, error)
- func ProductParamsForDockerProductArgs(inputProducts map[ProductID]ProductParam, productDockerIDs ...ProductDockerID) ([]ProductParam, error)
- func ProductParamsForProductArgs(inputProducts map[ProductID]ProductParam, productIDs ...ProductID) ([]ProductParam, error)
- type ProductTaskOutputInfo
- func (p *ProductTaskOutputInfo) AllProductOutputInfos() []ProductOutputInfo
- func (p *ProductTaskOutputInfo) AllProductOutputInfosMap() map[ProductID]ProductOutputInfo
- func (p *ProductTaskOutputInfo) ProductBuildArtifactPaths() map[osarch.OSArch]string
- func (p *ProductTaskOutputInfo) ProductBuildOutputDir() string
- func (p *ProductTaskOutputInfo) ProductDistArtifactPaths() map[DistID][]string
- func (p *ProductTaskOutputInfo) ProductDistOutputDir(distID DistID) string
- func (p *ProductTaskOutputInfo) ProductDistWorkDirs() map[DistID]string
- func (p *ProductTaskOutputInfo) ProductDistWorkDirsAndArtifactPaths() map[DistID][]string
- func (p *ProductTaskOutputInfo) ProductDockerBuildArtifactPaths() map[DockerID]map[ProductID]map[osarch.OSArch]string
- func (p *ProductTaskOutputInfo) ProductDockerDistArtifactPaths() map[DockerID]map[ProductID]map[DistID][]string
- type ProjectInfo
- type ProjectParam
- type ProjectVersioner
- type ProjectVersionerFactory
- type ProjectVersionerParam
- type PublishOutputInfo
- type PublishParam
- type Publisher
- type PublisherFactory
- type PublisherFlag
- type PublisherFlagName
- type PublisherParam
- type PublisherTypeID
- type RunParam
- type TemplateFunction
- func GroupIDTemplateFunction(groupID string) TemplateFunction
- func PackagingTemplateFunction(packaging string) TemplateFunction
- func ProductTemplateFunction(productID ProductID) TemplateFunction
- func RepositoryTemplateFunction(repository string) TemplateFunction
- func TemplateValueFunction(key string, val interface{}) TemplateFunction
- func VersionTemplateFunction(version string) TemplateFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildArgsFromScript ¶
func BuildArgsFromScript(productTaskOutputInfo ProductTaskOutputInfo, buildArgsScript string) ([]string, error)
func BuildScriptEnvVariables ¶
func BuildScriptEnvVariables(outputInfo ProductTaskOutputInfo) map[string]string
BuildScriptEnvVariables returns a map of environment variables for the script for the builder. The returned map contains the following environment variables:
PROJECT_DIR: the root directory of project VERSION: the version of the project PRODUCT: the name of the product
The following environment variables are defined if the build configuration for the product is non-nil:
BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ProductID}}/{{Version}}") BUILD_NAME: the rendered NameTemplate for the build for this product BUILD_OS_ARCH_COUNT: the number of OS/arch combinations for this product BUILD_OS_ARCH_{#}: for 0 <= # < BUILD_OS_ARCHS_COUNT, contains the OS/arch for the build
func ClassifyProductParams ¶
func ClassifyProductParams(productParams []ProductParam) (allProducts map[ProductID]struct{}, specifiedProducts map[ProductID]struct{}, dependentProducts map[ProductID]struct{})
func CreateScriptContent ¶ added in v1.0.0
func DistScriptEnvVariables ¶
func DistScriptEnvVariables(distID DistID, outputInfo ProductTaskOutputInfo) map[string]string
DistScriptEnvVariables returns a map of environment variables for the script for the dister with the specified DistID in the provided output configuration. The returned map contains the following environment variables:
PROJECT_DIR: the root directory of project VERSION: the version of the project PRODUCT: the name of the product DEP_PRODUCT_ID_COUNT: the number of dependent products for the product DEP_PRODUCT_ID_{#}: for 0 <= # < DEP_PRODUCT_IDS_COUNT, contains the dependent products for the product
The following environment variables are defined if the build configuration for the product is non-nil:
BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ProductID}}/{{Version}}") BUILD_NAME: the rendered NameTemplate for the build for this product BUILD_OS_ARCH_COUNT: the number of OS/arch combinations for this product BUILD_OS_ARCH_{#}: for 0 <= # < BUILD_OS_ARCHS_COUNT, contains the OS/arch for the build
The following environment variables are defined if the dist configuration for the product is non-nil:
DIST_ID: the DistID for the current distribution DIST_DIR: the distribution output directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}") DIST_WORK_DIR: the distribution work directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{NameTemplateRendered}}") DIST_NAME: the rendered NameTemplate for the distribution DIST_ARTIFACT_COUNT: the number of artifacts generated by the current distribution DIST_ARTIFACT_{#}: for 0 <= # < DIST_ARTIFACT_COUNT, the name of the dist artifact generated by the current distribution
Each dependent product adds the following set of environment variables that start with "DEP_PRODUCT_ID_{#}_", where 0 <= # < DEP_PRODUCT_ID_COUNT:
The following environment variables are defined if the build configuration for the product is non-nil:
DEP_PRODUCT_ID_{#}_BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ProductID}}/{{Version}}") DEP_PRODUCT_ID_{#}_BUILD_NAME: the rendered NameTemplate for the build for this product DEP_PRODUCT_ID_{#}_BUILD_OS_ARCH_COUNT: the number of OS/arch combinations for this product DEP_PRODUCT_ID_{#}_BUILD_OS_ARCH_{##}: for 0 <= ## < BUILD_OS_ARCH_COUNT, contains the OS/arch for the build
The following environment variables are defined if the dist configuration for the product is non-nil:
DEP_PRODUCT_ID_{#}_DIST_ID_COUNT: the number of disters for this product DEP_PRODUCT_ID_{#}_DIST_ID_{##}: for 0 <= ## < DIST_ID_COUNT, the DistID DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_DIR: for 0 <= ## < DIST_ID_COUNT, the distribution output directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}") DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_WORK_DIR: for 0 <= ## < DIST_ID_COUNT, the distribution work directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{NameTemplateRendered}}") DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_NAME: for 0 <= ## < DIST_ID_COUNT, the rendered NameTemplate for the distribution DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_ARTIFACT_COUNT: for 0 <= ## < DIST_DISTER_IDS_COUNT, contains the number of artifacts generated by the dister DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_ARTIFACT_{###}: for 0 <= ## < DIST_DISTER_IDS_COUNT and 0 <= ### < DIST_DISTER_IDS_{#}_DIST_ARTIFACTS_COUNT, contains the name of the specified dist artifact
func DockerScriptEnvVariables ¶ added in v1.8.0
func DockerScriptEnvVariables(dockerID DockerID, outputInfo ProductTaskOutputInfo) map[string]string
DockerScriptEnvVariables returns a map of environment variables for the script for the Docker builder with the specified DockerID in the provided output configuration. The returned map contains the following environment variables:
PROJECT_DIR: the root directory of project VERSION: the version of the project PRODUCT: the name of the product DOCKER_ID: the DockerID for the current distribution
The following environment variables are defined if the Docker configuration for the product is non-nil:
CONTEXT_DIR: the path to the context directory
func DryRunPrint ¶
func DryRunPrintln ¶
func ExecutableName ¶
func ProductBuildArtifactPaths ¶
func ProductBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[osarch.OSArch]string
ProductBuildArtifactPaths returns a map that contains the paths to the executables created by the provided product for the provided project. The keys in the map are the OS/architecture of the executable and the values are the executable output paths for that OS/architecture. The output paths are of the form "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{OSArch}}/{{NameTemplateRendered}}" (and if the OS is Windows, the ".exe" extension is appended).
func ProductBuildOutputDir ¶
func ProductBuildOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) string
ProductBuildOutputDir returns the output directory for the build outputs, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}".
func ProductDistArtifactPaths ¶
func ProductDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
ProductDistArtifactPaths returns a map from DistID to the output paths for the dist, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{Artifacts}}".
func ProductDistOutputDir ¶
func ProductDistOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo, distID DistID) string
ProductDistOutputDir returns the output directory for the dist outputs for the dist with the given DistID, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}".
func ProductDistWorkDirs ¶
func ProductDistWorkDirs(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID]string
ProductDistWorkDirs returns a map from DistID to the directory used to prepare the distribution for that DistID, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{NameTemplateRendered}}".
func ProductDistWorkDirsAndArtifactPaths ¶
func ProductDistWorkDirsAndArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
ProductDistWorkDirsAndArtifactPaths returns a map that is the result of joining the values of the outputs of ProductDistWorkDirs and ProductDistArtifactPaths.
func ProductDockerBuildArtifactPaths ¶
func ProductDockerBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[osarch.OSArch]string
ProductDockerBuildArtifactPaths returns a map that contains the paths to the locations where the input build artifacts should be placed in the Docker context directory. The DockerID key identifies the DockerBuilder, the ProductID represents the input product for that DockerBuilder, and the osarch.OSArch represents the OS/Arch for the build. Paths are of the form "{{ProjectDir}}/{{DockerID.ContextDir}}/{{DockerID.InputProductsDir}}/{{ProductID}}/build/{{OSArch}}/{{ExecutableName}}".
func ProductDockerDistArtifactPaths ¶
func ProductDockerDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[DistID][]string
ProductDockerDistArtifactPaths returns a map that contains the paths to the locations where the input dist artifacts should be placed in the Docker context directory. The DockerID key identifies the DockerBuilder, the ProductID represents the input product for that DockerBuilder, and the DistID represents the Dister for the product. Paths are of the form "{{ProjectDir}}/{{DockerID.ContextDir}}/{{DockerID.InputProductsDir}}/{{ProductID}}/dist/{{DistID}}/{{Artifacts}}".
func ProductIDsToStrings ¶
func RenderTemplate ¶
func RenderTemplate(tmplContent string, data interface{}, fns ...TemplateFunction) (string, error)
func ToMapSlice ¶
func ToMapSlice(in interface{}) (yaml.MapSlice, error)
func WriteAndExecuteScript ¶
func WriteScript ¶
func WriteScript(projectInfo ProjectInfo, script string) (name string, cleanup func() error, rErr error)
Types ¶
type BuildFunc ¶
type BuildFunc func(projectInfo ProjectInfo, productParams []ProductParam, stdout io.Writer) error
func ProcessSerially ¶
func ProcessSerially(f func(projectInfo ProjectInfo, productParam ProductParam, stdout io.Writer) error) BuildFunc
ProcessSerially returns a BuildFunc that processes each of the provided specs in order using the provided function. If the function returns an error for any of the specifications, the function immediately returns that error.
func ProcessSeriallyBatchErrors ¶
func ProcessSeriallyBatchErrors(f func(projectInfo ProjectInfo, productParam ProductParam, stdout io.Writer) error) BuildFunc
ProcessSeriallyBatchErrors returns a BuildFunc that processes each of the provided specs in order using the provided function. If the function returns an error for any of the specifications, it is stored, but the function will will continue processing the provided specifications. The function return nil if no errors occurred; otherwise, it returns a ProductErrors error that contains the individual errors.
type BuildOSArchID ¶ added in v1.0.0
type BuildOSArchID string
BuildOSArchID identifies the output of a build. Must be the string representation of an osarch.OSArch.
type BuildOutputInfo ¶
type BuildParam ¶
type BuildParam 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 NameTemplate string // 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}}". OutputDir string // MainPkg is the location of the main package for the product relative to the project root directory. For example, // "distgo/main". MainPkg 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 // and executed with the project directory as the working directory. 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: // // #!/usr/bin/env bash // 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, // a value of map[string]string{"CGO_ENABLED": "0"} would build with CGo disabled. Environment map[string]string // OSArchs specifies the GOOS and GOARCH pairs for which the product is built. OSArchs []osarch.OSArch }
func (*BuildParam) BuildArgs ¶
func (p *BuildParam) BuildArgs(productTaskOutputInfo ProductTaskOutputInfo) ([]string, error)
func (*BuildParam) ToBuildOutputInfo ¶
func (p *BuildParam) ToBuildOutputInfo(productID ProductID, version string) (BuildOutputInfo, error)
type ByBuildOSArchID ¶ added in v1.0.0
type ByBuildOSArchID []BuildOSArchID
func (ByBuildOSArchID) Len ¶ added in v1.0.0
func (a ByBuildOSArchID) Len() int
func (ByBuildOSArchID) Less ¶ added in v1.0.0
func (a ByBuildOSArchID) Less(i, j int) bool
func (ByBuildOSArchID) Swap ¶ added in v1.0.0
func (a ByBuildOSArchID) Swap(i, j int)
type ByDockerID ¶
type ByDockerID []DockerID
func (ByDockerID) Len ¶
func (a ByDockerID) Len() int
func (ByDockerID) Less ¶
func (a ByDockerID) Less(i, j int) bool
func (ByDockerID) Swap ¶
func (a ByDockerID) Swap(i, j int)
type ByDockerTagID ¶ added in v1.7.0
type ByDockerTagID []DockerTagID
func (ByDockerTagID) Len ¶ added in v1.7.0
func (a ByDockerTagID) Len() int
func (ByDockerTagID) Less ¶ added in v1.7.0
func (a ByDockerTagID) Less(i, j int) bool
func (ByDockerTagID) Swap ¶ added in v1.7.0
func (a ByDockerTagID) Swap(i, j int)
type ByOSArchID ¶
type ByOSArchID []OSArchID
func (ByOSArchID) Len ¶
func (a ByOSArchID) Len() int
func (ByOSArchID) Less ¶
func (a ByOSArchID) Less(i, j int) bool
func (ByOSArchID) Swap ¶
func (a ByOSArchID) Swap(i, j int)
type ByProductID ¶
type ByProductID []ProductID
func (ByProductID) Len ¶
func (a ByProductID) Len() int
func (ByProductID) Less ¶
func (a ByProductID) Less(i, j int) bool
func (ByProductID) Swap ¶
func (a ByProductID) Swap(i, j int)
type ByPublisherTypeID ¶ added in v1.0.0
type ByPublisherTypeID []PublisherTypeID
func (ByPublisherTypeID) Len ¶ added in v1.0.0
func (a ByPublisherTypeID) Len() int
func (ByPublisherTypeID) Less ¶ added in v1.0.0
func (a ByPublisherTypeID) Less(i, j int) bool
func (ByPublisherTypeID) Swap ¶ added in v1.0.0
func (a ByPublisherTypeID) Swap(i, j int)
type ConfigUpgrader ¶ added in v1.0.0
func NewConfigUpgrader ¶ added in v1.0.0
func NewConfigUpgrader(typeName string, upgradeFn func([]byte) ([]byte, error)) ConfigUpgrader
type DistOutputInfo ¶
type DistOutputInfos ¶
type DistOutputInfos struct { DistOutputDir string `json:"distOutputDir"` DistIDs []DistID `json:"distIds"` DistInfos map[DistID]DistOutputInfo `json:"distInfos"` }
type DistParam ¶
type DistParam 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}}/{{DistID}}/{{NameTemplate}}", and the distribution artifacts are written to // "{{OutputDir}}/{{ID}}/{{Version}}/{{DistID}}". OutputDir string // DistParams contains the dist params for this distribution. DistParams map[DistID]DisterParam }
func (*DistParam) ToDistOutputInfos ¶
func (p *DistParam) ToDistOutputInfos(productID ProductID, version string) (DistOutputInfos, error)
type Dister ¶
type Dister interface { // TypeName returns the type of this dister. TypeName() (string, error) // Artifacts returns the names of the artifacts generated by running RunDist. Artifacts(renderedName string) ([]string, error) // PackagingExtension returns the extension of the primary artifact generated by this dister. May return an empty // string if the dister does not have a notion of a primary artifact or if it does not have an extension. Used // primarily for generating the POM for disters that produce Maven-style artifacts -- the value returned by this // function should be able to be used as the "packaging" property in a POM. The returned extension should not // include a leading period: for example, a valid value may be "tar.gz" or "zip". PackagingExtension() (string, error) // RunDist runs the distribution task. The provided DistID specifies the ID for the current dister and the // ProductTaskOutputInfo contains all of the output information for the product. When this function is called, the // DistWorkDir for the product should have already been created and the dist script should have already been run. // Running this function should populate the DistWorkDir with any files and/or directories required for the // distribution. However, the dist artifacts themselves should not be created. May return a value that is the // JSON-serialized bytes that is provided as the runDistResult parameter to GenerateDistArtifacts. RunDist(distID DistID, productTaskOutputInfo ProductTaskOutputInfo) ([]byte, error) // GenerateDistArtifacts generates the dist artifact outputs from the DistWorkDir for the distribution. The // runDistResult argument contains the JSON-serialized bytes returned by the RunDist call. The DistWorkDir contains // the output generated by RunDist. The outputs written by GenerateDistArtifacts should match the artifacts returned // by the Artifacts function. GenerateDistArtifacts(distID DistID, productTaskOutputInfo ProductTaskOutputInfo, runDistResult []byte) error }
type DisterFactory ¶
type DisterParam ¶
type DisterParam struct { // NameTemplate is the template used for the dist output. The following template parameters can be used in the // template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project NameTemplate string // InputDir specifies the configuration for copying files from an input directory. InputDir InputDirParam // Script is the content of a script that is written to 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 // Dister is the Dister that performs the dist operation for this parameter. Dister Dister }
func (*DisterParam) ToDistOutputInfo ¶
func (p *DisterParam) ToDistOutputInfo(productID ProductID, version string) (DistOutputInfo, error)
type DockerBuilder ¶
type DockerBuilderFactory ¶
type DockerBuilderFactory interface { NewDockerBuilder(typeName string, cfgYMLBytes []byte) (DockerBuilder, error) ConfigUpgrader(typeName string) (ConfigUpgrader, error) Types() []string }
type DockerBuilderOutputInfo ¶
type DockerBuilderOutputInfo struct { ContextDir string `json:"contextDir"` DockerfilePath string `json:"dockerfilePath"` InputProductsDir string `json:"inputProductsDir"` RenderedTags []string `json:"renderedDockerTags"` InputBuilds map[ProductID]map[OSArchID]struct{} `json:"inputBuilds"` InputDists map[ProductID]map[DistID]struct{} `json:"inputDists"` InputDistsOutputPaths map[ProductID]map[DistID][]string `json:"inputDistsOutputPaths"` }
func (*DockerBuilderOutputInfo) InputBuildOSArchs ¶
func (doi *DockerBuilderOutputInfo) InputBuildOSArchs(productID ProductID) []OSArchID
func (*DockerBuilderOutputInfo) InputBuildProductIDs ¶
func (doi *DockerBuilderOutputInfo) InputBuildProductIDs() []ProductID
func (*DockerBuilderOutputInfo) InputDistDistIDs ¶
func (doi *DockerBuilderOutputInfo) InputDistDistIDs(productID ProductID) []DistID
func (*DockerBuilderOutputInfo) InputDistProductIDs ¶
func (doi *DockerBuilderOutputInfo) InputDistProductIDs() []ProductID
type DockerBuilderParam ¶
type DockerBuilderParam struct { // DockerBuilder is the builder used to build the Docker image. DockerBuilder DockerBuilder // Script is the content of a script that is written to a file and run before the build task. This script is run // before the Dockerfile is read and rendered. 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 Docker-related environment variables. Refer to the documentation for the // distgo.DockerScriptEnvVariables function for the extra environment variables. Script string // 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 // * {{Repository}}: the Docker repository for the operation // * {{InputBuildArtifact(productID, osArch string) (string, error)}}: the path to the build artifact for the specified input product // * {{InputDistArtifacts(productID, distID string) ([]string, error)}}: the paths to the dist artifacts for the specified input product // * {{Tags(productID, dockerID string) ([]string, error)}}: the tags for the specified Docker image DockerfilePath string // DisableTemplateRendering disables rendering the Go templates in the Dockerfile when set to true. This should only // be set to true if the Dockerfile does not use the Docker task templating and contains other Go templating -- in // this case, disabling rendering removes the need for the extra level of indirection usually necessary to render Go // templates using Go templates. DisableTemplateRendering bool // ContextDir is the Docker context directory for building the Docker image. ContextDir string // Name of directory within ContextDir in which dependencies are linked. InputProductsDir string // InputBuilds stores the ProductBuildIDs for the input builds. The IDs must be unique and in expanded form. InputBuilds []ProductBuildID // InputDists stores the ProductDistIDs for the input dists. The IDs must be unique and in expanded form. InputDists []ProductDistID // InputDistsOutputPaths is a map from ProductDistID to overridden output paths for the dist artifacts for that // ProductDistID. InputDistsOutputPaths map[ProductDistID][]string // TagTemplates contains the templates for the tags that will be used to tag the image generated by this builder. // The tag should be the form that would be provided to the "docker tag" command -- for example, // "fedora/httpd:version1.0" or "myregistryhost:5000/fedora/httpd:version1.0". // // The tag templates are rendered 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 // * {{Repository}}: the Docker repository TagTemplates map[DockerTagID]string }
func (*DockerBuilderParam) ToDockerBuilderOutputInfo ¶
func (p *DockerBuilderParam) ToDockerBuilderOutputInfo(productID ProductID, version, repository string) (DockerBuilderOutputInfo, error)
type DockerOutputInfos ¶
type DockerOutputInfos struct { DockerIDs []DockerID `json:"dockerIds"` Repository string `json:"repository"` DockerBuilderOutputInfos map[DockerID]DockerBuilderOutputInfo `json:"dockerBuilderOutputInfos"` }
type DockerParam ¶
type DockerParam struct { // Repository is the Docker repository. This value is made available to TagTemplates as {{Repository}}. Repository string // DockerBuilderParams contains the Docker params for this distribution. DockerBuilderParams map[DockerID]DockerBuilderParam }
func (*DockerParam) ToDockerOutputInfos ¶
func (p *DockerParam) ToDockerOutputInfos(productID ProductID, version string) (DockerOutputInfos, error)
type DockerTagID ¶ added in v1.7.0
type DockerTagID string
type FlagType ¶
type FlagType int
FlagType represents the type of a flag (string, boolean, etc.). Currently only string flags are supported.
type InputDirParam ¶ added in v1.0.0
type ProcessFunc ¶
type ProcessFunc func(f func(projectInfo ProjectInfo, productParam ProductParam, stdout io.Writer) error) BuildFunc
type ProductBuildID ¶
type ProductBuildID string
ProductBuildID identifies a product or a specific build for a product. A ProductBuildID is one of the following:
- {{ProductID}} (e.g. "foo"), which specifies that all OS/Archs for the product should be built
- {{ProductID}}.{{OSArch}} (e.g. "foo.darwin-amd64"), which specifies that the specified OS/Arch for the specified product should be built
func NewProductBuildID ¶
func NewProductBuildID(productID ProductID, osArch osarch.OSArch) ProductBuildID
func ToProductBuildIDs ¶
func ToProductBuildIDs(in []string) []ProductBuildID
type ProductDistID ¶
type ProductDistID string
ProductDistID identifies a product or a specific dist for a product. A ProductDistID is one of the following:
- {{ProductID}} (e.g. "foo"), which specifies that all dists for the product should be built
- {{ProductID}}.{{DistID}} (e.g. "foo.os-arch-bin"), which specifies that the specified DistID for the specified product should be built
func NewProductDistID ¶
func NewProductDistID(productID ProductID, distID DistID) ProductDistID
func ToProductDistIDs ¶
func ToProductDistIDs(in []string) []ProductDistID
func (ProductDistID) Parse ¶
func (id ProductDistID) Parse() (ProductID, DistID)
type ProductDockerID ¶
type ProductDockerID string
ProductDockerID identifies a product, a specific Docker builder for a product, or a specific Docker tag for a specific Docker builder for a product. A ProductDockerID is one of the following:
- {{ProductID}} (e.g. "foo"), which identifies all Docker images and its tags for the product
- {{ProductID}}.{{DockerID}} (e.g. "foo.prod-docker"), which specifies all of the tags for the specified DockerID for the specified product
- {{ProductID}}.{{DockerID}}.{{DockerTagID}} (e.g. "foo.prod-docker.release"), which specifies a specific tag for the specified DockerID for the specified product
func NewProductDockerID ¶
func NewProductDockerID(productID ProductID, dockerID DockerID, dockerTagID DockerTagID) ProductDockerID
func ToProductDockerIDs ¶
func ToProductDockerIDs(in []string) []ProductDockerID
func (ProductDockerID) Parse ¶
func (id ProductDockerID) Parse() (ProductID, DockerID, DockerTagID)
type ProductErrors ¶
func (*ProductErrors) Error ¶
func (e *ProductErrors) Error() string
type ProductID ¶
type ProductID string
func ToProductIDs ¶
func TopoSortProductParams ¶
func TopoSortProductParams(projectParam ProjectParam, allProducts map[ProductID]struct{}) (map[ProductID]ProductParam, []ProductID, error)
type ProductOutputInfo ¶
type ProductOutputInfo struct { ID ProductID `json:"productId"` BuildOutputInfo *BuildOutputInfo `json:"buildOutputInfo"` DistOutputInfos *DistOutputInfos `json:"distOutputInfos"` PublishOutputInfo *PublishOutputInfo `json:"publishOutputInfo"` DockerOutputInfos *DockerOutputInfos `json:"dockerOutputInfos"` }
type ProductParam ¶
type ProductParam struct { // ID is the unique identifier for this product. Its value comes from the key for the product in the Products map in // the configuration. ID ProductID // Build specifies the build configuration for the product. Build *BuildParam // Run specifies the run configuration for the product. Run *RunParam // Dist specifies the dist configuration for the product. Dist *DistParam // Publish specifies the publish configuration for the product. Publish *PublishParam // Docker specifies the Docker configuration for the product. Docker *DockerParam // FirstLevelDependencies stores the IDs of the products that are declared as dependencies of this product. FirstLevelDependencies []ProductID // AllDependencies stores all of the dependent products of this product. It is a result of expanding all of the // dependencies in FirstLevelDependencies. AllDependencies map[ProductID]ProductParam }
func ProductParamsForBuildProductArgs ¶
func ProductParamsForBuildProductArgs(inputProducts map[ProductID]ProductParam, productBuildIDs ...ProductBuildID) ([]ProductParam, error)
ProductParamsForBuildProductArgs returns the ProductParams from the provided inputProducts for the specified ProductBuildIDs. The ProductParam values in the returned slice will reflect the items specified by the build IDs. For example, if the project defines a product "foo" with OS-Archs "darwin-amd64" and "linux-amd64" and the productBuildID is "foo.darwin-amd64", the returned ProductParam will only contain "darwin-amd64" in the build configuration. Returns an error if any of the productBuildID values cannot be resolved to a configuration in the provided inputProducts.
func ProductParamsForDistProductArgs ¶
func ProductParamsForDistProductArgs(inputProducts map[ProductID]ProductParam, productDistIDs ...ProductDistID) ([]ProductParam, error)
ProductParamsForDistProductArgs returns the ProductParams from the provided inputProducts for the specified productDistIDs. The ProductParam values in the returned slice will reflect the items specified by the dister IDs. For example, if the project defines a product "foo" with DistParams "os-arch-bin" and "manual" and the productDistID is "foo.os-arch-bin", the returned ProductParam will only contain "os-arch-bin" in the dist configuration. Returns an error if any of the productDistID values cannot be resolved to a configuration in the provided inputProducts.
func ProductParamsForDockerProductArgs ¶
func ProductParamsForDockerProductArgs(inputProducts map[ProductID]ProductParam, productDockerIDs ...ProductDockerID) ([]ProductParam, error)
ProductParamsForDockerProductArgs returns the ProductParams from the provided inputProducts for the specified productDockerIDs. The ProductParam values in the returned slice will reflect the items specified by the DockerIDs. For example, if the project defines a product "foo" with DockerBuilderParams "docker-prod" and "docker-dev" and both of them have tags named "snapshot" and "release" and the productDockerID is "foo.docker-prod.release", the returned ProductParam will only contain "docker-prod" with the tag "release" in the Docker configuration. Returns an error if any of the productDockerID values cannot be resolved to a configuration in the provided project.
func ProductParamsForProductArgs ¶
func ProductParamsForProductArgs(inputProducts map[ProductID]ProductParam, productIDs ...ProductID) ([]ProductParam, error)
ProductParamsForProductArgs returns the ProductParams from the provided inputProducts for the specified ProductIDs.
Returns an error if any of the ProductID values cannot be resolved to a configuration in the provided inputProducts.
func (*ProductParam) AllDependenciesSortedIDs ¶
func (p *ProductParam) AllDependenciesSortedIDs() []ProductID
func (*ProductParam) AllProductParams ¶
func (p *ProductParam) AllProductParams() []ProductParam
func (*ProductParam) ToProductOutputInfo ¶
func (p *ProductParam) ToProductOutputInfo(version string) (ProductOutputInfo, error)
type ProductTaskOutputInfo ¶
type ProductTaskOutputInfo struct { Project ProjectInfo `json:"project"` Product ProductOutputInfo `json:"product"` Deps map[ProductID]ProductOutputInfo `json:"deps"` }
func ToProductTaskOutputInfo ¶
func ToProductTaskOutputInfo(projectInfo ProjectInfo, productParam ProductParam) (ProductTaskOutputInfo, error)
func (*ProductTaskOutputInfo) AllProductOutputInfos ¶
func (p *ProductTaskOutputInfo) AllProductOutputInfos() []ProductOutputInfo
func (*ProductTaskOutputInfo) AllProductOutputInfosMap ¶
func (p *ProductTaskOutputInfo) AllProductOutputInfosMap() map[ProductID]ProductOutputInfo
func (*ProductTaskOutputInfo) ProductBuildArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductBuildArtifactPaths() map[osarch.OSArch]string
func (*ProductTaskOutputInfo) ProductBuildOutputDir ¶
func (p *ProductTaskOutputInfo) ProductBuildOutputDir() string
func (*ProductTaskOutputInfo) ProductDistArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductDistArtifactPaths() map[DistID][]string
func (*ProductTaskOutputInfo) ProductDistOutputDir ¶
func (p *ProductTaskOutputInfo) ProductDistOutputDir(distID DistID) string
func (*ProductTaskOutputInfo) ProductDistWorkDirs ¶
func (p *ProductTaskOutputInfo) ProductDistWorkDirs() map[DistID]string
func (*ProductTaskOutputInfo) ProductDistWorkDirsAndArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductDistWorkDirsAndArtifactPaths() map[DistID][]string
func (*ProductTaskOutputInfo) ProductDockerBuildArtifactPaths ¶
func (*ProductTaskOutputInfo) ProductDockerDistArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductDockerDistArtifactPaths() map[DockerID]map[ProductID]map[DistID][]string
type ProjectInfo ¶
type ProjectParam ¶
type ProjectParam struct { // Products contains the parameters for the defined products. Products map[ProductID]ProductParam // 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 // ProjectVersionerParam provides the operation for determining the project version. ProjectVersionerParam ProjectVersionerParam // Exclude is a matcher that matches any directories that should be ignored as main files. Only relevant if products // are not specified. Exclude matcher.Matcher }
func (*ProjectParam) ProjectInfo ¶
func (p *ProjectParam) ProjectInfo(projectDir string) (ProjectInfo, error)
type ProjectVersioner ¶ added in v1.0.0
type ProjectVersionerFactory ¶ added in v1.0.0
type ProjectVersionerFactory interface { Types() []string NewProjectVersioner(typeName string, cfgYMLBytes []byte) (ProjectVersioner, error) ConfigUpgrader(typeName string) (ConfigUpgrader, error) }
type ProjectVersionerParam ¶ added in v1.0.0
type ProjectVersionerParam struct { // ProjectVersioner is the ProjectVersioner that performs the project version operation for this parameter. ProjectVersioner ProjectVersioner }
type PublishOutputInfo ¶
type PublishOutputInfo struct {
GroupID string `json:"groupId"`
}
type PublishParam ¶
type PublishParam struct { // GroupID is the Maven group ID used for the publish operation. GroupID string // PublishInfo contains extra configuration for the publish operation. The key is the type of publish. PublishInfo map[PublisherTypeID]PublisherParam }
func (*PublishParam) ToPublishOutputInfo ¶
func (p *PublishParam) ToPublishOutputInfo() PublishOutputInfo
type Publisher ¶
type Publisher interface { // TypeName returns the type of this publisher. TypeName() (string, error) // Flags returns the flags provided by this Publisher. Flags() ([]PublisherFlag, error) // RunPublish runs the publish task. When this function is called, the distribution artifacts for the product should // already exist. If dryRun is true, then the task should print the operations that would occur without actually // executing them. RunPublish(productTaskOutputInfo ProductTaskOutputInfo, cfgYML []byte, flagVals map[PublisherFlagName]interface{}, dryRun bool, stdout io.Writer) error }
type PublisherFactory ¶ added in v1.0.0
type PublisherFlag ¶
type PublisherFlag struct { Name PublisherFlagName Description string Type FlagType }
func (PublisherFlag) AddFlag ¶
func (f PublisherFlag) AddFlag(fset *pflag.FlagSet) (interface{}, error)
AddFlag adds the flag represented by PublisherFlag to the provided pflag.FlagSet. Returns the pointer to the value that can be used to retrieve the value.
func (PublisherFlag) GetFlagValue ¶
func (f PublisherFlag) GetFlagValue(fset *pflag.FlagSet) (interface{}, error)
func (PublisherFlag) ToFlagArgs ¶
func (f PublisherFlag) ToFlagArgs(flagVal interface{}) ([]string, error)
ToFlagArgs takes the input parameter (which should be the value returned by calling AddFlag for the receiver) and returns a string slice that reconstructs the flag arguments for the given flag.
type PublisherFlagName ¶
type PublisherFlagName string
type PublisherParam ¶ added in v1.0.0
type PublisherParam struct { // the raw YAML configuration for this publish operation ConfigBytes []byte }
type PublisherTypeID ¶ added in v1.0.0
type PublisherTypeID string
type RunParam ¶
type RunParam struct { // Args contain the arguments provided to the product when invoked using the "run" task. Args []string }
type TemplateFunction ¶
func GroupIDTemplateFunction ¶
func GroupIDTemplateFunction(groupID string) TemplateFunction
func PackagingTemplateFunction ¶ added in v1.8.0
func PackagingTemplateFunction(packaging string) TemplateFunction
func ProductTemplateFunction ¶
func ProductTemplateFunction(productID ProductID) TemplateFunction
func RepositoryTemplateFunction ¶
func RepositoryTemplateFunction(repository string) TemplateFunction
func TemplateValueFunction ¶
func TemplateValueFunction(key string, val interface{}) TemplateFunction
func VersionTemplateFunction ¶
func VersionTemplateFunction(version string) TemplateFunction