-Xnew-apply to enable the new apply graph

This commit is contained in:
Mitchell Hashimoto 2016-10-15 15:08:11 -07:00
parent eb9ecea863
commit ec15783f24
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
4 changed files with 21 additions and 3 deletions

View File

@ -10,6 +10,7 @@ install:
- bash scripts/gogetcookie.sh
script:
- make test vet
- make test TEST=./terraform TESTARGS=-Xnew-apply
branches:
only:
- master

View File

@ -328,6 +328,9 @@ func (m *Meta) flagSet(n string) *flag.FlagSet {
f.Var((*FlagKVFile)(&m.autoVariables), m.autoKey, "variable file")
}
// Experimental features
f.BoolVar(&terraform.X_newApply, "Xnew-apply", false, "experiment: new apply")
// Create an io.Writer that writes to our Ui properly for errors.
// This is kind of a hack, but it does the job. Basically: create
// a pipe, use a scanner to break it into lines, and output each line

View File

@ -17,9 +17,14 @@ import (
// is called on Context.
type InputMode byte
// Variables prefixed with X_ are experimental features. They can be enabled
// by setting them to true. This should be done before any API is called.
// These should be expected to be removed at some point in the future; each
// option should mention a schedule.
var (
// NOTE: Internal only to toggle between the new and old apply graph
newApplyGraph = true
// X_newApply will enable the new apply graph. This will be removed
// and be on by default in 0.8.0.
X_newApply = false
)
const (
@ -363,7 +368,7 @@ func (c *Context) Apply() (*State, error) {
// our new graph builder.
var graph *Graph
var err error
if c.destroy || !newApplyGraph {
if c.destroy || !X_newApply {
graph, err = c.Graph(&ContextGraphOpts{Validate: true})
} else {
graph, err = (&ApplyGraphBuilder{

View File

@ -22,8 +22,17 @@ import (
const fixtureDir = "./test-fixtures"
func TestMain(m *testing.M) {
// Experimental features
xNewApply := flag.Bool("Xnew-apply", false, "Experiment: new apply graph")
flag.Parse()
// Setup experimental features
X_newApply = *xNewApply
if X_newApply {
println("Xnew-apply enabled")
}
if testing.Verbose() {
// if we're verbose, use the logging requested by TF_LOG
logging.SetOutput()