예제 #1
0
func (s *OptionsSuite) TestDeployOptions() {
	args := defaultArgs("--run-id", "fake-deploy-id")
	test := func(c *cli.Context) {
		opts, err := core.NewDeployOptions(util.NewCLISettings(c), emptyEnv())
		s.Nil(err)
		s.Equal("fake-deploy-id", opts.RunID)
	}
	run(s, globalFlags, pipelineFlags, test, args)
}
예제 #2
0
func (s *OptionsSuite) TestEmptyDeployOptions() {
	args := defaultArgs()
	test := func(c *cli.Context) {
		opts, err := core.NewDeployOptions(util.NewCLISettings(c), emptyEnv())
		s.Nil(err)
		s.NotEqual("", opts.DeployID)
		s.Equal(opts.DeployID, opts.PipelineID)
		s.Equal("", opts.BuildID)
	}
	run(s, globalFlags, pipelineFlags, test, args)
}
예제 #3
0
파일: main.go 프로젝트: rlugojr/wercker
			}
		},
		Flags: FlagsFor(PipelineFlagSet, WerckerInternalFlagSet),
	}

	deployCommand = cli.Command{
		Name:      "deploy",
		ShortName: "d",
		Usage:     "deploy a project",
		Action: func(c *cli.Context) {
			envfile := c.GlobalString("environment")
			_ = godotenv.Load(envfile)

			settings := util.NewCLISettings(c)
			env := util.NewEnvironment(os.Environ()...)
			opts, err := core.NewDeployOptions(settings, env)
			if err != nil {
				cliLogger.Errorln("Invalid options\n", err)
				os.Exit(1)
			}
			dockerOptions, err := dockerlocal.NewDockerOptions(settings, env)
			if err != nil {
				cliLogger.Errorln("Invalid options\n", err)
				os.Exit(1)
			}
			_, err = cmdDeploy(context.Background(), opts, dockerOptions)
			if err != nil {
				cliLogger.Fatal(err)
			}
		},
		Flags: FlagsFor(DeployPipelineFlagSet, WerckerInternalFlagSet),