Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Example ¶
Installation of a single exact version
ctx := context.Background() i := install.NewInstaller() defer i.Remove(ctx) v1_3 := version.Must(version.NewVersion("1.3.7")) execPath, err := i.Install(ctx, []src.Installable{ &releases.ExactVersion{ Product: product.Terraform, Version: v1_3, }, }) if err != nil { log.Fatal(err) } log.Printf("Terraform %s installed to %s", v1_3, execPath) // run any tests
Output:
Example (EnterpriseVersion) ¶
Installation of a single exact enterprise version
ctx := context.Background() i := install.NewInstaller() defer i.Remove(ctx) v1_9 := version.Must(version.NewVersion("1.9.8")) licenseDir := "/some/path" execPath, err := i.Install(ctx, []src.Installable{ &releases.ExactVersion{ Product: product.Vault, Version: v1_9, LicenseDir: licenseDir, // required for enterprise versions Enterprise: &releases.EnterpriseOptions{}, // specify that we want the enterprise version }, }) if err != nil { log.Fatal(err) } log.Printf("Vault %s Enterprise installed to %s; license information installed to %s", v1_9, execPath, licenseDir) // run any tests
Output:
Example (InstallAndBuildMultipleVersions) ¶
Installation and building of multiple versions
ctx := context.Background() i := install.NewInstaller() defer i.Remove(ctx) vc := version.MustConstraints(version.NewConstraint("~> 1.3")) rv := &releases.Versions{ Product: product.Terraform, Constraints: vc, } versions, err := rv.List(ctx) if err != nil { log.Fatal(err) } versions = append(versions, &build.GitRevision{ Product: product.Terraform, Ref: "HEAD", }) for _, installableVersion := range versions { execPath, err := i.Ensure(context.Background(), []src.Source{ installableVersion, }) if err != nil { log.Fatal(err) } log.Printf("Terraform %s installed to %s", installableVersion, execPath) // run any tests }
Output:
Example (LatestVersionConstrained) ¶
Locating or installing latest version per constraint
ctx := context.Background() i := install.NewInstaller() defer i.Remove(ctx) v1 := version.MustConstraints(version.NewConstraint("~> 1.0")) execPath, err := i.Ensure(context.Background(), []src.Source{ &fs.Version{ Product: product.Terraform, Constraints: v1, }, &releases.LatestVersion{ Product: product.Terraform, Constraints: v1, }, }) if err != nil { log.Fatal(err) } log.Printf("Terraform %s available at %s", v1, execPath) // run any tests
Output:
Example (MultipleVersions) ¶
Installation of multiple versions
ctx := context.Background() i := install.NewInstaller() defer i.Remove(ctx) v1_1 := version.Must(version.NewVersion("1.1.0")) execPath, err := i.Install(context.Background(), []src.Installable{ &releases.ExactVersion{ Product: product.Terraform, Version: v1_1, }, }) if err != nil { log.Fatal(err) } log.Printf("Terraform %s available at %s", v1_1, execPath) // run any 1.1 tests v1_3 := version.Must(version.NewVersion("1.3.0")) execPath, err = i.Install(context.Background(), []src.Installable{ &releases.ExactVersion{ Product: product.Terraform, Version: v1_3, }, }) if err != nil { log.Fatal(err) } log.Printf("Terraform %s available at %s", v1_3, execPath) // run any 1.3 tests
Output:
func NewInstaller ¶
func NewInstaller() *Installer
type RemoveFunc ¶
Click to show internal directories.
Click to hide internal directories.