2022-12-12 11:49:25 +00:00
|
|
|
package bundle
|
|
|
|
|
|
|
|
import (
|
2023-05-16 16:35:39 +00:00
|
|
|
"github.com/databricks/cli/bundle"
|
|
|
|
"github.com/databricks/cli/bundle/phases"
|
2022-12-12 11:49:25 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var deployCmd = &cobra.Command{
|
|
|
|
Use: "deploy",
|
|
|
|
Short: "Deploy bundle",
|
|
|
|
|
2023-05-15 09:34:05 +00:00
|
|
|
PreRunE: ConfigureBundleWithVariables,
|
2022-12-12 11:49:25 +00:00
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
b := bundle.Get(cmd.Context())
|
2023-03-22 15:37:26 +00:00
|
|
|
|
|
|
|
// If `--force` is specified, force acquisition of the deployment lock.
|
|
|
|
b.Config.Bundle.Lock.Force = force
|
|
|
|
|
2022-12-12 11:49:25 +00:00
|
|
|
return bundle.Apply(cmd.Context(), b, []bundle.Mutator{
|
|
|
|
phases.Initialize(),
|
|
|
|
phases.Build(),
|
|
|
|
phases.Deploy(),
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-03-22 15:37:26 +00:00
|
|
|
var force bool
|
|
|
|
|
2022-12-12 11:49:25 +00:00
|
|
|
func init() {
|
|
|
|
AddCommand(deployCmd)
|
2023-03-22 15:37:26 +00:00
|
|
|
deployCmd.Flags().BoolVar(&force, "force", false, "Force acquisition of deployment lock.")
|
2022-12-12 11:49:25 +00:00
|
|
|
}
|