2022-12-12 11:49:25 +00:00
|
|
|
package phases
|
|
|
|
|
|
|
|
import (
|
2023-05-16 16:35:39 +00:00
|
|
|
"github.com/databricks/cli/bundle"
|
|
|
|
"github.com/databricks/cli/bundle/artifacts"
|
2023-09-14 10:14:13 +00:00
|
|
|
"github.com/databricks/cli/bundle/config"
|
2023-07-30 12:44:33 +00:00
|
|
|
"github.com/databricks/cli/bundle/config/mutator"
|
2023-05-16 16:35:39 +00:00
|
|
|
"github.com/databricks/cli/bundle/deploy/files"
|
|
|
|
"github.com/databricks/cli/bundle/deploy/lock"
|
|
|
|
"github.com/databricks/cli/bundle/deploy/terraform"
|
2023-07-25 11:35:08 +00:00
|
|
|
"github.com/databricks/cli/bundle/libraries"
|
2023-08-30 12:21:39 +00:00
|
|
|
"github.com/databricks/cli/bundle/python"
|
2023-09-14 10:14:13 +00:00
|
|
|
"github.com/databricks/cli/bundle/scripts"
|
2022-12-12 11:49:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// The deploy phase deploys artifacts and resources.
|
|
|
|
func Deploy() bundle.Mutator {
|
2023-05-24 12:45:19 +00:00
|
|
|
deployMutator := bundle.Seq(
|
2023-09-14 10:14:13 +00:00
|
|
|
scripts.Execute(config.ScriptPreDeploy),
|
2023-05-16 16:01:50 +00:00
|
|
|
lock.Acquire(),
|
2023-05-24 12:45:19 +00:00
|
|
|
bundle.Defer(
|
|
|
|
bundle.Seq(
|
2023-07-30 12:44:33 +00:00
|
|
|
mutator.ValidateGitDetails(),
|
2023-07-25 11:35:08 +00:00
|
|
|
libraries.MatchWithArtifacts(),
|
|
|
|
artifacts.CleanUp(),
|
2023-05-24 12:45:19 +00:00
|
|
|
artifacts.UploadAll(),
|
2023-08-30 12:21:39 +00:00
|
|
|
python.TransformWheelTask(),
|
|
|
|
files.Upload(),
|
2023-05-24 12:45:19 +00:00
|
|
|
terraform.Interpolate(),
|
|
|
|
terraform.Write(),
|
|
|
|
terraform.StatePull(),
|
2023-07-05 14:40:40 +00:00
|
|
|
terraform.Plan(terraform.PlanGoal("deploy")),
|
2023-05-24 12:45:19 +00:00
|
|
|
terraform.Apply(),
|
|
|
|
terraform.StatePush(),
|
|
|
|
),
|
2023-06-19 13:57:25 +00:00
|
|
|
lock.Release(lock.GoalDeploy),
|
2023-05-24 12:45:19 +00:00
|
|
|
),
|
2023-09-14 10:14:13 +00:00
|
|
|
scripts.Execute(config.ScriptPostDeploy),
|
2023-05-24 12:45:19 +00:00
|
|
|
)
|
2023-05-16 16:01:50 +00:00
|
|
|
|
2022-12-12 11:49:25 +00:00
|
|
|
return newPhase(
|
|
|
|
"deploy",
|
2023-05-24 12:45:19 +00:00
|
|
|
[]bundle.Mutator{deployMutator},
|
2022-12-12 11:49:25 +00:00
|
|
|
)
|
|
|
|
}
|