Ejemplo n.º 1
0
func injectEnvironmentVariables(application *model.Application, compose *model.Compose) error {
	envs, err := application.EnvironmentVariables()

	if err != nil {
		return err
	}

	compose.InjectEnvironmentVariables(envs)

	return nil
}
Ejemplo n.º 2
0
func injectBuildArgs(application *model.Application, compose *model.Compose) error {
	args, err := application.BuildArgs()

	if err != nil {
		return err
	}

	compose.InjectBuildArgs(args)

	return nil
}
Ejemplo n.º 3
0
func rotateDeployments(etcd *store.Etcd, application *model.Application, maxAppDeploy int64, dockerHost string, repositoryDir string) error {
	deployments, err := application.Deployments()

	if err != nil {
		return err
	}

	if len(deployments) == 0 || int64(len(deployments)) < maxAppDeploy {
		return nil
	}

	fmt.Println("=====> Max deploy limit reached.")

	oldestTimestamp := util.SortKeys(deployments)[0]
	oldestDeployment := model.NewDeployment(application, "", deployments[oldestTimestamp], oldestTimestamp, repositoryDir)

	fmt.Println("=====> Stop " + oldestDeployment.Revision + " ...")

	compose, err := model.NewCompose(dockerHost, oldestDeployment.ComposeFilePath, oldestDeployment.ProjectName)

	if err != nil {
		return err
	}

	if err := compose.Stop(); err != nil {
		return err
	}

	if err := application.DeleteDeployment(oldestTimestamp); err != nil {
		return err
	}

	if err := vulcand.DeregisterInformation(etcd, oldestDeployment); err != nil {
		return err
	}

	return nil
}