Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Consul = Product{ Name: "consul", BinaryName: func() string { if runtime.GOOS == "windows" { return "consul.exe" } return "consul" }, GetVersion: func(ctx context.Context, path string) (*version.Version, error) { cmd := exec.CommandContext(ctx, path, "version") out, err := cmd.Output() if err != nil { return nil, err } stdout := strings.TrimSpace(string(out)) submatches := consulVersionOutputRe.FindStringSubmatch(stdout) if len(submatches) != 2 { return nil, fmt.Errorf("unexpected number of version matches %d for %s", len(submatches), stdout) } v, err := version.NewVersion(submatches[1]) if err != nil { return nil, fmt.Errorf("unable to parse version %q: %w", submatches[1], err) } return v, err }, BuildInstructions: &BuildInstructions{ GitRepoURL: "https://github.com/hashicorp/consul.git", PreCloneCheck: &build.GoIsInstalled{}, Build: &build.GoBuild{}, }, }
View Source
var Nomad = Product{ Name: "nomad", BinaryName: func() string { if runtime.GOOS == "windows" { return "nomad.exe" } return "nomad" }, GetVersion: func(ctx context.Context, path string) (*version.Version, error) { cmd := exec.CommandContext(ctx, path, "version") out, err := cmd.Output() if err != nil { return nil, err } stdout := strings.TrimSpace(string(out)) submatches := nomadVersionOutputRe.FindStringSubmatch(stdout) if len(submatches) != 2 { return nil, fmt.Errorf("unexpected number of version matches %d for %s", len(submatches), stdout) } v, err := version.NewVersion(submatches[1]) if err != nil { return nil, fmt.Errorf("unable to parse version %q: %w", submatches[1], err) } return v, err }, BuildInstructions: &BuildInstructions{ GitRepoURL: "https://github.com/hashicorp/nomad.git", PreCloneCheck: &build.GoIsInstalled{}, Build: &build.GoBuild{DetectVendoring: true}, }, }
View Source
var Terraform = Product{ Name: "terraform", BinaryName: func() string { if runtime.GOOS == "windows" { return "terraform.exe" } return "terraform" }, GetVersion: func(ctx context.Context, path string) (*version.Version, error) { cmd := exec.CommandContext(ctx, path, "version") out, err := cmd.Output() if err != nil { return nil, err } stdout := strings.TrimSpace(string(out)) submatches := terraformVersionOutputRe.FindStringSubmatch(stdout) if len(submatches) != 2 { return nil, fmt.Errorf("unexpected number of version matches %d for %s", len(submatches), stdout) } v, err := version.NewVersion(submatches[1]) if err != nil { return nil, fmt.Errorf("unable to parse version %q: %w", submatches[1], err) } return v, err }, BuildInstructions: &BuildInstructions{ GitRepoURL: "https://github.com/hashicorp/terraform.git", PreCloneCheck: &build.GoIsInstalled{}, Build: &build.GoBuild{DetectVendoring: true}, }, }
View Source
var Vault = Product{ Name: "vault", BinaryName: func() string { if runtime.GOOS == "windows" { return "vault.exe" } return "vault" }, GetVersion: func(ctx context.Context, path string) (*version.Version, error) { cmd := exec.CommandContext(ctx, path, "version") out, err := cmd.Output() if err != nil { return nil, err } stdout := strings.TrimSpace(string(out)) submatches := vaultVersionOutputRe.FindStringSubmatch(stdout) if len(submatches) != 2 { return nil, fmt.Errorf("unexpected number of version matches %d for %s", len(submatches), stdout) } v, err := version.NewVersion(submatches[1]) if err != nil { return nil, fmt.Errorf("unable to parse version %q: %w", submatches[1], err) } return v, err }, BuildInstructions: &BuildInstructions{ GitRepoURL: "https://github.com/hashicorp/vault.git", PreCloneCheck: &build.GoIsInstalled{}, Build: &build.GoBuild{}, }, }
Functions ¶
This section is empty.
Types ¶
type BinaryNameFunc ¶
type BinaryNameFunc func() string
type BuildInstructions ¶
type BuildInstructions struct { GitRepoURL string // CloneTimeout overrides default timeout // for cloning the repository CloneTimeout time.Duration // PreCloneCheck represents any checks to run // prior to building, such as verifying build // dependencies (e.g. whether Go is installed) PreCloneCheck Checker // PreCloneCheckTimeout overrides default timeout // for the PreCloneCheck PreCloneCheckTimeout time.Duration // Build represents how to build the product // after checking out the source code Build Builder // BuildTimeout overrides default timeout // for the Builder BuildTimeout time.Duration }
type Product ¶
type Product struct { // Name which identifies the product // on releases.hashicorp.com and in Checkpoint Name string // BinaryName represents name of the unpacked binary to be executed or built BinaryName BinaryNameFunc // GetVersion represents how to obtain the version of the product // reflecting any output or CLI flag differences GetVersion func(ctx context.Context, execPath string) (*version.Version, error) // BuildInstructions represents how to build the product "from scratch" BuildInstructions *BuildInstructions }
Click to show internal directories.
Click to hide internal directories.