Exemple #1
0
func checkStatus(project *openaperture.Project) {
	auth, err := openaperture.GetAuth()
	if err != nil {
		panic(err.Error())
	}
	ticker := time.NewTicker(5 * time.Second)
	quit := make(chan struct{})
	for {
		select {
		case <-ticker.C:
			workflow, err := project.Status(auth)
			if err != nil {
				close(quit)
				fmt.Println(err.Error())
				os.Exit(1)
			} else if workflow.WorkflowError {
				close(quit)
				fmt.Println("Workflow failed")
				fmt.Println(workflow.EventLog)
				os.Exit(1)
			} else if workflow.WorkflowCompleted {
				fmt.Printf("Workflow completed in %s\n", workflow.ElapsedWorkflowTime)
				close(quit)
			} else {
				fmt.Printf("Milestone: %s in progress\n", workflow.CurrentStep)
			}
		case <-quit:
			ticker.Stop()
			os.Exit(0)
		}
	}
}
Exemple #2
0
func deploy_ecs(project *openaperture.Project) *openaperture.Project {
	operations := []string{"build", "deploy_ecs"}
	token, err := openaperture.GetAuth()
	if err != nil {
		panic(err.Error())
	}
	resp, err := project.CreateWorkflow(token, operations)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("Workflow created: %s\n", resp.Location)
	err = project.ExecuteWorkflow(token, resp.Location)
	if err != nil {
		panic(err.Error())
	}
	fmt.Println("Successfully sent deploy request")
	return project
}