deploy.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package cmd
  2. import (
  3. "os"
  4. "github.com/fatih/color"
  5. "github.com/porter-dev/porter/cli/cmd/api"
  6. "github.com/spf13/cobra"
  7. )
  8. var app = ""
  9. // deployCmd represents the "porter deploy" base command when called
  10. // without any subcommands
  11. var deployCmd = &cobra.Command{
  12. Use: "app deploy",
  13. Short: "Builds and deploys a specified application given by the --app flag.",
  14. Run: func(cmd *cobra.Command, args []string) {
  15. err := checkLoginAndRun(args, deploy)
  16. if err != nil {
  17. os.Exit(1)
  18. }
  19. },
  20. }
  21. func init() {
  22. rootCmd.AddCommand(deployCmd)
  23. deployCmd.PersistentFlags().StringVar(
  24. &app,
  25. "app",
  26. "",
  27. "Application in the Porter dashboard",
  28. )
  29. }
  30. func deploy(_ *api.AuthCheckResponse, client *api.Client, args []string) error {
  31. color.New(color.FgGreen).Println("Deploying app:", app)
  32. return nil
  33. }
  34. // deployInit first reads the release given by the --app or the --job flag. It then
  35. // configures docker with the registries linked to the project.
  36. func deployInit(resp *api.AuthCheckResponse, client *api.Client, args []string) error {
  37. return dockerConfig(resp, client, args)
  38. }
  39. // deploySetEnv reads the build environment variables from a release and sets them using
  40. // os.SetEnv
  41. // func deploySetBuildEnv() error {
  42. // }
  43. // deployBuild uses the configuration stored in the release to
  44. // func deployBuild()