func processStages()

in cmd/seeds/dataCloud/dataCloud.go [129:179]


func processStages(
	cmd *cobra.Command,
	stages []*fabric.Stage,
	varFile *fabric.VarsFile,
) {
	// Loop through the ordered collection of
	// FAST foundation and seed stages
	for _, s := range stages {

		// Get seed template parameters
		seedVars := getSeedVars(s)

		// Skip over foundation stages if destroying a pasture
		// or the `skipFast` flag has been set
		if shouldSkipStage(cmd, s) {
			continue
		}

		// Smoke test if FAST can be deployed to the current org
		if dryRun && s.Name == "0-bootstrap" {
			handleDryRun(s)
			break // exit the loop early
		}

		// Determine if we've run Pastures on this terminal before
		firstRun := handleFirstRun(s)

		// Initialize the stage
		fmt.Println("Initializing", s.Name)
		if err := s.Init(verbose); err != nil {
			fmt.Println("Failed to migrate state to remote backend")
			cobra.CheckErr(err)
		}
		fmt.Println("Configuration complete")

		// Begin stage execution
		if cmd.Parent().Name() == "destroy" {
			fmt.Println("Destroying stage:", s.Name)
			destroyStage(s, seedVars)
		} else {
			fmt.Println("Deploying stage:", s.Name)
			applyStage(s, seedVars, varFile, firstRun)
		}

		fmt.Println("Stage complete:", s.Name)

		if s.Type == "seed" && cmd.Parent().Name() == "create" {
			handleSeedStage(s)
		}
	}
}