Пример #1
0
func (s *server) DoDeploy(w io.Writer, project, environment string, force bool) *DeployResult {
	start := time.Now()
	r := &DeployResult{}
	defer func() {
		r.Elapsed = time.Since(start)
	}()

	core.Info(
		"Starting deploy",
		"project", project, "environment", environment, "force", force,
	)

	p, ok := s.config.Projects[project]
	if !ok {
		core.Error("Project not found", "project", p)

		r.Errors = []error{ErrProjectNotFound}
		return r
	}

	r.Errors = p.Deploy(environment, w, force)
	if len(r.Errors) == 0 {
		r.Done = true
		core.Info("Deploy success", "project", p, "environment", environment)
	} else {
		for _, e := range r.Errors {
			core.Critical(e.Error(), "project", p, "environment", environment)
		}
	}

	return r
}
Пример #2
0
func (c *Config) mustGetEnvironment(p *core.Project, name string) *core.Environment {
	if e, ok := c.Environments[name]; ok {
		defaults.SetDefaults(e)
		e.Name = name
		return e
	}

	core.Critical("Undefined environment", "environment", name, "project", p)
	return nil
}