feature: add chroot builder structure
This commit is contained in:
parent
6e6e518095
commit
0c47ee55e6
|
@ -0,0 +1,53 @@
|
||||||
|
// The chroot package is able to create an Outscale OMI without requiring
|
||||||
|
// the launch of a new instance for every build. It does this by attaching
|
||||||
|
// and mounting the root volume of another OMI and chrooting into that
|
||||||
|
// directory. It then creates an OMI from that attached drive.
|
||||||
|
package chroot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
osccommon "github.com/hashicorp/packer/builder/osc/common"
|
||||||
|
"github.com/hashicorp/packer/common"
|
||||||
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
|
"github.com/hashicorp/packer/packer"
|
||||||
|
"github.com/hashicorp/packer/template/interpolate"
|
||||||
|
)
|
||||||
|
|
||||||
|
// The unique ID for this builder
|
||||||
|
const BuilderId = "oapi.outscale.chroot"
|
||||||
|
|
||||||
|
// Config is the configuration that is chained through the steps and
|
||||||
|
// settable from the template.
|
||||||
|
type Config struct {
|
||||||
|
common.PackerConfig `mapstructure:",squash"`
|
||||||
|
osccommon.OMIBlockDevices `mapstructure:",squash"`
|
||||||
|
osccommon.OMIConfig `mapstructure:",squash"`
|
||||||
|
osccommon.AccessConfig `mapstructure:",squash"`
|
||||||
|
|
||||||
|
ctx interpolate.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrappedCommandTemplate struct {
|
||||||
|
Command string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Builder struct {
|
||||||
|
config Config
|
||||||
|
runner multistep.Runner
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
|
||||||
|
if runtime.GOOS != "linux" {
|
||||||
|
return nil, errors.New("The outscale-chroot builder only works on Linux environments.")
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *Builder) Cancel() {
|
||||||
|
}
|
|
@ -40,6 +40,7 @@ import (
|
||||||
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
||||||
oscbsubuilder "github.com/hashicorp/packer/builder/osc/bsu"
|
oscbsubuilder "github.com/hashicorp/packer/builder/osc/bsu"
|
||||||
oscbsusurrogatebuilder "github.com/hashicorp/packer/builder/osc/bsusurrogate"
|
oscbsusurrogatebuilder "github.com/hashicorp/packer/builder/osc/bsusurrogate"
|
||||||
|
oscchrootbuilder "github.com/hashicorp/packer/builder/osc/chroot"
|
||||||
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
||||||
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
||||||
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
||||||
|
@ -125,6 +126,7 @@ var Builders = map[string]packer.Builder{
|
||||||
"oracle-oci": new(oracleocibuilder.Builder),
|
"oracle-oci": new(oracleocibuilder.Builder),
|
||||||
"osc-bsu": new(oscbsubuilder.Builder),
|
"osc-bsu": new(oscbsubuilder.Builder),
|
||||||
"osc-bsusurrogate": new(oscbsusurrogatebuilder.Builder),
|
"osc-bsusurrogate": new(oscbsusurrogatebuilder.Builder),
|
||||||
|
"osc-chroot": new(oscchrootbuilder.Builder),
|
||||||
"parallels-iso": new(parallelsisobuilder.Builder),
|
"parallels-iso": new(parallelsisobuilder.Builder),
|
||||||
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
||||||
"profitbricks": new(profitbricksbuilder.Builder),
|
"profitbricks": new(profitbricksbuilder.Builder),
|
||||||
|
|
Loading…
Reference in New Issue