Esempio n. 1
0
func run(cmd *gocli.Command, args []string) {
	if len(args) != 0 {
		cmd.Usage()
		os.Exit(2)
	}

	app.InitOrDie()

	defer prompt.RecoverCancel()

	if _, err := commands.Stage(nil); err != nil {
		errs.Fatal(err)
	}
}
Esempio n. 2
0
func tryToStageRunningRelease() {
	stagingTask := "Try to stage the next release for acceptance"
	log.Run(stagingTask)
	_, err := commands.Stage(&commands.StageOptions{
		SkipFetch: true,
	})
	if err != nil {
		// Not terribly pretty, but it works. We just handle the known errors and continue.
		// It is ok when the release branch does not exist yet or the release cannot be staged
		// in the issue tracker.
		rootCause := errs.RootCause(err)
		if ex, ok := rootCause.(*git.ErrRefNotFound); ok {
			log.Log(fmt.Sprintf("Git reference '%v' not found, not staging any release", ex.Ref))
		} else if rootCause == common.ErrNotStageable {
			log.Log("The next release cannot be staged yet, staging canceled")
		} else {
			errs.LogError(stagingTask, err)
			log.Log("Failed to stage the next release, continuing anyway ...")
		}
	}
}