mirror of https://github.com/databricks/cli.git
Introduce DATABRICKS_COMPUTE environment variable
This commit is contained in:
parent
48d6df3dfa
commit
27b2b77bff
|
@ -1,6 +1,8 @@
|
|||
package bundle
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/phases"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -14,17 +16,25 @@ var deployCmd = &cobra.Command{
|
|||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
b := bundle.Get(cmd.Context())
|
||||
|
||||
// If `--force` is specified, force acquisition of the deployment lock.
|
||||
b.Config.Bundle.Lock.Force = force
|
||||
|
||||
return bundle.Apply(cmd.Context(), b, bundle.Seq(
|
||||
phases.Initialize(""),
|
||||
phases.Build(),
|
||||
phases.Deploy(),
|
||||
))
|
||||
return Deploy(cmd, b)
|
||||
},
|
||||
}
|
||||
|
||||
func Deploy(cmd *cobra.Command, b *bundle.Bundle) error {
|
||||
// If `--force` is specified, force acquisition of the deployment lock.
|
||||
b.Config.Bundle.Lock.Force = force
|
||||
|
||||
if computeID == "" {
|
||||
computeID = os.Getenv("DATABRICKS_COMPUTE")
|
||||
}
|
||||
|
||||
return bundle.Apply(cmd.Context(), b, bundle.Seq(
|
||||
phases.Initialize(computeID),
|
||||
phases.Build(),
|
||||
phases.Deploy(),
|
||||
))
|
||||
}
|
||||
|
||||
var force bool
|
||||
var computeID string
|
||||
|
||||
|
|
|
@ -27,12 +27,7 @@ var runCmd = &cobra.Command{
|
|||
b := bundle.Get(cmd.Context())
|
||||
|
||||
if deploy {
|
||||
b.Config.Bundle.Lock.Force = force
|
||||
err := bundle.Apply(cmd.Context(), b, bundle.Seq(
|
||||
phases.Initialize(computeID),
|
||||
phases.Build(),
|
||||
phases.Deploy(),
|
||||
))
|
||||
err := Deploy(cmd, b)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue