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.
|
2023-06-19 10:31:07 +00:00
|
|
|
b.Config.Bundle.Lock.Force = forceDeploy
|
2023-03-22 15:37:26 +00:00
|
|
|
|
2023-05-24 12:45:19 +00:00
|
|
|
return bundle.Apply(cmd.Context(), b, bundle.Seq(
|
2022-12-12 11:49:25 +00:00
|
|
|
phases.Initialize(),
|
|
|
|
phases.Build(),
|
|
|
|
phases.Deploy(),
|
2023-05-24 12:45:19 +00:00
|
|
|
))
|
2022-12-12 11:49:25 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-06-19 10:31:07 +00:00
|
|
|
var forceDeploy bool
|
2023-03-22 15:37:26 +00:00
|
|
|
|
2022-12-12 11:49:25 +00:00
|
|
|
func init() {
|
|
|
|
AddCommand(deployCmd)
|
2023-06-19 10:31:07 +00:00
|
|
|
deployCmd.Flags().BoolVar(&forceDeploy, "force", false, "Force acquisition of deployment lock.")
|
2022-12-12 11:49:25 +00:00
|
|
|
}
|