diff --git a/cmd/apply.go b/cmd/apply.go new file mode 100644 index 00000000..5db7b0c0 --- /dev/null +++ b/cmd/apply.go @@ -0,0 +1,743 @@ +package cmd + +import ( + "context" + "encoding/json" + "fmt" + "github.com/spf13/cobra" + "gopkg.in/yaml.v3" + "io/ioutil" + "log" + "os" + + "github.com/uselagoon/lagoon-cli/internal/lagoon" + "github.com/uselagoon/lagoon-cli/internal/lagoon/client" + "github.com/uselagoon/lagoon-cli/internal/schema" + "github.com/uselagoon/lagoon-cli/pkg/output" +) + +type FileConfigRoot struct { + Tasks []AdvancedTasksFileInput `json:"tasks,omitempty" yaml:"tasks,omitempty"` + Workflows []WorkflowsFileInput `json:"workflows,omitempty" yaml:"workflows,omitempty"` + Settings Settings `json:"settings,omitempty" yaml:"settings,omitempty"` +} + +type WorkflowsFileInput struct { + ID uint `json:"id,omitempty" yaml:"id,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Event string `json:"event,omitempty" yaml:"event,omitempty"` + Project string `json:"project,omitempty" yaml:"project,omitempty"` + Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` + EnvironmentID int `json:"environmentID,omitempty" yaml:"environmentID,omitempty"` + AdvancedTaskDefinition string `json:"task,omitempty" yaml:"task,omitempty"` + AdvancedTaskDefinitionID int + Target string `json:"target,omitempty" yaml:"target,omitempty"` + Cron string `json:"cron,omitempty" yaml:"cron,omitempty"` + Settings Settings `json:"settings,omitempty" yaml:"settings,omitempty"` +} + +type AdvancedTasksFileInput struct { + ID uint `json:"id,omitempty" yaml:"id,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Type schema.AdvancedTaskDefinitionType `json:"type,omitempty" yaml:"type,omitempty"` + Command string `json:"command,omitempty" yaml:"command,omitempty"` + Image string `json:"image,omitempty" yaml:"image,omitempty"` + Service string `json:"service,omitempty" yaml:"service,omitempty"` + GroupName string `json:"group,omitempty" yaml:"group,omitempty"` + Project string `json:"project,omitempty" yaml:"project,omitempty"` + Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` + EnvironmentID int `json:"environmentID,omitempty" yaml:"environmentID,omitempty"` + Permission string `json:"permission,omitempty" yaml:"permission,omitempty"` + Arguments []schema.AdvancedTaskDefinitionArgument `json:"arguments,omitempty" yaml:"arguments,omitempty"` +} + +type Settings struct { + Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` +} + +var fileName string +var debug bool + +// ApplyWorkflows Apply workflow configurations from file. +func ApplyWorkflows(lc *client.Client, workflows []WorkflowsFileInput) error { + var workflowsResult *schema.WorkflowResponse + var data []output.Data + + if len(workflows) > 0 { + for _, w := range workflows { + var hasWorkflowMatches = false + + project, err := lagoon.GetMinimalProjectByName(context.TODO(), w.Project, lc) + if err != nil { + return err + } + + // Find environment ID if given + var envID int + if len(project.Environments) > 0 && w.Environment != "" { + for _, e := range project.Environments { + if e.Name == w.Environment { + envID = int(e.ID) + } + } + } + + // Get current workflows by Environment ID + liveWorkflows, err := lagoon.GetWorkflowsByEnvironment(context.TODO(), envID, lc) + if err != nil { + return err + } + + // Match Event input string to a known Lagoon event type + eventType := matchEventToEventType(w.Event) + if eventType == "" { + return fmt.Errorf("event type did not match a Lagoon event type") + } + + // Match Advanced Task Definition string input to associated Lagoon int id. + liveAdvancedTasks, err := lagoon.GetAdvancedTasksByEnvironment(context.TODO(), envID, lc) + if err != nil { + return err + } + + if liveAdvancedTasks != nil { + for _, task := range *liveAdvancedTasks { + if task.Name == w.AdvancedTaskDefinition { + w.AdvancedTaskDefinitionID = int(task.ID) + } + } + } + + // If advanced task given does not exist inside project, then exit. + if w.AdvancedTaskDefinitionID == 0 { + fmt.Printf("task '%s' does not match one in Lagoon resource '%s', you should create it first\n", w.AdvancedTaskDefinition, w.Project) + os.Exit(1) + } + + // Check if given workflows already exists - if they do, we attempt to update them. + if liveWorkflows != nil { + for _, currWorkflow := range *liveWorkflows { + // Convert struct from file config to input the update mutation can understand + workflowInput := &schema.WorkflowInput{ + ID: currWorkflow.ID, + Name: w.Name, + Event: eventType, + AdvancedTaskDefinition: w.AdvancedTaskDefinitionID, + Project: currWorkflow.Project, + } + + encodedDiffWorkflowInput, err := json.Marshal(struct { + ID uint `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Event schema.EventType `json:"event,omitempty"` + AdvancedTaskDefinition schema.AdvancedTaskDefinitionInput `json:"advancedTaskDefinition,omitempty"` + Project int `json:"project,omitempty"` + }{ + ID: currWorkflow.ID, + Name: w.Name, + Event: eventType, + AdvancedTaskDefinition: schema.AdvancedTaskDefinitionInput{ + ID: currWorkflow.AdvancedTaskDefinition.ID, + }, + Project: currWorkflow.Project, + }) + if err != nil { + return fmt.Errorf("unable to marhsal yaml config to JSON '%v': %w", w, err) + } + + // If matched workflow exists, we diff and update + if currWorkflow.Name == workflowInput.Name { + hasWorkflowMatches = true + + diffString, diffErr := DiffPatchChangesAgainstAPI(encodedDiffWorkflowInput, currWorkflow) + if diffErr != nil { + return diffErr + } + + if diffString == "" { + log.Printf("No changes found for workflow '%s'", currWorkflow.Name) + } + + if diffString != "" { + log.Println("The following changes will be applied:\n", diffString) + if forceAction || !forceAction && yesNo(fmt.Sprintf("Are you sure you want to update '%s'", workflowInput.Name)) { + // Unset ID as it's not required for patch. + workflowInput.ID = 0 + workflowsResult, err = lagoon.UpdateWorkflow(context.TODO(), int(currWorkflow.ID), workflowInput, lc) + if err != nil { + return err + } + } + } + } else if !hasWorkflowMatches { + hasWorkflowMatches = false + } + } + } + + // If no match - we add a new one + if !hasWorkflowMatches { + if yesNo(fmt.Sprintf("You are attempting to add a new workflow '%s', are you sure?", w.Name)) { // Add TaskDefinition + workflowsResult, err = lagoon.AddWorkflow(context.TODO(), &schema.WorkflowInput{ + Name: w.Name, + Event: eventType, + Project: int(project.ID), + AdvancedTaskDefinition: w.AdvancedTaskDefinitionID, + }, lc) + if err != nil { + return err + } + fmt.Println("successfully added workflow with ID:", workflowsResult.ID) + } + } + } + } + + if workflowsResult != nil { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", workflowsResult.ID)), + returnNonEmptyString(fmt.Sprintf("%v", workflowsResult.Name)), + returnNonEmptyString(fmt.Sprintf("%v", workflowsResult.Event)), + returnNonEmptyString(fmt.Sprintf("%v", workflowsResult.Project)), + returnNonEmptyString(fmt.Sprintf("%v", workflowsResult.AdvancedTaskDefinition.ID)), + }) + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Event", + "Project", + "Advanced Task", + }, + Data: data, + }, outputOptions) + } + + return nil +} + +// ApplyAdvancedTaskDefinitions Apply advanced task definition configurations from file. +func ApplyAdvancedTaskDefinitions(lc *client.Client, tasks []AdvancedTasksFileInput) error { + var advancedTaskDefinitionResult *schema.AdvancedTaskDefinitionResponse + var data []output.Data + + // Add task definitions for each task found + if len(tasks) > 0 { + for _, t := range tasks { + var hasTaskMatches = false + + // Get project environments from name + project, err := lagoon.GetMinimalProjectByName(context.TODO(), t.Project, lc) + if err != nil { + return err + } + + // Find environment ID if given + var envID int + if len(project.Environments) > 0 && t.Environment != "" { + for _, e := range project.Environments { + if e.Name == t.Environment { + envID = int(e.ID) + } + } + } + + // Get current tasks by Environment ID + liveAdvancedTasks, err := lagoon.GetAdvancedTasksByEnvironment(context.TODO(), envID, lc) + if err != nil { + return err + } + + // Check if given task already exists + if liveAdvancedTasks != nil { + for _, currAdvTask := range *liveAdvancedTasks { + // Convert AdvancedTaskDefinitionResponse struct from file to input the update mutation can understand + advancedTaskInput := &schema.AdvancedTaskDefinitionInput{ + ID: currAdvTask.ID, + Name: t.Name, + Description: t.Description, + Type: t.Type, + Service: t.Service, + Image: t.Image, + Command: t.Command, + GroupName: t.GroupName, + Project: currAdvTask.Project, + Environment: currAdvTask.Environment, + Permission: t.Permission, + Arguments: t.Arguments, + } + + // Marshal to JSON to flip capitalisation of struct keys from yaml unmarshalling + encodedJSONTaskInput, err := json.Marshal(advancedTaskInput) + if err != nil { + return fmt.Errorf("unable to marhsal yaml config to JSON '%v': %w", t, err) + } + + // If matched task name exists, we diff and update + if currAdvTask.Name == advancedTaskInput.Name { + hasTaskMatches = true + + // Set found task argument IDs to 0 since we do not want to compare IDs. When adding or updating arguments, all existing arguments will be deleted so their IDs do not matter. + for i := range currAdvTask.Arguments { + currAdvTask.Arguments[i].ID = 0 + } + + diffString, diffErr := DiffPatchChangesAgainstAPI(encodedJSONTaskInput, currAdvTask) + if diffErr != nil { + return diffErr + } + + if diffString == "" { + log.Printf("No changes found for task '%s'", advancedTaskInput.Name) + } + + if diffString != "" { + log.Println("The following changes will be applied:\n", diffString) + if forceAction || !forceAction && yesNo(fmt.Sprintf("Are you sure you want to update '%s'", advancedTaskInput.Name)) { + // Unset task ID as it's not required for task patch. + advancedTaskInput.ID = 0 + + // Update changes + advancedTaskDefinitionResult, err = lagoon.UpdateAdvancedTaskDefinition(context.TODO(), int(currAdvTask.ID), advancedTaskInput, lc) + if err != nil { + return err + } + } + } + } else if !hasTaskMatches { + hasTaskMatches = false + } + } + } + + // If no match - we add a new one + if !hasTaskMatches { + if yesNo(fmt.Sprintf("You are attempting to add a new task '%s', are you sure?", t.Name)) { + // Add TaskDefinition + advancedTaskDefinitionResult, err = lagoon.AddAdvancedTaskDefinition(context.TODO(), &schema.AdvancedTaskDefinitionInput{ + Name: t.Name, + Description: t.Description, + Type: t.Type, + Service: t.Service, + Image: t.Image, + Command: t.Command, + GroupName: t.GroupName, + Project: int(project.ID), + Environment: t.EnvironmentID, + Permission: t.Permission, + Arguments: t.Arguments, + }, lc) + if err != nil { + return err + } + fmt.Println("successfully added task definition with ID:", advancedTaskDefinitionResult.ID) + } + } + } + } + + if advancedTaskDefinitionResult != nil { + data = append(data, []string{ + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.ID)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Name)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Description)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Type)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Service)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Image)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Command)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.GroupName)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Project)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Environment)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Permission)), + returnNonEmptyString(fmt.Sprintf("%v", advancedTaskDefinitionResult.Arguments)), + }) + output.RenderOutput(output.Table{ + Header: []string{ + "ID", + "Name", + "Description", + "Type", + "Service", + "Image", + "Command", + "GroupName", + "Project", + "Environment", + "Permission", + "Arguments", + }, + Data: data, + }, outputOptions) + } + + return nil +} + +// ReadConfigFile Checks if file exists, reads yaml config from file name and returns the config. +func ReadConfigFile(fileName string) (*FileConfigRoot, error) { + if _, err := os.Stat(fileName); err != nil { + if os.IsNotExist(err) { + log.Fatal("File does not exist") + } + } + fileConfig, err := ParseFile(fileName) + if err != nil { + return nil, fmt.Errorf("parsing config error %w", err) + } + + return fileConfig, nil +} + +// ParseFile Attempts to parse the configuration +func ParseFile(file string) (*FileConfigRoot, error) { + source, err := ioutil.ReadFile(file) + if err != nil { + return nil, fmt.Errorf("unable to read config file contents '%s': %v", file, err) + } + + // Unmarshal yaml + parsedConfig := &FileConfigRoot{} + err = yaml.Unmarshal(source, &parsedConfig) + if err != nil { + return nil, fmt.Errorf("unable to decode config in file '%s': %v", file, err) + } + + return parsedConfig, nil +} + +var viewLastApplied = &cobra.Command{ + Use: "view-last-applied", + Short: "View the latest applied configuration for project/environment.", + Long: `View the latest applied workflows or advanced task definitions for project/environment.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(cmdLagoon) + }, + RunE: func(cmd *cobra.Command, args []string) error { + fileName, err := cmd.Flags().GetString("file") + if err != nil { + return err + } + + var tasksInput []AdvancedTasksFileInput + var workflowsInput []WorkflowsFileInput + if fileName != "" { + tasksInput, err = getTasksInput(fileName) + if err != nil { + return err + } + workflowsInput, err = getWorkflowsInput(fileName) + if err != nil { + return err + } + } else { + if cmdProjectName == "" || cmdProjectEnvironment == "" { + log.Fatalln("Project name and/or environment name must be given") + } + + tasksInput = append(tasksInput, AdvancedTasksFileInput{ + Project: cmdProjectName, + Environment: cmdProjectEnvironment, + }) + workflowsInput = append(workflowsInput, WorkflowsFileInput{ + Project: cmdProjectName, + Environment: cmdProjectEnvironment, + }) + } + + if showAdvancedTasks { + err = GetLastAppliedTasksAndPrintFromInput(tasksInput) + if err != nil { + return err + } + } + + if showWorkflows { + err = GetLastAppliedWorkflowsAndPrintFromInput(workflowsInput) + if err != nil { + return err + } + } + + if !showAdvancedTasks && !showWorkflows { + err = GetLastAppliedTasksAndPrintFromInput(tasksInput) + if err != nil { + return err + } + err = GetLastAppliedWorkflowsAndPrintFromInput(workflowsInput) + if err != nil { + return err + } + } + return nil + }, +} + +func GetLastAppliedWorkflowsAndPrintFromInput(workflowsInput []WorkflowsFileInput) error { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + for _, w := range workflowsInput { + // Get project environment from name + project, err := lagoon.GetMinimalProjectByName(context.TODO(), w.Project, lc) + if err != nil { + return err + } + + if project.Environments != nil { + if len(project.Environments) > 0 && w.Environment != "" { + for _, e := range project.Environments { + if e.Name == w.Environment { + w.EnvironmentID = int(e.ID) + } + } + } + } + + // Get current advanced tasks by Environment ID + workflows, err := lagoon.GetWorkflowsByEnvironment(context.TODO(), w.EnvironmentID, lc) + if err != nil { + return err + } + + if workflows != nil { + var workflowsJSON []byte + if cmdProjectName != "" && fileName == "" { + fmt.Printf("Found workflows for '%s:%s'\n", w.Project, w.Environment) + workflowsJSON, err = json.MarshalIndent(workflows, "", " ") + if err != nil { + return err + } + + } else { + fmt.Printf("Found workflow '%s' for '%s:%s'\n", w.Name, w.Project, w.Environment) + for _, workflow := range *workflows { + if workflow.Name == w.Name { + workflowsJSON, err = json.MarshalIndent(workflow, "", " ") + if err != nil { + return err + } + } + } + } + + resultData := output.Result{ + Result: string(workflowsJSON), + } + output.RenderResult(resultData, outputOptions) + } + } + return nil +} + +func GetLastAppliedTasksAndPrintFromInput(tasksInput []AdvancedTasksFileInput) error { + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + for _, t := range tasksInput { + // Get project environment from name + project, err := lagoon.GetMinimalProjectByName(context.TODO(), t.Project, lc) + if err != nil { + return err + } + + if project.Environments != nil { + if len(project.Environments) > 0 && t.Environment != "" { + for _, e := range project.Environments { + if e.Name == t.Environment { + t.EnvironmentID = int(e.ID) + } + } + } + } + + // Get current advanced tasks by Environment ID + advancedTasks, err := lagoon.GetAdvancedTasksByEnvironment(context.TODO(), t.EnvironmentID, lc) + if err != nil { + return err + } + + if advancedTasks != nil { + var tasksJSON []byte + if cmdProjectName != "" && fileName == "" { + fmt.Printf("Found tasks for '%s:%s'\n", t.Project, t.Environment) + tasksJSON, err = json.MarshalIndent(advancedTasks, "", " ") + if err != nil { + return err + } + + } else { + fmt.Printf("Found task '%s' for '%s:%s'\n", t.Name, t.Project, t.Environment) + for _, task := range *advancedTasks { + if task.Name == t.Name { + tasksJSON, err = json.MarshalIndent(task, "", " ") + if err != nil { + return err + } + } + } + } + + resultData := output.Result{ + Result: string(tasksJSON), + } + output.RenderResult(resultData, outputOptions) + } + } + return nil +} + +func getTasksInput(fileName string) ([]AdvancedTasksFileInput, error) { + fileConfig, err := ReadConfigFile(fileName) + if err != nil { + log.Fatalln("Parsing config error:", err) + } + + // Preprocess validation + tasksInput, err := PreprocessAdvancedTaskDefinitionsInputValidation(fileConfig.Tasks) + if err != nil { + return nil, err + } + return tasksInput, nil +} + +func getWorkflowsInput(fileName string) ([]WorkflowsFileInput, error) { + fileConfig, err := ReadConfigFile(fileName) + if err != nil { + log.Fatalln("Parsing config error:", err) + } + + // Preprocess validation + workflowsInput, err := PreprocessWorkflowsInputValidation(fileConfig.Workflows) + if err != nil { + return nil, err + } + return workflowsInput, nil +} + +// setLastApplied Finds a resource match in the API and updates the configuration with local input +var setLastApplied = &cobra.Command{ + Use: "set-last-applied -f FILENAME", + Short: "Set the latest applied configuration for project/environment.", + Long: `Finds latest configuration match by workflow/task definition 'Name' and sets the latest applied workflow or advanced task definition for project/environment with the contents of file.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(cmdLagoon) + }, + RunE: func(cmd *cobra.Command, args []string) error { + fileName, err := cmd.Flags().GetString("file") + if err != nil { + return err + } + if fileName == "" { + return fmt.Errorf("no file name given to apply (pass a configuration file as 'apply set-last-applied -f [FILENAME])") + } + + tasks, err := getTasksInput(fileName) + if err != nil { + return err + } + + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + // Apply Advanced Tasks + err = ApplyAdvancedTaskDefinitions(lc, tasks) + if err != nil { + return err + } + + return nil + }, +} + +// Applies the latest configuration from a given yaml file. A file is required. +var applyCmd = &cobra.Command{ + Use: "apply", + Aliases: []string{"ap"}, + Short: "Apply the configuration of workflows or tasks from a given yaml configuration file", + Long: `Apply the configuration of workflows or tasks from a given yaml configuration file. +Workflows or advanced task definitions will be created if they do not already exist.`, + PreRunE: func(_ *cobra.Command, _ []string) error { + return validateTokenE(lagoonCLIConfig.Current) + }, + RunE: func(cmd *cobra.Command, args []string) error { + debug, err := cmd.Flags().GetBool("debug") + if err != nil { + return err + } + + fileName, err := cmd.Flags().GetString("file") + if err != nil { + return err + } + + if fileName == "" { + return fmt.Errorf("no file name given to apply (pass a configuration file as 'apply -f [FILENAME])") + } + + // Read yaml config from file + fileConfig, err := ReadConfigFile(fileName) + if err != nil { + log.Fatalln("Parsing config error:", err) + } + + // Validate input + _, err = PreprocessWorkflowsInputValidation(fileConfig.Workflows) + if err != nil { + return err + } + + _, err = PreprocessAdvancedTaskDefinitionsInputValidation(fileConfig.Tasks) + if err != nil { + return err + } + + // Create lagoon client + current := lagoonCLIConfig.Current + lc := client.New( + lagoonCLIConfig.Lagoons[current].GraphQL, + lagoonCLIConfig.Lagoons[current].Token, + lagoonCLIConfig.Lagoons[current].Version, + lagoonCLIVersion, + debug) + + // Apply Advanced Tasks first since they can be added to workflows. + err = ApplyAdvancedTaskDefinitions(lc, fileConfig.Tasks) + if err != nil { + return err + } + + // Apply Workflows + err = ApplyWorkflows(lc, fileConfig.Workflows) + if err != nil { + return err + } + + return nil + }, +} + +func init() { + applyCmd.PersistentFlags().StringP("file", "f", "", "lagoon apply (-f FILENAME) [options]") + applyCmd.MarkFlagRequired("file") + applyCmd.AddCommand(viewLastApplied) + applyCmd.AddCommand(setLastApplied) + + viewLastApplied.Flags().BoolVarP(&showAdvancedTasks, "advanced-tasks", "t", false, "Target advanced tasks only") + viewLastApplied.Flags().BoolVarP(&showWorkflows, "workflows", "w", false, "Target workflows only") +} diff --git a/cmd/apply_test.go b/cmd/apply_test.go new file mode 100644 index 00000000..2b079271 --- /dev/null +++ b/cmd/apply_test.go @@ -0,0 +1,286 @@ +package cmd + +import ( + "github.com/uselagoon/lagoon-cli/internal/lagoon/client" + "github.com/uselagoon/lagoon-cli/internal/schema" + "io" + "net/http" + "net/http/httptest" + "os" + "reflect" + "testing" +) + +func TestApplyAdvancedTaskDefinitions(t *testing.T) { + forceAction = true + type testInput struct { + in []AdvancedTasksFileInput + response string + } + var testCases = map[string]struct { + input *testInput + name string + description string + wantErr bool + }{ + "valid-tasks": { + input: &testInput{ + in: []AdvancedTasksFileInput{ + { + ID: 1, + Name: "Custom task", + Description: "A custom advanced task definition", + Type: "COMMAND", + Command: "$BIN_PATH/lagoon-cli", + Service: "cli", + GroupName: "project-high-cotton", + Project: "high-cotton", + Environment: "Master", + EnvironmentID: 3, + Permission: "DEVELOPER", + Arguments: []schema.AdvancedTaskDefinitionArgument{ + { + Name: "scan", + Type: "STRING", + }, + }, + }, + }, + response: "testdata/addAdvancedTaskResponse.json", + }, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + testServer := httptest.NewServer(http.HandlerFunc( + func(w http.ResponseWriter, _ *http.Request) { + file, err := os.Open(tt.input.response) + if err != nil { + t.Fatalf("couldn't open file: %v", err) + } + _, err = io.Copy(w, file) + if err != nil { + t.Fatalf("couldn't write file contents to HTTP: %v", err) + } + })) + defer testServer.Close() + lc := client.New(testServer.URL, "", "", "", false) + + if err := ApplyAdvancedTaskDefinitions(lc, tt.input.in); (err != nil) != tt.wantErr { + t.Errorf("ApplyAdvancedTaskDefinitions() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestApplyWorkflows(t *testing.T) { + forceAction = true + type testInput struct { + in []WorkflowsFileInput + response string + } + var testCases = map[string]struct { + input *testInput + name string + description string + wantErr bool + }{ + "valid-workflow": { + input: &testInput{ + in: []WorkflowsFileInput{ + { + ID: 1, + Name: "Teardown ephemeral environment after PR close", + Event: "GithubPRClosed", + AdvancedTaskDefinitionID: 1, + Target: "PROJECT", + Project: "high-cotton", + Environment: "Master", + Cron: "*/15 * * * *", + Settings: Settings{ + true, + }, + }, + }, + response: "testdata/addWorkflowResponse.json", + }, + description: "Check if valid workflow configuration can be applied", + wantErr: false, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + testServer := httptest.NewServer(http.HandlerFunc( + func(w http.ResponseWriter, _ *http.Request) { + file, err := os.Open(tt.input.response) + if err != nil { + t.Fatalf("couldn't open file: %v", err) + } + _, err = io.Copy(w, file) + if err != nil { + t.Fatalf("couldn't write file contents to HTTP: %v", err) + } + })) + defer testServer.Close() + lc := client.New(testServer.URL, "", "", "", false) + + if err := ApplyWorkflows(lc, tt.input.in); (err != nil) != tt.wantErr { + t.Errorf("ApplyWorkflows() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestReadConfigFile(t *testing.T) { + type testInput struct { + in string + } + var testCases = map[string]struct { + input *testInput + name string + description string + want *FileConfigRoot + wantErr bool + }{ + "valid-tasks-yaml": { + input: &testInput{ + in: "testdata/tasks.yml", + }, + wantErr: false, + want: &FileConfigRoot{ + Tasks: []AdvancedTasksFileInput{ + { + Name: "Custom Advanced Task", + Description: "A custom advanced task defined inside a yml file", + GroupName: "amazeeio", + Project: "high-cotton", + Environment: "Master", + Type: "COMMAND", + Command: "$BIN_PATH/lagoon-cli", + Service: "cli", + Permission: "DEVELOPER", + }, { + Name: "ClamAV scan", + Description: "An anti-virus scan ran from an image", + Project: "high-cotton", + Environment: "Master", + Type: "IMAGE", + Image: "uselagoon/clamav:latest", + Service: "cli", + Permission: "MAINTAINER", + Arguments: []schema.AdvancedTaskDefinitionArgument{ + { + Name: "scan", + Type: "STRING", + }, + }, + }, + }, + }, + }, + "invalid-tasks-yaml": { + input: &testInput{ + in: "testdata/tasks.yml.invalid", + }, + wantErr: true, + want: nil, + }, + "valid-workflows-yaml": { + input: &testInput{ + in: "testdata/workflows.yml", + }, + wantErr: false, + want: &FileConfigRoot{ + Workflows: []WorkflowsFileInput{ + { + Name: "Teardown ephemeral environment after PR close", + Event: "GithubPRClosed", + AdvancedTaskDefinition: "Teardown PR", + Target: "PROJECT", + Project: "high-cotton", + Environment: "Master", + }, { + Name: "Run ClamAV scan on push", + Event: "GithubPush", + AdvancedTaskDefinition: "ClamAV scan", + Target: "GROUP", + Project: "high-cotton", + Environment: "Master", + }, + }, + }, + }, + "invalid-workflows-yaml": { + input: &testInput{ + in: "testdata/workflows.yml.invalid", + }, + wantErr: true, + want: nil, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + got, err := ReadConfigFile(tt.input.in) + if (err != nil) != tt.wantErr { + t.Errorf("Reading config file error = %v, wantErr %v", err, tt.wantErr) + return + } + if err != nil && !reflect.DeepEqual(got, tt.want) { + t.Errorf("Reading config file does not match: got = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_validateTasks(t *testing.T) { + type testInput struct { + in string + } + var testCases = map[string]struct { + input *testInput + name string + description string + want string + wantErr bool + }{ + "valid-tasks-yaml": { + input: &testInput{ + in: "testdata/tasks.yml", + }, + description: "Checks to see if valid config does not return an error", + wantErr: false, + want: "", + }, + "missing-tasks-config-yaml": { + input: &testInput{ + in: "testdata/tasks.yml.missing", + }, + description: "Checks to see if invalid config throws an exception", + wantErr: true, + want: "validation checks failed", + }, + } + + for _, tt := range testCases { + config, err := ReadConfigFile(tt.input.in) + if err != nil { + t.Errorf("Reading config file error = %v", err) + return + } + + t.Run(tt.name, func(t *testing.T) { + _, err = PreprocessAdvancedTaskDefinitionsInputValidation(config.Tasks) + if (err != nil) != tt.wantErr { + t.Errorf("Validating config file error = %v, wantErr %v", err, tt.wantErr) + return + } + + if err != nil && !reflect.DeepEqual(err.Error(), tt.want) { + t.Errorf("Validating config file checks failed: got = %v, want %v", err, tt.want) + } + }) + } +} diff --git a/cmd/root.go b/cmd/root.go index 04d1cb39..dd0ef2e6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -176,6 +176,7 @@ Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}} `) rootCmd.AddCommand(addCmd) + rootCmd.AddCommand(applyCmd) rootCmd.AddCommand(configCmd) rootCmd.AddCommand(deleteCmd) rootCmd.AddCommand(deployCmd) diff --git a/cmd/shared.go b/cmd/shared.go index 12b1741d..d3c0b82b 100644 --- a/cmd/shared.go +++ b/cmd/shared.go @@ -35,6 +35,8 @@ var groupRole string var jsonPatch string var revealValue bool var listAllProjects bool +var showWorkflows bool +var showAdvancedTasks bool var noHeader bool // These are available to all cmds and are set either by flags (-p and -e) or via `lagoon-cli/app` when entering a directory that has a valid lagoon project diff --git a/cmd/testdata/addAdvancedTaskResponse.json b/cmd/testdata/addAdvancedTaskResponse.json new file mode 100644 index 00000000..790fb779 --- /dev/null +++ b/cmd/testdata/addAdvancedTaskResponse.json @@ -0,0 +1,25 @@ +{ + "data": { + "addAdvancedTaskDefinition": { + "id": 1, + "name": "Custom task", + "description": "A custom advanced task definition", + "type": "COMMAND", + "command": "$BIN_PATH/lagoon-cli", + "service": "cli", + "groupName": "project-high-cotton", + "project": 18, + "environment": 3, + "permission": "DEVELOPER", + "advancedTaskDefinitionArguments": [ + { + "id": 31, + "name": "scan", + "type": "STRING" + } + ], + "deleted": "0000-00-00 00:00:00", + "created": "2021-12-17 17:20:50" + } + } +} \ No newline at end of file diff --git a/cmd/testdata/addWorkflowResponse.json b/cmd/testdata/addWorkflowResponse.json new file mode 100644 index 00000000..d5c901f1 --- /dev/null +++ b/cmd/testdata/addWorkflowResponse.json @@ -0,0 +1,14 @@ +{ + "data": { + "addWorkflow": { + "id": 1, + "name": "Teardown ephemeral environment after PR close", + "event": "GithubPRClosed", + "project": 18, + "advancedTaskDefinition": { + "id": 1, + "name": "Custom task" + } + } + } +} \ No newline at end of file diff --git a/cmd/testdata/tasks.yml b/cmd/testdata/tasks.yml new file mode 100644 index 00000000..507722dc --- /dev/null +++ b/cmd/testdata/tasks.yml @@ -0,0 +1,21 @@ +tasks: + - name: "Custom Advanced Task" + description: "A custom advanced task defined inside a yml file" + group: "amazeeio" + project: "high-cotton" + environment: "Master" + type: "COMMAND" + command: "$BIN_PATH/lagoon-cli" + service: "cli" + permission: "DEVELOPER" + - name: "ClamAV scan" + description: "An anti-virus scan ran from an image" + project: "high-cotton" + environment: "Master" + type: "IMAGE" + image: "uselagoon/clamav:latest" + service: "cli" + permission: "MAINTAINER" + arguments: + - name: "scan" + type: "STRING" \ No newline at end of file diff --git a/cmd/testdata/tasks.yml.invalid b/cmd/testdata/tasks.yml.invalid new file mode 100644 index 00000000..532d5570 --- /dev/null +++ b/cmd/testdata/tasks.yml.invalid @@ -0,0 +1,10 @@ +tasks: + - name: "Custom Advanced Task" + description: "A custom advanced task defined inside a yml file" + group: "amazeeio" +project: "high-cotton" +environment: "Master" + type: "COMMAND" + command: "$BIN_PATH/lagoon-cli" + service: "cli" + permission: "DEVELOPER" \ No newline at end of file diff --git a/cmd/testdata/tasks.yml.missing b/cmd/testdata/tasks.yml.missing new file mode 100644 index 00000000..a19b0abe --- /dev/null +++ b/cmd/testdata/tasks.yml.missing @@ -0,0 +1,7 @@ +tasks: + - name: "Custom Advanced Task" + description: "A custom advanced task defined inside a yml file" + type: "COMMAND" + command: "$BIN_PATH/lagoon-cli" + service: "cli" + permission: "DEVELOPER" \ No newline at end of file diff --git a/cmd/testdata/tasks_response.yml b/cmd/testdata/tasks_response.yml new file mode 100644 index 00000000..43b5d951 --- /dev/null +++ b/cmd/testdata/tasks_response.yml @@ -0,0 +1,8 @@ +{ + "data": { + "addUser": { + "id": "b6d33fb6-6b7c-4144-bf90-f7ac6ec47f2e", + "email": "art@vandelayindustries.example.com" + } + } +} diff --git a/cmd/testdata/workflows.yml b/cmd/testdata/workflows.yml new file mode 100644 index 00000000..5921c2be --- /dev/null +++ b/cmd/testdata/workflows.yml @@ -0,0 +1,16 @@ +workflows: + - name: "Teardown ephemeral environment after PR close" + event: "GithubPRClosed" + task: "Custom task" + target: "PROJECT" + project: "high-cotton" + environment: "Master" + cron: "*/15 * * * *" + settings: + enabled: false + - name: "Run ClamAV scan on push" + event: "GithubPush" + task: "ClamAV scan" + target: "GROUP" + project: "high-cotton" + environment: "Master" \ No newline at end of file diff --git a/cmd/testdata/workflows.yml.invalid b/cmd/testdata/workflows.yml.invalid new file mode 100644 index 00000000..c14f5add --- /dev/null +++ b/cmd/testdata/workflows.yml.invalid @@ -0,0 +1,10 @@ +workflows: + - name: "Teardown ephemeral environment after PR close" + event: "GithubPRClosed" + task: "Custom task" + target: "PROJECT" + project: "high-cotton" + environment: "Master" + cron: "*/15 * * * *" + settings: + enabled: false \ No newline at end of file diff --git a/cmd/utils.go b/cmd/utils.go new file mode 100644 index 00000000..38835937 --- /dev/null +++ b/cmd/utils.go @@ -0,0 +1,214 @@ +package cmd + +import ( + "encoding/json" + "fmt" + "github.com/uselagoon/lagoon-cli/internal/schema" + diff "github.com/yudai/gojsondiff" + "github.com/yudai/gojsondiff/formatter" + "os" +) + +//matchEventToEventType Maps Event types from file input to event types that exist on Lagoon +func matchEventToEventType(event string) schema.EventType { + switch event { + case "DeployEnvironmentLatest": + return schema.APIDeployEnvironmentLatest + case "DeployEnvironmentBranch": + return schema.APIDeployEnvironmentBranch + case "APIDeleteEnvironment": + return schema.APIDeleteEnvironment + + case "DeployOSFinished": + return schema.DeployOSFinished + case "DeployKubernetesFinished": + return schema.DeployKubernetesFinished + case "RemoveOSFinished": + return schema.RemoveOSFinished + case "RemoveKubernetesFinished": + return schema.RemoveKubernetesFinished + + case "DeployErrorRemoveKubernetes": + return schema.DeployErrorRemoveKubernetes + case "DeployErrorRemoveOS": + return schema.DeployErrorRemoveOS + case "DeployErrorBuildDeployKubernetes": + return schema.DeployErrorBuildDeployKubernetes + case "DeployErrorBuildDeployOS": + return schema.DeployErrorBuildDeployOS + + case "GithubPush": + return schema.GithubPush + case "GithubPROpened": + return schema.GithubPROpened + case "GithubPRUpdated": + return schema.GithubPRUpdated + case "GithubPRClosed": + return schema.GithubPRClosed + case "GithubPushSkip": + return schema.GithubPushSkip + case "GithubDeleteEnvironment": + return schema.GithubDeleteEnvironment + case "GithubPRNotDeleted": + return schema.GithubPRNotDeleted + case "GithubPushNotDeleted": + return schema.GithubPushNotDeleted + + case "GitlabPush": + return schema.GitlabPush + case "GitlabPushSkip": + return schema.GitlabPushSkip + case "GitlabPROpened": + return schema.GitlabPROpened + case "GitlabPRUpdated": + return schema.GitlabPRUpdated + case "GitlabPRClosed": + return schema.GitlabPRClosed + case "GitlabDeleteEnvironment": + return schema.GitlabDeleteEnvironment + case "GitlabPushNotDeleted": + return schema.GitlabPushNotDeleted + + case "BitbucketPush": + return schema.BitbucketPush + case "BitbucketPushSkip": + return schema.BitbucketPushSkip + case "BitbucketPROpened": + return schema.BitbucketPROpened + case "BitbucketPRCreatedOpened": + return schema.BitbucketPRCreatedOpened + case "BitbucketPRUpdated": + return schema.BitbucketPRUpdated + case "BitbucketPRUpdatedOpened": + return schema.BitbucketPRUpdatedOpened + case "BitbucketPRFulfilled": + return schema.BitbucketPRFulfilled + case "BitbucketPRRejected": + return schema.BitbucketPRRejected + case "BitbucketDeleteEnvironment": + return schema.BitbucketDeleteEnvironment + case "BitbucketPushNotDeleted": + return schema.BitbucketPushNotDeleted + + default: + return "" + } +} + +// PreprocessWorkflowsInputValidation Validates input from workflow configuration file +func PreprocessWorkflowsInputValidation(workflowsInput []WorkflowsFileInput) ([]WorkflowsFileInput, error) { + var hasNonProceedableErrors = false + + if len(workflowsInput) > 0 { + for _, w := range workflowsInput { + if cmdProjectName != "" { + w.Project = cmdProjectName + } + if cmdProjectEnvironment != "" { + w.Environment = cmdProjectEnvironment + } + + if w.Name == "" { + hasNonProceedableErrors = true + fmt.Printf("Workflow 'name' is required for '%s'\n\n", w.Name) + } + if w.Project == "" { + hasNonProceedableErrors = true + fmt.Printf("'project' name is required for workflow '%s'\n\n", w.Name) + } + if w.Environment == "" { + hasNonProceedableErrors = true + fmt.Printf("An 'environment' name is required for workflow '%s'\n\n", w.Name) + } + if w.Event == "" { + hasNonProceedableErrors = true + fmt.Printf("'event' name is required for workflow '%s'\n\n", w.Name) + } else { + // find a Lagoon event type match + eventType := matchEventToEventType(w.Event) + if eventType == "" { + hasNonProceedableErrors = true + fmt.Printf("Event '%s' did not match a Lagoon event type \n\n", w.Event) + } + } + } + } + if hasNonProceedableErrors { + return nil, fmt.Errorf("validation checks failed\n") + } + return workflowsInput, nil +} + +// PreprocessAdvancedTaskDefinitionsInputValidation validates task inputs +func PreprocessAdvancedTaskDefinitionsInputValidation(tasksInput []AdvancedTasksFileInput) ([]AdvancedTasksFileInput, error) { + var hasNonProceedableErrors = false + + if len(tasksInput) > 0 { + // Check and collate each task for validation issues + for _, t := range tasksInput { + // If project or environment arguments are given, use those. + if cmdProjectName != "" { + t.Project = cmdProjectName + } + if cmdProjectEnvironment != "" { + t.Environment = cmdProjectEnvironment + } + + // Required input checks + if t.Name == "" { + hasNonProceedableErrors = true + fmt.Println("Task name is required") + } + if t.Project == "" { + hasNonProceedableErrors = true + fmt.Printf("Project name is required for task '%s'\n\n", t.Name) + } + if t.Environment == "" { + hasNonProceedableErrors = true + fmt.Printf("An Environment name is required for task '%s'\n\n", t.Name) + } + if t.Permission == "" { + hasNonProceedableErrors = true + fmt.Printf("Permission is required for task '%s'\n", t.Name) + } + } + } + if hasNonProceedableErrors { + return nil, fmt.Errorf("validation checks failed") + } + return tasksInput, nil +} + +// DiffPatchChangesAgainstAPI Diffs input config from patch against API config. +func DiffPatchChangesAgainstAPI(patchConfig []byte, apiConfig interface{}) (string, error) { + currAPIJSON, _ := json.Marshal(apiConfig) + + differ := diff.New() + d, err := differ.Compare(currAPIJSON, patchConfig) + if err != nil { + fmt.Printf("Failed to unmarshal file: %s\n", err.Error()) + os.Exit(3) + } + + if !d.Modified() { + return "", nil + } + + var aJSON map[string]interface{} + json.Unmarshal(currAPIJSON, &aJSON) + + var diffString string + config := formatter.AsciiFormatterConfig{ + ShowArrayIndex: true, + Coloring: true, + } + + formatter := formatter.NewAsciiFormatter(aJSON, config) + diffString, err = formatter.Format(d) + if err != nil { + fmt.Printf("Failed to diff config: %s\n", err.Error()) + os.Exit(3) + } + + return diffString, nil +} diff --git a/docs/commands/lagoon.md b/docs/commands/lagoon.md index d8dd2454..01ca56c9 100644 --- a/docs/commands/lagoon.md +++ b/docs/commands/lagoon.md @@ -32,6 +32,7 @@ lagoon [flags] ### SEE ALSO * [lagoon add](lagoon_add.md) - Add a project, or add notifications and variables to projects or environments +* [lagoon apply](lagoon_apply.md) - Apply the configuration of workflows or tasks from a given yaml configuration file * [lagoon config](lagoon_config.md) - Configure Lagoon CLI * [lagoon delete](lagoon_delete.md) - Delete a project, or delete notifications and variables from projects or environments * [lagoon deploy](lagoon_deploy.md) - Actions for deploying or promoting branches or environments in lagoon diff --git a/docs/commands/lagoon_apply.md b/docs/commands/lagoon_apply.md new file mode 100644 index 00000000..939cf6d5 --- /dev/null +++ b/docs/commands/lagoon_apply.md @@ -0,0 +1,45 @@ +## lagoon apply + +Apply the configuration of workflows or tasks from a given yaml configuration file + +### Synopsis + +Apply the configuration of workflows or tasks from a given yaml configuration file. +Workflows or advanced task definitions will be created if they do not already exist. + +``` +lagoon apply [flags] +``` + +### Options + +``` + -t, --advanced-tasks Target advanced tasks only + -f, --file string lagoon apply (-f FILENAME) [options] + -h, --help help for apply + -w, --workflows Target workflows only +``` + +### Options inherited from parent commands + +``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) + --debug Enable debugging output (if supported) + -e, --environment string Specify an environment to use + --force Force yes on prompts (if supported) + -l, --lagoon string The Lagoon instance to interact with + --no-header No header on table (if supported) + --output-csv Output as CSV (if supported) + --output-json Output as JSON (if supported) + --pretty Make JSON pretty (if supported) + -p, --project string Specify a project to use + --skip-update-check Skip checking for updates + -i, --ssh-key string Specify path to a specific SSH key to use for lagoon authentication +``` + +### SEE ALSO + +* [lagoon](lagoon.md) - Command line integration for Lagoon +* [lagoon apply set-last-applied](lagoon_apply_set-last-applied.md) - Set the latest applied workflows or advanced task definitions for project/environment. +* [lagoon apply view-last-applied](lagoon_apply_view-last-applied.md) - View the latest applied workflows or advanced task definitions for project/environment. + diff --git a/docs/commands/lagoon_apply_set-last-applied.md b/docs/commands/lagoon_apply_set-last-applied.md new file mode 100644 index 00000000..5602a7ac --- /dev/null +++ b/docs/commands/lagoon_apply_set-last-applied.md @@ -0,0 +1,40 @@ +## lagoon apply set-last-applied + +Set the latest applied workflows or advanced task definitions for project/environment. + +### Synopsis + +Finds latest configuration match by workflow/task definition 'Name' and sets the latest applied workflow or advanced task definition for project/environment with the contents of file. + +``` +lagoon apply set-last-applied -f FILENAME [flags] +``` + +### Options + +``` + -h, --help help for set-last-applied +``` + +### Options inherited from parent commands + +``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) + --debug Enable debugging output (if supported) + -e, --environment string Specify an environment to use + -f, --file string lagoon apply (-f FILENAME) [options] + --force Force yes on prompts (if supported) + -l, --lagoon string The Lagoon instance to interact with + --no-header No header on table (if supported) + --output-csv Output as CSV (if supported) + --output-json Output as JSON (if supported) + --pretty Make JSON pretty (if supported) + -p, --project string Specify a project to use + --skip-update-check Skip checking for updates + -i, --ssh-key string Specify path to a specific SSH key to use for lagoon authentication +``` + +### SEE ALSO + +* [lagoon apply](lagoon_apply.md) - Apply the configuration of workflows or tasks from a given yaml configuration file + diff --git a/docs/commands/lagoon_apply_view-last-applied.md b/docs/commands/lagoon_apply_view-last-applied.md new file mode 100644 index 00000000..21bcd0ae --- /dev/null +++ b/docs/commands/lagoon_apply_view-last-applied.md @@ -0,0 +1,40 @@ +## lagoon apply view-last-applied + +View the latest applied workflows or advanced task definitions for project/environment. + +### Synopsis + +View the latest applied workflows or advanced task definitions for project/environment. + +``` +lagoon apply view-last-applied [flags] +``` + +### Options + +``` + -h, --help help for view-last-applied +``` + +### Options inherited from parent commands + +``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) + --debug Enable debugging output (if supported) + -e, --environment string Specify an environment to use + -f, --file string lagoon apply (-f FILENAME) [options] + --force Force yes on prompts (if supported) + -l, --lagoon string The Lagoon instance to interact with + --no-header No header on table (if supported) + --output-csv Output as CSV (if supported) + --output-json Output as JSON (if supported) + --pretty Make JSON pretty (if supported) + -p, --project string Specify a project to use + --skip-update-check Skip checking for updates + -i, --ssh-key string Specify path to a specific SSH key to use for lagoon authentication +``` + +### SEE ALSO + +* [lagoon apply](lagoon_apply.md) - Apply the configuration of workflows or tasks from a given yaml configuration file + diff --git a/go.mod b/go.mod index de797c43..5ccce900 100644 --- a/go.mod +++ b/go.mod @@ -6,12 +6,13 @@ require ( github.com/Masterminds/semver v1.4.2 github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible - github.com/golang/mock v1.4.0 + github.com/golang/mock v1.6.0 github.com/google/go-github v0.0.0-20180716180158-c0b63e2f9bb1 github.com/google/go-querystring v1.0.0 // indirect github.com/google/uuid v1.1.1 github.com/hashicorp/go-version v1.2.0 github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc + github.com/jteeuwen/go-bindata v3.0.7+incompatible // indirect github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434 github.com/machinebox/graphql v0.2.3-0.20181106130121-3a9253180225 github.com/manifoldco/promptui v0.3.2 @@ -21,13 +22,18 @@ require ( github.com/olekukonko/tablewriter v0.0.4 github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 github.com/pkg/errors v0.8.0 // indirect + github.com/sergi/go-diff v1.2.0 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.3 - github.com/stretchr/testify v1.2.2 - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 + github.com/stretchr/testify v1.4.0 + github.com/yudai/gojsondiff v1.0.0 + github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect + golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect gopkg.in/yaml.v2 v2.2.8 + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b + rsc.io/quote/v3 v3.1.0 // indirect sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index 86ecc9d1..4b32126b 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= @@ -6,9 +7,11 @@ github.com/alecthomas/gometalinter v2.0.11+incompatible/go.mod h1:qfIpQGGz3d+Nmg github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -17,6 +20,7 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= @@ -26,6 +30,8 @@ github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3 h1:I4BOK3PBMjhWfQM2zPJ github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.4.0 h1:Rd1kQnQu0Hq3qvJppYSG0HtP+f5LPPUiDswTLiEegLg= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/google/go-github v0.0.0-20180716180158-c0b63e2f9bb1 h1:tV3a8xSFYfQgA9b54eOE0A6Db//aeD+SQWawHfhaoLs= github.com/google/go-github v0.0.0-20180716180158-c0b63e2f9bb1/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= @@ -43,10 +49,14 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc h1:4IZpk3M4m6ypx0IlRoEyEyY1gAdicWLMQ0NcG/gBnnA= github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc/go.mod h1:UlaC6ndby46IJz9m/03cZPKKkR9ykeIVBBDE3UDBdJk= +github.com/jteeuwen/go-bindata v3.0.7+incompatible h1:91Uy4d9SYVr1kyTJ15wJsog+esAZZl7JmEfTkwmhJts= +github.com/jteeuwen/go-bindata v3.0.7+incompatible/go.mod h1:JVvhzYOiGBnFSYRyV00iY8q7/0PThjIYav1p9h5dmKs= github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU= github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434 h1:im9kkmH0WWwxzegiv18gSUJbuXR9y028rXrWuPp6Jug= github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= @@ -57,6 +67,7 @@ github.com/machinebox/graphql v0.2.3-0.20181106130121-3a9253180225/go.mod h1:F+k github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/manifoldco/promptui v0.3.2 h1:rir7oByTERac6jhpHUPErHuopoRDvO3jxS+FdadEns8= github.com/manifoldco/promptui v0.3.2/go.mod h1:8JU+igZ+eeiiRku4T5BjtKh2ms8sziGpSYl1gN8Bazw= +github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -78,6 +89,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shreddedbacon/tablewriter v0.0.2-0.20200114082015-d810c4a558bf h1:4EJ9+fNa+YveELFXQp0S0usSXii8obx3f856uiD7OLk= github.com/shreddedbacon/tablewriter v0.0.2-0.20200114082015-d810c4a558bf/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -88,41 +101,75 @@ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb6 github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 h1:vY5WqiEon0ZSTGM3ayVVi+twaHKHDFUVloaQ/wug9/c= github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9/go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181122213734-04b5d21e00f1/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262 h1:qsl9y/CJx34tuA7QCPNp86JNJe4spst6Ff8MjvPUdPg= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 h1:CEBpW6C191eozfEuWdUmIAHn7lwlLxJ7HVdr2e2Tsrw= gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780/go.mod h1:3HH7i1SgMqlzxCcBmUHW657sD4Kvv9sC3HpL3YukzwA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= diff --git a/internal/lagoon/client/_lgraphql/addAdvancedTaskDefinition.graphql b/internal/lagoon/client/_lgraphql/addAdvancedTaskDefinition.graphql new file mode 100644 index 00000000..a1766881 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/addAdvancedTaskDefinition.graphql @@ -0,0 +1,59 @@ +mutation ( + $name: String, + $description: String, + $image: String, + $type: AdvancedTaskDefinitionTypes, + $service: String, + $command: String, + $environment: Int, + $project: Int, + $groupName: String, + $permission: TaskPermission, + $advancedTaskDefinitionArguments: [AdvancedTaskDefinitionArgumentInput] +) { + addAdvancedTaskDefinition(input: { + name: $name, + description: $description, + image: $image, + type: $type, + service: $service, + command: $command, + environment: $environment, + project: $project, + groupName: $groupName, + permission: $permission, + advancedTaskDefinitionArguments: $advancedTaskDefinitionArguments + }) { + ... on AdvancedTaskDefinitionCommand { + id + name + type + command + created + service + project + groupName + permission + environment + description + } + ... on AdvancedTaskDefinitionImage { + id + name + type + image + created + service + project + groupName + permission + environment + description + advancedTaskDefinitionArguments { + id + name + type + } + } + } + } diff --git a/internal/lagoon/client/_lgraphql/addWorkflow.graphql b/internal/lagoon/client/_lgraphql/addWorkflow.graphql new file mode 100644 index 00000000..9bc449ad --- /dev/null +++ b/internal/lagoon/client/_lgraphql/addWorkflow.graphql @@ -0,0 +1,28 @@ +mutation ( + $name: String, + $event: String, + $project: Int, + $advancedTaskDefinition: Int +) { + addWorkflow(input: { + name: $name, + event: $event, + project: $project, + advancedTaskDefinition: $advancedTaskDefinition + }) { + id + name + event + project + advancedTaskDefinition { + ... on AdvancedTaskDefinitionImage { + id + name + } + ... on AdvancedTaskDefinitionCommand { + id + name + } + } + } +} diff --git a/internal/lagoon/client/_lgraphql/advancedTasksForEnvironment.graphql b/internal/lagoon/client/_lgraphql/advancedTasksForEnvironment.graphql new file mode 100644 index 00000000..1740f058 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/advancedTasksForEnvironment.graphql @@ -0,0 +1,33 @@ +query advancedTasksForEnvironment($environment: Int!) { + advancedTasksForEnvironment(environment: $environment) { + ... on AdvancedTaskDefinitionCommand { + id + name + description + type + service + command + groupName + environment + project + permission + } + ... on AdvancedTaskDefinitionImage { + id + name + description + type + image + service + groupName + environment + project + permission + advancedTaskDefinitionArguments { + id + name + type + } + } + } +} diff --git a/internal/lagoon/client/_lgraphql/environmentByName.graphql b/internal/lagoon/client/_lgraphql/environmentByName.graphql index bc0ebfc3..ef27dab5 100644 --- a/internal/lagoon/client/_lgraphql/environmentByName.graphql +++ b/internal/lagoon/client/_lgraphql/environmentByName.graphql @@ -1,19 +1,19 @@ query ( $name: String!, $project: Int!) { - environmentByName( - name: $name, - project: $project) - { - id - name - route - routes - deployType - environmentType - openshiftProjectName - updated - created - deleted - } + environmentByName( + name: $name, + project: $project) + { + id + name + route + routes + deployType + environmentType + openshiftProjectName + updated + created + deleted } +} \ No newline at end of file diff --git a/internal/lagoon/client/_lgraphql/getTaskDefinitionByID.graphql b/internal/lagoon/client/_lgraphql/getTaskDefinitionByID.graphql new file mode 100644 index 00000000..019b673c --- /dev/null +++ b/internal/lagoon/client/_lgraphql/getTaskDefinitionByID.graphql @@ -0,0 +1,31 @@ +query ($id: Int!) { + advancedTaskDefinitionById(id: $id) { + ... on AdvancedTaskDefinitionImage { + id + name + description + type + image + created + service + groupName + project + environment + permission + } + + ... on AdvancedTaskDefinitionCommand { + id + name + description + type + command + created + service + groupName + project + environment + permission + } + } +} diff --git a/internal/lagoon/client/_lgraphql/minimalProjectByName.graphql b/internal/lagoon/client/_lgraphql/minimalProjectByName.graphql index 3686004d..0340db06 100644 --- a/internal/lagoon/client/_lgraphql/minimalProjectByName.graphql +++ b/internal/lagoon/client/_lgraphql/minimalProjectByName.graphql @@ -16,8 +16,12 @@ query ( developmentEnvironmentsLimit gitUrl autoIdle - openshift{ + openshift { id } + environments { + id + name + } } } diff --git a/internal/lagoon/client/_lgraphql/updateAdvancedTaskDefinition.graphql b/internal/lagoon/client/_lgraphql/updateAdvancedTaskDefinition.graphql new file mode 100644 index 00000000..3805cd9d --- /dev/null +++ b/internal/lagoon/client/_lgraphql/updateAdvancedTaskDefinition.graphql @@ -0,0 +1,39 @@ +mutation ( + $id: Int!, + $patch: UpdateAdvancedTaskDefinitionPatchInput!, +){ + updateAdvancedTaskDefinition( + input: { + id: $id + patch: $patch + } + ){ + ... on AdvancedTaskDefinitionCommand { + id + name + description + type + service + command + groupName + project + environment + } + ... on AdvancedTaskDefinitionImage { + id + name + description + type + service + image + groupName + project + environment + advancedTaskDefinitionArguments { + id + name + type + } + } + } +} diff --git a/internal/lagoon/client/_lgraphql/updateWorkflow.graphql b/internal/lagoon/client/_lgraphql/updateWorkflow.graphql new file mode 100644 index 00000000..c8b09da2 --- /dev/null +++ b/internal/lagoon/client/_lgraphql/updateWorkflow.graphql @@ -0,0 +1,24 @@ +mutation ( + $id: Int!, + $patch: UpdateWorkflowPatchInput!, +){ + updateWorkflow( + input: { + id: $id + patch: $patch + } + ){ + id + name + event + project + advancedTaskDefinition { + ... on AdvancedTaskDefinitionImage { + id + } + ... on AdvancedTaskDefinitionCommand { + id + } + } + } +} diff --git a/internal/lagoon/client/_lgraphql/workflowsForEnvironment.graphql b/internal/lagoon/client/_lgraphql/workflowsForEnvironment.graphql new file mode 100644 index 00000000..84fe991f --- /dev/null +++ b/internal/lagoon/client/_lgraphql/workflowsForEnvironment.graphql @@ -0,0 +1,16 @@ +query workflowsForEnvironment($environment: Int!) { + workflowsForEnvironment(environment: $environment) { + id + name + event + project + advancedTaskDefinition { + ... on AdvancedTaskDefinitionCommand { + id + } + ... on AdvancedTaskDefinitionImage { + id + } + } + } +} diff --git a/internal/lagoon/client/lgraphql/lgraphql.go b/internal/lagoon/client/lgraphql/lgraphql.go index 474522d5..a8a5c672 100644 --- a/internal/lagoon/client/lgraphql/lgraphql.go +++ b/internal/lagoon/client/lgraphql/lgraphql.go @@ -1,42 +1,50 @@ -// Code generated by go-bindata. (@generated) DO NOT EDIT. - -//Package lgraphql generated by go-bindata.// sources: -// _lgraphql/addBillingGroup.graphql -// _lgraphql/addEnvVariable.graphql -// _lgraphql/addGroup.graphql -// _lgraphql/addGroupsToProject.graphql -// _lgraphql/addNotificationEmail.graphql -// _lgraphql/addNotificationMicrosoftTeams.graphql -// _lgraphql/addNotificationRocketChat.graphql -// _lgraphql/addNotificationSlack.graphql -// _lgraphql/addNotificationToProject.graphql -// _lgraphql/addOrUpdateEnvironment.graphql -// _lgraphql/addProject.graphql -// _lgraphql/addProjectToBillingGroup.graphql -// _lgraphql/addSshKey.graphql -// _lgraphql/addUser.graphql -// _lgraphql/addUserToGroup.graphql -// _lgraphql/deployEnvironmentBranch.graphql -// _lgraphql/deployEnvironmentLatest.graphql -// _lgraphql/deployEnvironmentPromote.graphql -// _lgraphql/deployEnvironmentPullrequest.graphql -// _lgraphql/environmentByName.graphql -// _lgraphql/lagoonSchema.graphql -// _lgraphql/lagoonVersion.graphql -// _lgraphql/me.graphql -// _lgraphql/minimalProjectByName.graphql -// _lgraphql/projectByName.graphql -// _lgraphql/projectByNameMetadata.graphql -// _lgraphql/projectsByMetadata.graphql -// _lgraphql/removeProjectMetadataByKey.graphql -// _lgraphql/switchActiveStandby.graphql -// _lgraphql/taskByID.graphql -// _lgraphql/updateProjectMetadata.graphql +// Code generated by go-bindata. DO NOT EDIT. +// sources: +// _lgraphql/addAdvancedTaskDefinition.graphql (1.26kB) +// _lgraphql/addBillingGroup.graphql (237B) +// _lgraphql/addEnvVariable.graphql (292B) +// _lgraphql/addGroup.graphql (110B) +// _lgraphql/addGroupsToProject.graphql (184B) +// _lgraphql/addNotificationEmail.graphql (183B) +// _lgraphql/addNotificationMicrosoftTeams.graphql (177B) +// _lgraphql/addNotificationRocketChat.graphql (219B) +// _lgraphql/addNotificationSlack.graphql (214B) +// _lgraphql/addNotificationToProject.graphql (289B) +// _lgraphql/addOrUpdateEnvironment.graphql (566B) +// _lgraphql/addProject.graphql (1.123kB) +// _lgraphql/addProjectToBillingGroup.graphql (185B) +// _lgraphql/addSshKey.graphql (279B) +// _lgraphql/addUser.graphql (254B) +// _lgraphql/addUserToGroup.graphql (243B) +// _lgraphql/addWorkflow.graphql (470B) +// _lgraphql/advancedTasksForEnvironment.graphql (760B) +// _lgraphql/deployEnvironmentBranch.graphql (227B) +// _lgraphql/deployEnvironmentLatest.graphql (128B) +// _lgraphql/deployEnvironmentPromote.graphql (372B) +// _lgraphql/deployEnvironmentPullrequest.graphql (454B) +// _lgraphql/environmentByName.graphql (249B) +// _lgraphql/getTaskDefinitionByID.graphql (473B) +// _lgraphql/lagoonSchema.graphql (126B) +// _lgraphql/lagoonVersion.graphql (25B) +// _lgraphql/me.graphql (232B) +// _lgraphql/minimalProjectByName.graphql (505B) +// _lgraphql/projectByName.graphql (2.062kB) +// _lgraphql/projectByNameMetadata.graphql (121B) +// _lgraphql/projectsByMetadata.graphql (597B) +// _lgraphql/removeProjectMetadataByKey.graphql (254B) +// _lgraphql/switchActiveStandby.graphql (198B) +// _lgraphql/taskByID.graphql (216B) +// _lgraphql/updateAdvancedTaskDefinition.graphql (793B) +// _lgraphql/updateProjectMetadata.graphql (337B) +// _lgraphql/updateWorkflow.graphql (439B) +// _lgraphql/workflowsForEnvironment.graphql (380B) + package lgraphql import ( "bytes" "compress/gzip" + "crypto/sha256" "fmt" "io" "io/ioutil" @@ -49,7 +57,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %w", name, err) } var buf bytes.Buffer @@ -57,7 +65,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %w", name, err) } if clErr != nil { return nil, err @@ -67,8 +75,9 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo + bytes []byte + info os.FileInfo + digest [sha256.Size]byte } type bindataFileInfo struct { @@ -78,36 +87,45 @@ type bindataFileInfo struct { modTime time.Time } -// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } - -// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } - -// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } - -// ModTime return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } - -// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 + return false } - -// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } +var __lgraphqlAddadvancedtaskdefinitionGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x92\xbd\x6a\x2b\x31\x10\x85\xfb\x7d\x8a\x29\x6e\x61\x83\xf1\x03\x6c\x67\x6e\x1a\x37\x21\x10\x77\x21\x85\x58\x4d\x16\x25\xe8\x07\x49\x6b\x30\x61\xdf\x3d\x48\xab\x99\x95\x8c\x83\x93\x2e\x8d\xf1\x9c\x39\xb2\xe7\x7c\x33\x7a\x8a\x22\x2a\x6b\x60\xd3\x01\xfc\x33\x42\x63\x0f\xcf\xd1\x2b\x33\xee\x92\x20\x31\x0c\x5e\xb9\xe4\x68\x74\xa5\xc5\xd8\x3a\xe3\xc5\x61\x0f\x07\x79\x16\x66\x40\x79\x12\xe1\xe3\x01\xdf\x94\x51\xe9\xe9\xe9\xe2\x30\x64\x57\x40\x7f\x56\x43\xfb\x72\xb0\x5a\x0b\x23\x1b\x0d\xcd\x59\x79\x6b\x34\x9a\xd8\xc3\xd1\xc4\x2c\x3a\x6f\xdf\x71\xa8\x84\xd1\xdb\xc9\x3d\x5e\xcf\xec\xd0\x6b\x15\x42\x1e\x39\xcd\xf1\xc4\x75\x6e\x8b\x9b\x23\x1e\xfc\x38\xa5\x7f\x0b\x3d\xbc\xdc\x0e\x41\x8e\xa3\x71\x53\x7c\xed\xb6\xf0\xd9\x01\x00\x08\x29\x6f\xfb\x37\x2a\x19\xfb\x62\x03\x58\xd8\x66\xc4\xbb\x22\x35\x74\x6b\xd6\x64\x28\x98\x17\xdc\x24\x2e\xa4\x33\x70\x92\x18\x2b\x01\xa6\x06\xb3\x25\xca\xd4\x68\x00\xd7\xb8\xc9\xc0\xb0\x09\x3b\x35\x2a\xe8\xeb\x02\xf8\x55\xc5\xbe\x5a\x04\xb5\xef\xb2\xbf\xb7\x9d\xfc\x3b\xf3\x96\xa1\xee\xf7\x7b\xb0\xe6\x9b\xb3\xfb\xbf\x44\x66\x33\x80\x92\xfc\x35\xed\x81\x8b\xc4\x92\x8b\x42\x6a\xad\x3d\x8a\x88\x6b\x5d\x10\x73\x5d\xf8\x70\xcd\x50\x56\x07\x83\x60\xa9\x22\xce\x5a\x75\x00\x45\x9b\x7f\x12\xf3\x98\x8e\xe3\xb7\x21\xf3\x45\xfd\x85\x88\x77\x8f\xa2\x4a\xd6\x64\xbb\x4a\x77\x95\x6f\x6e\x08\xa6\xcf\xb9\xfb\x0a\x00\x00\xff\xff\x2a\x01\x6c\x99\xec\x04\x00\x00") + +func _lgraphqlAddadvancedtaskdefinitionGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlAddadvancedtaskdefinitionGraphql, + "_lgraphql/addAdvancedTaskDefinition.graphql", + ) +} + +func _lgraphqlAddadvancedtaskdefinitionGraphql() (*asset, error) { + bytes, err := _lgraphqlAddadvancedtaskdefinitionGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/addAdvancedTaskDefinition.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcd, 0xcf, 0x8, 0x24, 0x4a, 0xae, 0x38, 0xb, 0x68, 0xbd, 0xc7, 0xb3, 0x9d, 0x73, 0x69, 0x22, 0x54, 0x39, 0xbf, 0xd0, 0x11, 0xf4, 0xd6, 0xb1, 0x83, 0x7b, 0x91, 0xc4, 0xa7, 0x4, 0x2, 0xa6}} + return a, nil +} + var __lgraphqlAddbillinggroupGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xca\x2d\x2d\x49\x2c\xc9\xcc\xcf\x53\xd0\xe0\x52\x50\x50\xc9\x4b\xcc\x4d\xb5\x52\x08\x2e\x29\xca\xcc\x4b\x57\xd4\x01\x89\x24\x97\x16\x15\xa5\xe6\x25\x57\x5a\x29\x38\x43\x59\x10\xf1\xa4\xcc\x9c\x9c\xcc\xbc\xf4\xe0\xfc\xb4\x92\xf2\xc4\x22\xb8\x26\x4d\x85\x6a\x2e\x05\x05\x05\x85\xc4\x94\x14\x27\x88\x0a\xf7\xa2\xfc\xd2\x02\x8d\xcc\xbc\x82\xd2\x12\x2b\xa8\xa4\x82\x02\xc4\x1e\xb0\x75\x3a\x50\x21\x84\x45\x70\x3b\x61\x52\x18\x76\xa1\xdb\x0e\x56\x57\xab\x09\x37\x3e\x33\x05\xc9\x1e\x88\x24\x17\x08\x03\x02\x00\x00\xff\xff\x90\xae\x83\xc3\xed\x00\x00\x00") func _lgraphqlAddbillinggroupGraphqlBytes() ([]byte, error) { @@ -124,7 +142,7 @@ func _lgraphqlAddbillinggroupGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addBillingGroup.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb, 0xe9, 0xf5, 0xc1, 0xd1, 0xa5, 0xa6, 0x4, 0x10, 0xc5, 0x8, 0xdc, 0x2f, 0xd7, 0xdd, 0xd, 0x72, 0xbb, 0xc1, 0xac, 0x96, 0xf5, 0x21, 0xd5, 0xa1, 0xc2, 0x22, 0x78, 0x2d, 0x7a, 0x75, 0x98}} return a, nil } @@ -144,7 +162,7 @@ func _lgraphqlAddenvvariableGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addEnvVariable.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa4, 0xdf, 0xcc, 0xed, 0x24, 0x54, 0xb9, 0xf9, 0xe9, 0x47, 0xac, 0x18, 0xd2, 0xd4, 0x34, 0x44, 0x55, 0x2b, 0x61, 0x38, 0xb4, 0xbb, 0x34, 0x48, 0x3d, 0xa8, 0xaf, 0xfa, 0x11, 0x11, 0x22, 0xf3}} return a, nil } @@ -164,7 +182,7 @@ func _lgraphqlAddgroupGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addGroup.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x26, 0xa3, 0x90, 0xe9, 0x6a, 0x92, 0x6f, 0x20, 0x1a, 0x31, 0x4b, 0x59, 0xd1, 0xd, 0x8a, 0x7a, 0x48, 0xa0, 0xa3, 0x83, 0x94, 0xf9, 0xc2, 0xae, 0x2e, 0x70, 0x6d, 0xad, 0x63, 0xf6, 0x97}} return a, nil } @@ -184,7 +202,7 @@ func _lgraphqlAddgroupstoprojectGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addGroupsToProject.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbd, 0x87, 0xa7, 0x9e, 0x69, 0x59, 0xa2, 0x82, 0x97, 0xff, 0x4b, 0x84, 0xf, 0x3e, 0x87, 0x6c, 0xb5, 0xa4, 0x4e, 0x2, 0x7f, 0x58, 0x6b, 0x69, 0x45, 0x9, 0xe2, 0x53, 0x6, 0xc9, 0xa1, 0xac}} return a, nil } @@ -204,7 +222,7 @@ func _lgraphqlAddnotificationemailGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addNotificationEmail.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6, 0x8d, 0xcc, 0x2d, 0x55, 0xe4, 0xe2, 0x6d, 0x59, 0x6b, 0x9a, 0xe9, 0x33, 0xad, 0x32, 0x3d, 0x2a, 0x8b, 0xe6, 0x36, 0x6d, 0x82, 0x6d, 0x57, 0x1d, 0x38, 0x7a, 0x61, 0xdd, 0x7, 0xae, 0xb5}} return a, nil } @@ -224,7 +242,7 @@ func _lgraphqlAddnotificationmicrosoftteamsGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addNotificationMicrosoftTeams.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x38, 0x57, 0x95, 0x3f, 0x2d, 0xec, 0x3d, 0x39, 0x8b, 0xf0, 0x86, 0x71, 0x13, 0xe9, 0x11, 0x57, 0x16, 0x27, 0x9c, 0x57, 0x8d, 0x96, 0xfc, 0xf0, 0x6, 0xce, 0xe1, 0x63, 0x5d, 0x40, 0x13, 0xfe}} return a, nil } @@ -244,7 +262,7 @@ func _lgraphqlAddnotificationrocketchatGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addNotificationRocketChat.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x78, 0x1, 0x8, 0x7d, 0xb2, 0x2c, 0x6d, 0xf8, 0xa7, 0xa4, 0xec, 0xe0, 0x6d, 0x4c, 0x2a, 0x43, 0x69, 0xbf, 0xe1, 0x6a, 0xa6, 0x3a, 0x51, 0x58, 0x2e, 0xb0, 0xf9, 0x24, 0x50, 0xc, 0xef, 0xba}} return a, nil } @@ -264,7 +282,7 @@ func _lgraphqlAddnotificationslackGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addNotificationSlack.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf2, 0xd4, 0x90, 0x44, 0x41, 0x48, 0x21, 0xe7, 0x30, 0x6b, 0x0, 0xed, 0x73, 0x6c, 0x1, 0xd, 0xdb, 0xb, 0x83, 0x2, 0x31, 0x7d, 0x79, 0xea, 0xce, 0x87, 0x37, 0x10, 0x4d, 0x1e, 0xfe, 0x3a}} return a, nil } @@ -284,7 +302,7 @@ func _lgraphqlAddnotificationtoprojectGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addNotificationToProject.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x44, 0x34, 0x3f, 0x65, 0x51, 0xda, 0x1b, 0xe9, 0xd3, 0x3c, 0xbe, 0x8b, 0x47, 0x7, 0x43, 0xfa, 0x61, 0xba, 0x8d, 0x95, 0x2d, 0xdc, 0xda, 0x47, 0x7a, 0x1f, 0xa7, 0xa3, 0xd4, 0x27, 0xaa, 0x75}} return a, nil } @@ -304,7 +322,7 @@ func _lgraphqlAddorupdateenvironmentGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addOrUpdateEnvironment.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9b, 0xa1, 0xe4, 0x5f, 0x61, 0x1e, 0xc1, 0xe, 0x16, 0xa5, 0xbd, 0x25, 0x26, 0x8a, 0x99, 0x77, 0x62, 0x77, 0xb1, 0x9b, 0xa, 0xe8, 0xe4, 0xd1, 0xa7, 0xb9, 0x28, 0xde, 0x9a, 0x88, 0x30, 0xec}} return a, nil } @@ -324,7 +342,7 @@ func _lgraphqlAddprojectGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addProject.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x56, 0xf2, 0xc5, 0xea, 0x42, 0xef, 0x3a, 0x23, 0x31, 0x22, 0xb6, 0x88, 0x29, 0xdb, 0x91, 0xe3, 0x5c, 0x88, 0x89, 0xe2, 0x9e, 0x8b, 0x5e, 0xae, 0x70, 0xc3, 0x3a, 0x1d, 0x3b, 0x8e, 0xba, 0x92}} return a, nil } @@ -344,7 +362,7 @@ func _lgraphqlAddprojecttobillinggroupGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addProjectToBillingGroup.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd9, 0x50, 0x46, 0x42, 0xa1, 0xc1, 0xa7, 0x2b, 0x4e, 0xc8, 0x8b, 0xd, 0x56, 0x2c, 0xc2, 0xf7, 0x7a, 0x4b, 0x50, 0x3f, 0xe4, 0xa1, 0x7, 0x3a, 0x52, 0x6c, 0x9f, 0xc2, 0x85, 0x97, 0x5e, 0x98}} return a, nil } @@ -364,7 +382,7 @@ func _lgraphqlAddsshkeyGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addSshKey.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x82, 0xea, 0xa0, 0xea, 0xaf, 0x19, 0xca, 0xeb, 0x1c, 0x4d, 0x51, 0x9f, 0x9a, 0xb7, 0x86, 0xc8, 0x29, 0x48, 0xa9, 0x6c, 0x3, 0x4a, 0x70, 0x77, 0xa, 0x79, 0x3, 0x16, 0x56, 0x99, 0xba, 0x29}} return a, nil } @@ -384,7 +402,7 @@ func _lgraphqlAdduserGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addUser.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x33, 0x99, 0xcc, 0x6c, 0xa, 0x18, 0x88, 0x14, 0x92, 0xc5, 0x0, 0xbc, 0xc2, 0xb4, 0xc1, 0xa7, 0x3f, 0x87, 0xc0, 0x67, 0x13, 0xcc, 0xb7, 0xca, 0xec, 0xde, 0xdf, 0x93, 0x61, 0x6a, 0x4d, 0xe0}} return a, nil } @@ -404,7 +422,47 @@ func _lgraphqlAddusertogroupGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/addUserToGroup.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x51, 0xb1, 0xe3, 0xcf, 0x2, 0xfa, 0x37, 0x3c, 0xfb, 0x73, 0x93, 0xf9, 0x16, 0xd4, 0x56, 0x41, 0x23, 0x54, 0x4e, 0x12, 0xc9, 0xda, 0xab, 0x6d, 0x85, 0x14, 0x75, 0xb9, 0xba, 0xc5, 0xd4, 0x46}} + return a, nil +} + +var __lgraphqlAddworkflowGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\xce\xb1\x6e\x83\x30\x14\x85\xe1\xdd\x4f\x71\x86\x0e\x20\x21\x1e\x80\xad\x6a\x17\xe6\x56\xea\x7c\x85\x0d\x72\x89\xaf\x11\x31\x64\x88\xfc\xee\x11\x36\x71\x82\x14\x22\x16\x86\x9f\xab\xf3\xd9\x4c\x8e\x9c\xb6\x8c\x4c\x00\x1f\x4c\x46\x55\xf8\x71\xa3\xe6\xae\x58\x82\x9a\x15\xbb\x4d\x19\x46\xfb\xaf\x1a\x57\xa1\x66\x17\x02\xc9\x99\xb8\x51\xf2\x97\xce\xfd\xb7\x6a\x35\xeb\x65\x2f\xfc\x17\x39\xae\x02\x20\x29\xff\xec\xd8\xb7\x27\x7b\xc9\x34\x0f\x93\xab\x42\x06\x22\x17\xd4\x22\x84\x95\x8b\x6c\x4c\xc9\xbb\xcb\x31\xef\xa9\x3b\xcf\x11\x80\xcf\x57\x55\xcb\x84\x3f\xd0\x67\xeb\x0d\xb0\x4e\x00\x65\x59\xc2\x32\x3e\x5f\x5e\xd5\x86\x3a\x95\x4e\x93\xb8\x51\x01\x7f\x64\xea\xcb\x1a\x43\x2c\x0f\x8e\x2d\x5f\x2f\xbc\xb8\x05\x00\x00\xff\xff\x51\x5d\x66\xc3\xd6\x01\x00\x00") + +func _lgraphqlAddworkflowGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlAddworkflowGraphql, + "_lgraphql/addWorkflow.graphql", + ) +} + +func _lgraphqlAddworkflowGraphql() (*asset, error) { + bytes, err := _lgraphqlAddworkflowGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/addWorkflow.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2e, 0xcc, 0x1e, 0x29, 0x68, 0x37, 0x4c, 0x5, 0xa2, 0xe1, 0x3e, 0xf8, 0x34, 0x33, 0x30, 0x31, 0x86, 0x47, 0x34, 0xe8, 0x3c, 0x65, 0x38, 0x33, 0x74, 0xb5, 0xc, 0xbf, 0x6, 0x71, 0xb6, 0x74}} + return a, nil +} + +var __lgraphqlAdvancedtasksforenvironmentGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x92\x4d\x4a\x07\x31\x0c\xc5\xf7\x73\x8a\x08\x2e\x74\x33\x07\x70\xf7\xc7\x0f\x98\x8d\x2b\x2f\x50\xda\x38\x44\x69\x5a\xd3\xce\xc0\x20\xbd\xbb\x14\x91\x69\xca\xa0\x6e\x26\xbb\x3c\x92\x97\xfe\x1e\xfd\x58\x50\x36\x30\x6e\x35\x6c\xd1\xbd\x98\xf4\x9e\x9e\x82\x3c\xf2\x4a\x12\xd8\x23\xe7\x9b\x6b\xdc\x9b\x3b\x98\x38\x5f\xdd\xc2\xe7\x00\x00\xbf\x6e\xa9\xa5\xd6\xe2\x67\xb9\xd6\x38\x8e\x10\x18\x2e\x8d\xcf\x03\xbe\x12\x53\xa6\xc0\xf7\xc1\x7b\xc3\xae\x19\xaf\x45\x4e\xb5\x6c\x3c\x2a\xc1\x61\xb2\x42\xb1\x1a\x28\x3d\x6f\x51\x0f\x26\x94\x95\xac\xd6\xec\xf7\x49\xa5\xcd\x12\x96\xf8\xdc\x9f\x69\x80\x94\x1e\x25\xbc\xa1\xed\x34\x14\x4f\x29\xb5\x2f\x2a\xff\x8b\x60\xf2\x66\xc6\xb3\x02\xa0\x6a\xfe\x67\x24\xa7\xe0\x43\xf7\x79\x76\xe2\x8b\xcc\x4b\x75\x4d\x1d\xf5\x01\xf9\x21\xfd\x21\x69\xe9\x72\x2f\x43\x19\xbe\x02\x00\x00\xff\xff\x51\xb6\x8b\x84\xf8\x02\x00\x00") + +func _lgraphqlAdvancedtasksforenvironmentGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlAdvancedtasksforenvironmentGraphql, + "_lgraphql/advancedTasksForEnvironment.graphql", + ) +} + +func _lgraphqlAdvancedtasksforenvironmentGraphql() (*asset, error) { + bytes, err := _lgraphqlAdvancedtasksforenvironmentGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/advancedTasksForEnvironment.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x50, 0x2d, 0x7, 0x9e, 0xb7, 0x5, 0xc4, 0x1e, 0xb, 0xfa, 0xb5, 0x8f, 0x43, 0xea, 0x6a, 0xea, 0x8f, 0x1b, 0xdb, 0xeb, 0xb0, 0xab, 0x7c, 0x85, 0x3c, 0x39, 0xa0, 0x7f, 0x99, 0xd, 0x88, 0xa9}} return a, nil } @@ -424,7 +482,7 @@ func _lgraphqlDeployenvironmentbranchGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/deployEnvironmentBranch.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfe, 0xa7, 0x99, 0x8e, 0x66, 0xb5, 0x0, 0x95, 0xe1, 0x11, 0x59, 0x9, 0x38, 0xcc, 0x78, 0x43, 0x35, 0xf1, 0x8d, 0x3d, 0x1a, 0xe6, 0xc0, 0xee, 0x9e, 0x43, 0xa5, 0x46, 0x33, 0x72, 0x6f, 0x51}} return a, nil } @@ -444,7 +502,7 @@ func _lgraphqlDeployenvironmentlatestGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/deployEnvironmentLatest.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x14, 0xc1, 0xb8, 0x2a, 0xaa, 0xda, 0x1b, 0x34, 0xf, 0x2, 0x2f, 0x91, 0xb9, 0x6b, 0x96, 0x61, 0x11, 0xf7, 0x40, 0x4a, 0x3d, 0x74, 0xb9, 0x63, 0xb5, 0xe7, 0xb3, 0x62, 0xa2, 0x59, 0x82, 0x25}} return a, nil } @@ -464,7 +522,7 @@ func _lgraphqlDeployenvironmentpromoteGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/deployEnvironmentPromote.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0x98, 0x28, 0x4e, 0x50, 0xf5, 0x5d, 0x81, 0x63, 0x9, 0x4c, 0xc1, 0x5e, 0x2c, 0x69, 0xbf, 0x5b, 0x32, 0xde, 0x82, 0x9a, 0x89, 0xe4, 0xef, 0xc4, 0x64, 0x4e, 0xcd, 0xf, 0xca, 0xd5, 0x87}} return a, nil } @@ -484,11 +542,11 @@ func _lgraphqlDeployenvironmentpullrequestGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/deployEnvironmentPullrequest.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa7, 0xd8, 0xfb, 0xe1, 0x78, 0xb5, 0xc2, 0x95, 0x7b, 0xe9, 0x9, 0x28, 0x6d, 0xd7, 0x47, 0xab, 0x61, 0xd3, 0x69, 0xfe, 0x1e, 0x5e, 0xe, 0x48, 0xde, 0x5d, 0x90, 0xe2, 0xda, 0xf9, 0x58, 0xfd}} return a, nil } -var __lgraphqlEnvironmentbynameGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8e\x4d\x0e\x82\x30\x10\x85\xf7\x9c\xe2\x91\xb8\x80\x84\x13\xb0\x74\xe7\x86\x98\xe8\x05\x08\x1d\xb5\x06\xa6\xb5\x0c\x26\x0d\xf1\xee\x86\x1f\x5b\x70\xd1\xb4\xdf\xd7\xce\xeb\x7b\x0d\xe4\x3c\xb2\x04\x38\x70\xdd\x51\x89\x8b\x38\xcd\xf7\xb4\x98\x8c\x75\xe6\x49\x8d\x94\x38\xb1\xa4\x39\xc6\x04\x00\x88\xdf\xda\x19\xee\x88\xe5\xe8\xab\xba\xa3\x6c\xd6\xc0\x32\x3f\xc7\x14\xab\x0a\x01\xbf\xa8\x7c\xbd\x18\xd7\x1d\xd0\x2a\x1c\xa7\xc9\x00\xce\x0c\xf2\x47\x7d\x40\x45\xb6\x35\xfe\xea\x6d\x7c\xb1\xa9\xb5\xf3\xc6\x12\xf7\x0f\x7d\x93\xf3\xd2\xa0\xda\x7e\x32\x58\x55\x0b\xc5\x06\x8d\xa3\x1d\x2b\x6a\x29\xf2\x27\x99\xd6\x37\x00\x00\xff\xff\xd5\xce\x35\x6e\x32\x01\x00\x00") +var __lgraphqlEnvironmentbynameGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4c\x8d\x41\xca\x83\x30\x10\x46\xf7\x39\xc5\x27\xfc\x8b\x5f\xf0\x04\x2e\xbb\xeb\x46\x0a\xed\x05\xc4\x4c\xdb\x14\x9d\xa4\xe3\x58\x08\xc5\xbb\x17\x13\x0c\xee\x1e\x33\xbc\xf7\xbd\x17\x92\x88\x7f\x03\xfc\x71\x3f\x51\x8b\xab\x8a\xe3\x47\xd5\x6c\x97\x20\xfe\x45\x83\xb6\x38\xb3\x56\x35\xbe\x06\x20\xfe\x38\xf1\x3c\x11\xeb\x29\x76\xfd\x44\x9b\x0a\x64\x37\x25\x9a\x74\x28\xea\x1e\xa9\x0d\x52\x00\x70\xb6\x28\x09\xc4\x2f\x7a\xa0\x39\xa1\xa5\x30\xfa\x78\x8b\x21\x7f\x0e\xb3\xe5\xe6\x03\xf1\xfc\x74\x77\xbd\xe4\x85\x6e\x0f\x2e\xc1\xf6\x4a\x79\x65\x10\x2a\x6c\x69\xa4\xcc\xab\x59\x7f\x01\x00\x00\xff\xff\x2f\xae\x55\x5c\xf9\x00\x00\x00") func _lgraphqlEnvironmentbynameGraphqlBytes() ([]byte, error) { return bindataRead( @@ -504,7 +562,27 @@ func _lgraphqlEnvironmentbynameGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/environmentByName.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2c, 0xe6, 0xb7, 0xe8, 0xe4, 0xc1, 0x23, 0x31, 0x1d, 0xb1, 0x8d, 0x8e, 0x25, 0x6f, 0xcf, 0xa2, 0x5e, 0xf3, 0x54, 0x3d, 0x4d, 0x10, 0x6d, 0x77, 0x61, 0x0, 0x6f, 0xb4, 0x91, 0xf7, 0x75, 0x23}} + return a, nil +} + +var __lgraphqlGettaskdefinitionbyidGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x8f\xb1\xaa\xc3\x30\x0c\x45\xf7\x7c\x85\x1e\x64\xc8\x5b\xf2\x01\x6f\x7b\x6d\x97\x2c\x9d\xfa\x03\xc6\x52\x83\x5a\x2c\xbb\xb2\x13\x08\x25\xff\x5e\x4c\x6c\xba\x14\x0a\x1d\x3a\x18\xae\xa5\x73\xaf\xb8\xb7\x89\x74\x81\xae\x65\xfc\x83\x41\xd2\xcf\x2f\xdc\x1b\x00\x83\xb3\x11\x4b\x78\x32\xf1\x7a\xa0\x33\x0b\x27\xf6\xb2\x5b\x06\xec\x32\xd8\x32\x6e\x1c\x40\xdf\xf7\xe0\x05\xfe\x5f\x1a\x06\x67\x46\x2a\x20\x00\x63\x11\x62\x1c\x15\x89\x14\xad\x72\xc8\x70\x99\xa4\x25\xd4\x25\x67\x7b\xd1\x56\xc9\x24\xaa\x09\x91\x74\x66\x5b\x77\xa3\xfa\x29\x1c\x9f\xa1\x41\xfd\x85\x6c\x2a\x3f\x92\x99\xd5\x8b\x23\xa9\x93\x40\xea\x38\xc6\x7a\x73\x6d\xde\x37\xd9\x7b\xe7\x8c\xe0\xe7\x5d\xec\x16\xf0\x8d\x36\xf9\xad\xcd\x23\x00\x00\xff\xff\xeb\xdd\x19\xc7\xd9\x01\x00\x00") + +func _lgraphqlGettaskdefinitionbyidGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlGettaskdefinitionbyidGraphql, + "_lgraphql/getTaskDefinitionByID.graphql", + ) +} + +func _lgraphqlGettaskdefinitionbyidGraphql() (*asset, error) { + bytes, err := _lgraphqlGettaskdefinitionbyidGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/getTaskDefinitionByID.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa3, 0x15, 0x34, 0x4c, 0x14, 0x8e, 0xe6, 0x11, 0x3c, 0x54, 0x90, 0xae, 0x60, 0xd7, 0xbf, 0xfd, 0x50, 0x3c, 0x88, 0xc8, 0x2c, 0x6c, 0xf4, 0xe1, 0xa4, 0x80, 0xc2, 0xa4, 0x60, 0x24, 0xa, 0x15}} return a, nil } @@ -524,7 +602,7 @@ func _lgraphqlLagoonschemaGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/lagoonSchema.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9e, 0xe, 0xea, 0x54, 0xa2, 0xc2, 0x50, 0x45, 0x52, 0xa3, 0x2d, 0xb7, 0x51, 0xef, 0xb, 0x16, 0x78, 0xb0, 0xc8, 0xab, 0xf6, 0x57, 0x59, 0x73, 0xb7, 0x32, 0x67, 0x9a, 0x14, 0x52, 0x5b, 0xd5}} return a, nil } @@ -544,7 +622,7 @@ func _lgraphqlLagoonversionGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/lagoonVersion.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdd, 0x6d, 0x26, 0x13, 0xe1, 0x87, 0x3, 0xf2, 0x97, 0xc1, 0x80, 0x76, 0xf3, 0xf, 0xa8, 0xea, 0x82, 0xb6, 0x64, 0x5c, 0xcc, 0x41, 0x3f, 0x40, 0x95, 0x3c, 0x46, 0xa5, 0x22, 0x1f, 0x8f, 0xb0}} return a, nil } @@ -564,11 +642,11 @@ func _lgraphqlMeGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/me.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x41, 0x6a, 0x4a, 0x7d, 0x6e, 0xb1, 0xa2, 0xea, 0x22, 0xdd, 0xff, 0x81, 0x6e, 0x8d, 0x2a, 0x8a, 0x33, 0x61, 0x21, 0xdc, 0xfe, 0xcf, 0xab, 0x1, 0x5e, 0x31, 0xc8, 0x83, 0xb2, 0x8a, 0xbe, 0x9a}} return a, nil } -var __lgraphqlMinimalprojectbynameGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\xc1\x4a\x04\x31\x10\x44\xef\xf3\x15\x2d\x78\x58\x7f\xc1\xa3\xe8\x41\x10\x19\x5c\xfd\x80\x38\x53\xee\x46\x93\xee\x6c\xa7\x33\x30\xc8\xfe\xbb\xcc\x2e\x26\x2b\x8c\xb9\x24\xa9\x57\x49\x17\x75\x28\xd0\x99\x36\x1d\xd1\x35\xbb\x88\x5b\xda\x9a\x7a\xde\x5d\xdd\xd0\x77\x47\x44\x94\x54\x3e\x31\xd8\xdd\xfc\xec\x22\x36\x27\x89\xe8\xec\x3c\x3d\xf8\xf5\x2d\xcb\x8f\xf5\xb8\xa0\x7a\x71\xc5\xe4\x71\x0c\x4d\x78\x57\xc7\xc3\x1e\xb9\x0a\xa9\x84\xa0\x38\x14\x64\xbb\x10\x55\xc6\x32\x98\x17\x7e\xe0\xc9\xab\x70\x04\x5b\xfb\x74\x30\x3f\x61\x3b\x67\x43\xcc\xf7\x48\x41\xe6\x75\xf6\xea\xf2\xd7\x3a\x79\x41\x94\x09\xeb\xac\x57\x89\x62\x0d\x4a\x02\xe7\xbd\xff\xb0\xfe\x5c\x48\xef\xcc\xa0\x5c\xf9\x88\x09\x41\xd2\x12\xf1\x22\x6d\x7e\xf2\xd1\xb7\xcc\x3b\x6f\x6f\x1a\xfe\xef\xa5\x0e\x69\x9d\xfe\x69\xf5\xd8\xb5\xfd\xd8\xfd\x04\x00\x00\xff\xff\xe6\xc6\xf6\xf5\xbb\x01\x00\x00") +var __lgraphqlMinimalprojectbynameGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x91\xd1\x4e\xf3\x30\x0c\x85\xef\xfb\x14\xfe\xa5\xff\x62\xbc\x02\x97\x08\x2e\x90\x10\xaa\x18\x3c\x40\x68\x0f\x5b\x20\xb1\x33\xc7\xa9\x54\xa1\xbd\x3b\xea\xa6\xa5\x05\x75\xbd\xa9\x73\x3e\x3b\x3e\x3a\x39\x14\xe8\x48\x9b\x86\xe8\x3f\xbb\x88\x5b\xda\x9a\x7a\xde\xfd\xbb\xa1\xef\x86\x88\x28\xa9\x7c\xa2\xb3\xbb\xf1\xd9\x45\x6c\x4e\x12\xd1\xb9\xf3\x34\x70\xe9\x9b\x3e\xdf\xd7\x72\x42\xf5\xe0\x8a\xc9\x63\x1f\x66\xe1\x5d\x1d\x77\x7b\xe4\x2a\xa4\x12\x82\xe2\x50\x90\x6d\x21\xaa\xf4\xa5\x33\x2f\xfc\xc0\x83\x57\xe1\x08\xb6\xf9\xd2\xce\xfc\x80\xed\x98\x0d\x31\xdf\x23\x05\x19\xd7\xd9\xab\xcb\x5f\xeb\xe4\x05\x51\x06\xac\xb3\x56\x25\x8a\xcd\x50\x12\x38\xef\xfd\x87\xb5\xe7\x40\x5a\x67\x06\xe5\xca\x7b\x0c\x08\x92\x26\x8b\x0b\xb7\xf9\xc9\x47\x3f\x7b\xde\x79\x7b\xd3\x70\x3d\x97\xba\x64\x11\xea\xaf\x58\x8f\xb5\xc2\x62\xc9\xb5\xee\x3f\xcf\x70\x19\x9e\xfe\xc7\xe6\x27\x00\x00\xff\xff\xbb\x8c\x8a\x67\xf9\x01\x00\x00") func _lgraphqlMinimalprojectbynameGraphqlBytes() ([]byte, error) { return bindataRead( @@ -584,7 +662,7 @@ func _lgraphqlMinimalprojectbynameGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/minimalProjectByName.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x31, 0xd3, 0x29, 0xe, 0xda, 0x7f, 0x7, 0x69, 0x5a, 0x9e, 0x60, 0x66, 0xa1, 0x4a, 0xba, 0x2b, 0x2d, 0x73, 0x64, 0xf2, 0xf4, 0xf9, 0xcb, 0xfc, 0x70, 0xd8, 0xbe, 0x9e, 0xc3, 0xff, 0xd2, 0x49}} return a, nil } @@ -604,7 +682,7 @@ func _lgraphqlProjectbynameGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/projectByName.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdb, 0x17, 0xc, 0x27, 0x66, 0xb8, 0xd0, 0xc5, 0xca, 0xb, 0x9d, 0xa1, 0xc9, 0x71, 0x40, 0xce, 0x44, 0x37, 0x35, 0x67, 0x59, 0xe8, 0xbc, 0x97, 0xd7, 0xab, 0xd1, 0xe1, 0xb, 0x67, 0x7e, 0xd4}} return a, nil } @@ -624,7 +702,7 @@ func _lgraphqlProjectbynamemetadataGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/projectByNameMetadata.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0xcb, 0xca, 0xaf, 0x5d, 0xe3, 0x4, 0x41, 0x92, 0xee, 0xbf, 0x3f, 0xeb, 0x91, 0x7, 0xdb, 0xca, 0x4, 0x3e, 0x42, 0x4a, 0xbf, 0xf2, 0x1a, 0x2b, 0xb, 0x7, 0xa6, 0xff, 0x43, 0x58, 0x51}} return a, nil } @@ -644,7 +722,7 @@ func _lgraphqlProjectsbymetadataGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/projectsByMetadata.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1a, 0xfb, 0x28, 0x97, 0xd9, 0xd9, 0xec, 0x81, 0xe3, 0x84, 0xed, 0xd5, 0x68, 0xe1, 0x47, 0xeb, 0xe5, 0x82, 0xf9, 0xa7, 0xf5, 0x60, 0x18, 0x2a, 0xc4, 0xc4, 0x6a, 0x63, 0x11, 0xdf, 0xbb, 0x37}} return a, nil } @@ -664,7 +742,7 @@ func _lgraphqlRemoveprojectmetadatabykeyGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/removeProjectMetadataByKey.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x51, 0x5f, 0x3b, 0x9d, 0xd7, 0xe2, 0xc3, 0x44, 0x77, 0xc5, 0xee, 0xd3, 0xf3, 0x0, 0x12, 0x85, 0xf3, 0xc2, 0x63, 0x4e, 0xb3, 0xd3, 0xe3, 0x3, 0xfe, 0x4d, 0x53, 0x0, 0x39, 0xfc, 0x63, 0x76}} return a, nil } @@ -684,7 +762,7 @@ func _lgraphqlSwitchactivestandbyGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/switchActiveStandby.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb3, 0xeb, 0xd9, 0x14, 0xd, 0xb4, 0xf0, 0x79, 0xd5, 0x30, 0x22, 0x3, 0xa9, 0x7b, 0x73, 0xc8, 0xc6, 0xe0, 0x9e, 0xe2, 0xdb, 0x58, 0x38, 0x94, 0xe2, 0x22, 0xde, 0x93, 0x3a, 0x8c, 0xc7, 0x56}} return a, nil } @@ -704,7 +782,27 @@ func _lgraphqlTaskbyidGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/taskByID.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7, 0x21, 0xe7, 0x4b, 0x30, 0x2a, 0x2e, 0x7, 0xac, 0x75, 0xd, 0xdc, 0x51, 0x75, 0x53, 0xa, 0x48, 0x5, 0xbe, 0x8e, 0x29, 0x2, 0x90, 0xe, 0xd3, 0xa6, 0xc7, 0xba, 0x1c, 0x46, 0xa4, 0x82}} + return a, nil +} + +var __lgraphqlUpdateadvancedtaskdefinitionGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x90\xc1\x4a\xc4\x30\x10\x86\xef\x7d\x8a\x11\x3c\xb8\x20\x7d\x80\xde\x16\xbd\xf4\x22\x1e\xf4\x01\x86\x64\xac\xa3\x64\x12\xd2\xa4\x20\x4b\xdf\x5d\xa6\x95\x95\xc4\xa0\x17\xd9\x9c\x9a\xaf\xf3\xf7\x9f\xaf\x2e\x27\x4c\xec\x05\x6e\x3a\x00\x80\x6b\xb6\x03\x8c\x92\xae\x6e\xf7\x6b\xc0\x64\x5e\x07\x78\x0e\x16\x13\x1d\xed\x82\x62\xc8\x3e\xe1\xfc\x7e\x4f\x2f\x2c\xac\xc9\x47\x1d\x19\x25\x64\x0d\x1d\x4e\x5b\x2e\xff\x32\xbf\x17\xe9\x61\x0d\x0d\x70\x3a\x83\x0d\xda\x41\xb7\x28\xd8\xd7\x16\xfb\x36\xe7\x37\xeb\xf6\x74\xf8\x8e\xf7\x7d\x0f\x5e\xa0\x5d\x7b\xe7\x9d\x43\xb1\x3f\xda\x8a\xab\xa0\xa3\x02\x58\x9a\x4d\xe4\xa0\x1f\x28\x78\xfa\x08\xe5\xe0\x4c\x71\x61\x53\x32\xb3\x57\x16\x6c\x8a\x3e\x87\x87\xba\x26\x44\xff\x46\x26\x15\x8c\x64\xe1\xe8\xc5\x91\xa4\x4a\xf9\x4f\xd7\xd1\xe1\x44\x97\x34\x65\x2d\xfc\x47\x4f\x3d\xd8\x54\x3b\xc6\x29\xeb\xe8\x5c\xe9\x35\x14\x9b\x9a\x4d\xa5\xb5\xfa\xc1\x6b\xb7\x76\x9f\x01\x00\x00\xff\xff\xe6\x9a\x86\xc0\x19\x03\x00\x00") + +func _lgraphqlUpdateadvancedtaskdefinitionGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlUpdateadvancedtaskdefinitionGraphql, + "_lgraphql/updateAdvancedTaskDefinition.graphql", + ) +} + +func _lgraphqlUpdateadvancedtaskdefinitionGraphql() (*asset, error) { + bytes, err := _lgraphqlUpdateadvancedtaskdefinitionGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/updateAdvancedTaskDefinition.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x23, 0x9a, 0x1c, 0x5d, 0xb2, 0x2f, 0x74, 0x94, 0x16, 0x75, 0x13, 0x8a, 0xf, 0x46, 0x88, 0x69, 0x5c, 0x26, 0x0, 0xf5, 0x17, 0xac, 0x36, 0x3d, 0x2c, 0xc4, 0x4c, 0xe6, 0xb1, 0x5b, 0xfa, 0x33}} return a, nil } @@ -724,7 +822,47 @@ func _lgraphqlUpdateprojectmetadataGraphql() (*asset, error) { } info := bindataFileInfo{name: "_lgraphql/updateProjectMetadata.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1e, 0x5c, 0x79, 0x65, 0xb3, 0x80, 0xef, 0xe5, 0x67, 0x82, 0x41, 0xba, 0x50, 0x62, 0x30, 0x52, 0xcb, 0x80, 0x62, 0xf1, 0xf6, 0xbb, 0xb7, 0x8c, 0xd9, 0xc5, 0xd7, 0xff, 0xca, 0x96, 0xcc, 0x66}} + return a, nil +} + +var __lgraphqlUpdateworkflowGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x4f\xbd\xce\x82\x30\x14\xdd\x79\x8a\xfb\x25\xdf\x20\x89\xe1\x01\xba\x19\x5d\xd8\x1c\x34\xce\x37\xf4\xa2\x15\x7b\xdb\x60\xc1\x81\xf0\xee\xa6\xad\x29\x42\x1c\x94\xe9\x9e\xc3\xf9\xab\xee\x1c\x3a\x65\x18\x56\x19\x00\xc0\xbf\x92\x02\x4a\x76\x7f\xeb\x08\x2d\xba\xea\x22\xe0\x68\x25\x3a\x3a\x99\xb6\xa9\x6f\xe6\xb1\xf7\x64\xc9\xb6\xf3\xb2\x7c\x08\xca\x6e\xa6\x88\x61\xfe\x53\x5e\x26\x60\x48\x44\x20\xa5\xf0\x4d\x33\xee\xd5\x14\x1b\xd3\x9f\x31\x5c\xf9\x64\x7f\x73\x31\x6a\x4a\x80\x7a\x62\x97\x90\x6d\xcd\x95\xaa\x09\xa3\xec\x91\x2b\x92\x07\xbc\x37\x3b\xaa\x15\xab\xf0\xe6\xf9\xaa\xa2\x28\xc0\x30\x6c\x3e\x6a\x4b\x8d\x67\x5a\x18\x16\x7b\xa6\xbd\x5f\x25\x6e\x8d\xd6\xc8\xf2\x97\xcc\x78\x8d\xd9\x98\x3d\x03\x00\x00\xff\xff\x0e\xba\xe8\x2e\xb7\x01\x00\x00") + +func _lgraphqlUpdateworkflowGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlUpdateworkflowGraphql, + "_lgraphql/updateWorkflow.graphql", + ) +} + +func _lgraphqlUpdateworkflowGraphql() (*asset, error) { + bytes, err := _lgraphqlUpdateworkflowGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/updateWorkflow.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc, 0x80, 0xe6, 0x3f, 0x89, 0xbb, 0xad, 0xfb, 0x49, 0xbc, 0xc1, 0xab, 0x61, 0x18, 0x77, 0xf7, 0x62, 0xd4, 0x23, 0x7, 0x7a, 0x9b, 0x30, 0x7f, 0x11, 0x2a, 0xbe, 0xe8, 0xad, 0x46, 0x7f, 0x83}} + return a, nil +} + +var __lgraphqlWorkflowsforenvironmentGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x8e\xcd\xaa\xc2\x30\x10\x85\xf7\x79\x8a\xb9\x70\x17\xba\xc9\x03\xb8\x13\x7f\xa0\x7b\x5f\x60\x68\xa6\x12\x6b\x66\x34\x8d\x29\x22\x79\x77\x09\x62\x5a\x8b\x82\x9e\xd5\xf9\x60\xbe\xc3\x9c\x2f\xe4\xaf\xd0\x8b\x6f\x9b\xa3\xf4\xdd\x56\xfc\x86\xa3\xf5\xc2\x8e\x38\xcc\xfe\x69\x80\x05\x54\x1c\xfe\xe6\x70\x53\x00\xf0\xd1\x78\x11\xc6\xfa\x53\xcc\xb1\xa6\x54\x46\x47\x05\x28\x12\x87\x42\x27\x2f\x07\xaa\x07\x46\x13\x91\x6b\x32\x3b\xec\xda\x35\x35\x96\x6d\xb0\xc2\xa3\xd9\x1c\xad\x35\x08\xc3\xf2\xed\xed\x4a\x9c\x43\x36\x13\x65\xf2\x51\x4e\xfa\x7e\xb3\x72\xb8\xa7\x5f\x16\x1f\x2d\xa9\xa4\xee\x01\x00\x00\xff\xff\x54\xa3\x83\xe8\x7c\x01\x00\x00") + +func _lgraphqlWorkflowsforenvironmentGraphqlBytes() ([]byte, error) { + return bindataRead( + __lgraphqlWorkflowsforenvironmentGraphql, + "_lgraphql/workflowsForEnvironment.graphql", + ) +} + +func _lgraphqlWorkflowsforenvironmentGraphql() (*asset, error) { + bytes, err := _lgraphqlWorkflowsforenvironmentGraphqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "_lgraphql/workflowsForEnvironment.graphql", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfa, 0x5c, 0xd1, 0x20, 0x6c, 0xf8, 0x5b, 0x74, 0xc9, 0xdb, 0x2b, 0x97, 0x37, 0xcb, 0x58, 0xab, 0x71, 0xfc, 0x91, 0x18, 0x38, 0x17, 0xa4, 0xc5, 0x8c, 0x6f, 0x98, 0x22, 0x8, 0x35, 0xa0, 0x25}} return a, nil } @@ -732,8 +870,8 @@ func _lgraphqlUpdateprojectmetadataGraphql() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -743,6 +881,12 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } +// AssetString returns the asset contents as a string (instead of a []byte). +func AssetString(name string) (string, error) { + data, err := Asset(name) + return string(data), err +} + // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -754,12 +898,18 @@ func MustAsset(name string) []byte { return a } +// MustAssetString is like AssetString but panics when Asset would return an +// error. It simplifies safe initialization of global variables. +func MustAssetString(name string) string { + return string(MustAsset(name)) +} + // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -769,6 +919,33 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } +// AssetDigest returns the digest of the file with the given name. It returns an +// error if the asset could not be found or the digest could not be loaded. +func AssetDigest(name string) ([sha256.Size]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) + } + return a.digest, nil + } + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) +} + +// Digests returns a map of all known files and their checksums. +func Digests() (map[string][sha256.Size]byte, error) { + mp := make(map[string][sha256.Size]byte, len(_bindata)) + for name := range _bindata { + a, err := _bindata[name]() + if err != nil { + return nil, err + } + mp[name] = a.digest + } + return mp, nil +} + // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -780,6 +957,7 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ + "_lgraphql/addAdvancedTaskDefinition.graphql": _lgraphqlAddadvancedtaskdefinitionGraphql, "_lgraphql/addBillingGroup.graphql": _lgraphqlAddbillinggroupGraphql, "_lgraphql/addEnvVariable.graphql": _lgraphqlAddenvvariableGraphql, "_lgraphql/addGroup.graphql": _lgraphqlAddgroupGraphql, @@ -795,11 +973,14 @@ var _bindata = map[string]func() (*asset, error){ "_lgraphql/addSshKey.graphql": _lgraphqlAddsshkeyGraphql, "_lgraphql/addUser.graphql": _lgraphqlAdduserGraphql, "_lgraphql/addUserToGroup.graphql": _lgraphqlAddusertogroupGraphql, + "_lgraphql/addWorkflow.graphql": _lgraphqlAddworkflowGraphql, + "_lgraphql/advancedTasksForEnvironment.graphql": _lgraphqlAdvancedtasksforenvironmentGraphql, "_lgraphql/deployEnvironmentBranch.graphql": _lgraphqlDeployenvironmentbranchGraphql, "_lgraphql/deployEnvironmentLatest.graphql": _lgraphqlDeployenvironmentlatestGraphql, "_lgraphql/deployEnvironmentPromote.graphql": _lgraphqlDeployenvironmentpromoteGraphql, "_lgraphql/deployEnvironmentPullrequest.graphql": _lgraphqlDeployenvironmentpullrequestGraphql, "_lgraphql/environmentByName.graphql": _lgraphqlEnvironmentbynameGraphql, + "_lgraphql/getTaskDefinitionByID.graphql": _lgraphqlGettaskdefinitionbyidGraphql, "_lgraphql/lagoonSchema.graphql": _lgraphqlLagoonschemaGraphql, "_lgraphql/lagoonVersion.graphql": _lgraphqlLagoonversionGraphql, "_lgraphql/me.graphql": _lgraphqlMeGraphql, @@ -810,9 +991,15 @@ var _bindata = map[string]func() (*asset, error){ "_lgraphql/removeProjectMetadataByKey.graphql": _lgraphqlRemoveprojectmetadatabykeyGraphql, "_lgraphql/switchActiveStandby.graphql": _lgraphqlSwitchactivestandbyGraphql, "_lgraphql/taskByID.graphql": _lgraphqlTaskbyidGraphql, + "_lgraphql/updateAdvancedTaskDefinition.graphql": _lgraphqlUpdateadvancedtaskdefinitionGraphql, "_lgraphql/updateProjectMetadata.graphql": _lgraphqlUpdateprojectmetadataGraphql, + "_lgraphql/updateWorkflow.graphql": _lgraphqlUpdateworkflowGraphql, + "_lgraphql/workflowsForEnvironment.graphql": _lgraphqlWorkflowsforenvironmentGraphql, } +// AssetDebug is true if the assets were built with the debug flag enabled. +const AssetDebug = false + // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the @@ -822,15 +1009,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// then AssetDir("data") would return []string{"foo.txt", "img"}, +// AssetDir("data/img") would return []string{"a.png", "b.png"}, +// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -854,42 +1041,49 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "_lgraphql": &bintree{nil, map[string]*bintree{ - "addBillingGroup.graphql": &bintree{_lgraphqlAddbillinggroupGraphql, map[string]*bintree{}}, - "addEnvVariable.graphql": &bintree{_lgraphqlAddenvvariableGraphql, map[string]*bintree{}}, - "addGroup.graphql": &bintree{_lgraphqlAddgroupGraphql, map[string]*bintree{}}, - "addGroupsToProject.graphql": &bintree{_lgraphqlAddgroupstoprojectGraphql, map[string]*bintree{}}, - "addNotificationEmail.graphql": &bintree{_lgraphqlAddnotificationemailGraphql, map[string]*bintree{}}, - "addNotificationMicrosoftTeams.graphql": &bintree{_lgraphqlAddnotificationmicrosoftteamsGraphql, map[string]*bintree{}}, - "addNotificationRocketChat.graphql": &bintree{_lgraphqlAddnotificationrocketchatGraphql, map[string]*bintree{}}, - "addNotificationSlack.graphql": &bintree{_lgraphqlAddnotificationslackGraphql, map[string]*bintree{}}, - "addNotificationToProject.graphql": &bintree{_lgraphqlAddnotificationtoprojectGraphql, map[string]*bintree{}}, - "addOrUpdateEnvironment.graphql": &bintree{_lgraphqlAddorupdateenvironmentGraphql, map[string]*bintree{}}, - "addProject.graphql": &bintree{_lgraphqlAddprojectGraphql, map[string]*bintree{}}, - "addProjectToBillingGroup.graphql": &bintree{_lgraphqlAddprojecttobillinggroupGraphql, map[string]*bintree{}}, - "addSshKey.graphql": &bintree{_lgraphqlAddsshkeyGraphql, map[string]*bintree{}}, - "addUser.graphql": &bintree{_lgraphqlAdduserGraphql, map[string]*bintree{}}, - "addUserToGroup.graphql": &bintree{_lgraphqlAddusertogroupGraphql, map[string]*bintree{}}, - "deployEnvironmentBranch.graphql": &bintree{_lgraphqlDeployenvironmentbranchGraphql, map[string]*bintree{}}, - "deployEnvironmentLatest.graphql": &bintree{_lgraphqlDeployenvironmentlatestGraphql, map[string]*bintree{}}, - "deployEnvironmentPromote.graphql": &bintree{_lgraphqlDeployenvironmentpromoteGraphql, map[string]*bintree{}}, - "deployEnvironmentPullrequest.graphql": &bintree{_lgraphqlDeployenvironmentpullrequestGraphql, map[string]*bintree{}}, - "environmentByName.graphql": &bintree{_lgraphqlEnvironmentbynameGraphql, map[string]*bintree{}}, - "lagoonSchema.graphql": &bintree{_lgraphqlLagoonschemaGraphql, map[string]*bintree{}}, - "lagoonVersion.graphql": &bintree{_lgraphqlLagoonversionGraphql, map[string]*bintree{}}, - "me.graphql": &bintree{_lgraphqlMeGraphql, map[string]*bintree{}}, - "minimalProjectByName.graphql": &bintree{_lgraphqlMinimalprojectbynameGraphql, map[string]*bintree{}}, - "projectByName.graphql": &bintree{_lgraphqlProjectbynameGraphql, map[string]*bintree{}}, - "projectByNameMetadata.graphql": &bintree{_lgraphqlProjectbynamemetadataGraphql, map[string]*bintree{}}, - "projectsByMetadata.graphql": &bintree{_lgraphqlProjectsbymetadataGraphql, map[string]*bintree{}}, - "removeProjectMetadataByKey.graphql": &bintree{_lgraphqlRemoveprojectmetadatabykeyGraphql, map[string]*bintree{}}, - "switchActiveStandby.graphql": &bintree{_lgraphqlSwitchactivestandbyGraphql, map[string]*bintree{}}, - "taskByID.graphql": &bintree{_lgraphqlTaskbyidGraphql, map[string]*bintree{}}, - "updateProjectMetadata.graphql": &bintree{_lgraphqlUpdateprojectmetadataGraphql, map[string]*bintree{}}, + "_lgraphql": {nil, map[string]*bintree{ + "addAdvancedTaskDefinition.graphql": {_lgraphqlAddadvancedtaskdefinitionGraphql, map[string]*bintree{}}, + "addBillingGroup.graphql": {_lgraphqlAddbillinggroupGraphql, map[string]*bintree{}}, + "addEnvVariable.graphql": {_lgraphqlAddenvvariableGraphql, map[string]*bintree{}}, + "addGroup.graphql": {_lgraphqlAddgroupGraphql, map[string]*bintree{}}, + "addGroupsToProject.graphql": {_lgraphqlAddgroupstoprojectGraphql, map[string]*bintree{}}, + "addNotificationEmail.graphql": {_lgraphqlAddnotificationemailGraphql, map[string]*bintree{}}, + "addNotificationMicrosoftTeams.graphql": {_lgraphqlAddnotificationmicrosoftteamsGraphql, map[string]*bintree{}}, + "addNotificationRocketChat.graphql": {_lgraphqlAddnotificationrocketchatGraphql, map[string]*bintree{}}, + "addNotificationSlack.graphql": {_lgraphqlAddnotificationslackGraphql, map[string]*bintree{}}, + "addNotificationToProject.graphql": {_lgraphqlAddnotificationtoprojectGraphql, map[string]*bintree{}}, + "addOrUpdateEnvironment.graphql": {_lgraphqlAddorupdateenvironmentGraphql, map[string]*bintree{}}, + "addProject.graphql": {_lgraphqlAddprojectGraphql, map[string]*bintree{}}, + "addProjectToBillingGroup.graphql": {_lgraphqlAddprojecttobillinggroupGraphql, map[string]*bintree{}}, + "addSshKey.graphql": {_lgraphqlAddsshkeyGraphql, map[string]*bintree{}}, + "addUser.graphql": {_lgraphqlAdduserGraphql, map[string]*bintree{}}, + "addUserToGroup.graphql": {_lgraphqlAddusertogroupGraphql, map[string]*bintree{}}, + "addWorkflow.graphql": {_lgraphqlAddworkflowGraphql, map[string]*bintree{}}, + "advancedTasksForEnvironment.graphql": {_lgraphqlAdvancedtasksforenvironmentGraphql, map[string]*bintree{}}, + "deployEnvironmentBranch.graphql": {_lgraphqlDeployenvironmentbranchGraphql, map[string]*bintree{}}, + "deployEnvironmentLatest.graphql": {_lgraphqlDeployenvironmentlatestGraphql, map[string]*bintree{}}, + "deployEnvironmentPromote.graphql": {_lgraphqlDeployenvironmentpromoteGraphql, map[string]*bintree{}}, + "deployEnvironmentPullrequest.graphql": {_lgraphqlDeployenvironmentpullrequestGraphql, map[string]*bintree{}}, + "environmentByName.graphql": {_lgraphqlEnvironmentbynameGraphql, map[string]*bintree{}}, + "getTaskDefinitionByID.graphql": {_lgraphqlGettaskdefinitionbyidGraphql, map[string]*bintree{}}, + "lagoonSchema.graphql": {_lgraphqlLagoonschemaGraphql, map[string]*bintree{}}, + "lagoonVersion.graphql": {_lgraphqlLagoonversionGraphql, map[string]*bintree{}}, + "me.graphql": {_lgraphqlMeGraphql, map[string]*bintree{}}, + "minimalProjectByName.graphql": {_lgraphqlMinimalprojectbynameGraphql, map[string]*bintree{}}, + "projectByName.graphql": {_lgraphqlProjectbynameGraphql, map[string]*bintree{}}, + "projectByNameMetadata.graphql": {_lgraphqlProjectbynamemetadataGraphql, map[string]*bintree{}}, + "projectsByMetadata.graphql": {_lgraphqlProjectsbymetadataGraphql, map[string]*bintree{}}, + "removeProjectMetadataByKey.graphql": {_lgraphqlRemoveprojectmetadatabykeyGraphql, map[string]*bintree{}}, + "switchActiveStandby.graphql": {_lgraphqlSwitchactivestandbyGraphql, map[string]*bintree{}}, + "taskByID.graphql": {_lgraphqlTaskbyidGraphql, map[string]*bintree{}}, + "updateAdvancedTaskDefinition.graphql": {_lgraphqlUpdateadvancedtaskdefinitionGraphql, map[string]*bintree{}}, + "updateProjectMetadata.graphql": {_lgraphqlUpdateprojectmetadataGraphql, map[string]*bintree{}}, + "updateWorkflow.graphql": {_lgraphqlUpdateworkflowGraphql, map[string]*bintree{}}, + "workflowsForEnvironment.graphql": {_lgraphqlWorkflowsforenvironmentGraphql, map[string]*bintree{}}, }}, }} -// RestoreAsset restores an asset under the given directory +// RestoreAsset restores an asset under the given directory. func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -907,14 +1101,10 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil + return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } -// RestoreAssets restores an asset under the given directory recursively +// RestoreAssets restores an asset under the given directory recursively. func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -932,6 +1122,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) } diff --git a/internal/lagoon/client/mutation.go b/internal/lagoon/client/mutation.go index 0fd749c4..919a3eea 100644 --- a/internal/lagoon/client/mutation.go +++ b/internal/lagoon/client/mutation.go @@ -331,3 +331,69 @@ func (c *Client) RemoveProjectMetadataByKey( Response: projects, }) } + +// AddWorkflow adds a new workflow +func (c *Client) AddWorkflow(ctx context.Context, input *schema.WorkflowInput, workflow *schema.WorkflowResponse) error { + req, err := c.newVersionedRequest("_lgraphql/addWorkflow.graphql", input) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.WorkflowResponse `json:"addWorkflow"` + }{ + Response: workflow, + }) +} + +// UpdateWorkflow updates a workflow +func (c *Client) UpdateWorkflow( + ctx context.Context, id int, patch *schema.WorkflowInput, workflow *schema.WorkflowResponse) error { + req, err := c.newVersionedRequest("_lgraphql/updateWorkflow.graphql", + map[string]interface{}{ + "id": id, + "patch": patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.WorkflowResponse `json:"updateWorkflow"` + }{ + Response: workflow, + }) +} + +// AddAdvancedTaskDefinition adds an advanced task definition +func (c *Client) AddAdvancedTaskDefinition(ctx context.Context, input *schema.AdvancedTaskDefinitionInput, taskDefinition *schema.AdvancedTaskDefinitionResponse) error { + req, err := c.newVersionedRequest("_lgraphql/addAdvancedTaskDefinition.graphql", input) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.AdvancedTaskDefinitionResponse `json:"addAdvancedTaskDefinition"` + }{ + Response: taskDefinition, + }) +} + +// UpdateAdvancedTaskDefinition updates a task definition +func (c *Client) UpdateAdvancedTaskDefinition( + ctx context.Context, id int, patch *schema.AdvancedTaskDefinitionInput, taskDefinition *schema.AdvancedTaskDefinitionResponse) error { + req, err := c.newVersionedRequest("_lgraphql/updateAdvancedTaskDefinition.graphql", + map[string]interface{}{ + "id": id, + "patch": patch, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.AdvancedTaskDefinitionResponse `json:"updateAdvancedTaskDefinition"` + }{ + Response: taskDefinition, + }) +} diff --git a/internal/lagoon/client/query.go b/internal/lagoon/client/query.go index a0b37d8f..ab70df3a 100644 --- a/internal/lagoon/client/query.go +++ b/internal/lagoon/client/query.go @@ -2,7 +2,6 @@ package client import ( "context" - "github.com/uselagoon/lagoon-cli/internal/schema" ) @@ -117,6 +116,25 @@ func (c *Client) GetTaskByID( }) } +// GetTaskDefinitionByID returns an advanced task definition by its ID +func (c *Client) GetTaskDefinitionByID( + ctx context.Context, id int, taskDefinition *schema.AdvancedTaskDefinitionResponse) error { + + req, err := c.newVersionedRequest("_lgraphql/getTaskDefinitionByID.graphql", + map[string]interface{}{ + "id": id, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *schema.AdvancedTaskDefinitionResponse `json:"advancedTaskDefinitionById"` + }{ + Response: taskDefinition, + }) +} + // MinimalProjectByName queries the Lagoon API for a project by its name, and // unmarshals the response into project. func (c *Client) MinimalProjectByName( @@ -177,3 +195,43 @@ func (c *Client) ProjectsByMetadata( Response: projects, }) } + +// GetWorkflowsByEnvironment queries the Lagoon API for workflows by environment name, and +// unmarshal the response. +func (c *Client) GetWorkflowsByEnvironment( + ctx context.Context, environment int, workflows *[]schema.WorkflowResponse) error { + + req, err := c.newVersionedRequest("_lgraphql/workflowsForEnvironment.graphql", + map[string]interface{}{ + "environment": environment, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.WorkflowResponse `json:"workflowsForEnvironment"` + }{ + Response: workflows, + }) +} + +// GetAdvancedTasksByEnvironment queries the Lagoon API for a advanced tasks by environment name, and +// unmarshal the response. +func (c *Client) GetAdvancedTasksByEnvironment( + ctx context.Context, environment int, tasks *[]schema.AdvancedTaskDefinitionResponse) error { + + req, err := c.newVersionedRequest("_lgraphql/advancedTasksForEnvironment.graphql", + map[string]interface{}{ + "environment": environment, + }) + if err != nil { + return err + } + + return c.client.Run(ctx, req, &struct { + Response *[]schema.AdvancedTaskDefinitionResponse `json:"advancedTasksForEnvironment"` + }{ + Response: tasks, + }) +} diff --git a/internal/lagoon/workflows.go b/internal/lagoon/workflows.go new file mode 100644 index 00000000..7a4d45cc --- /dev/null +++ b/internal/lagoon/workflows.go @@ -0,0 +1,59 @@ +package lagoon + +import ( + "context" + "github.com/uselagoon/lagoon-cli/internal/schema" +) + +// Workflow interface contains methods for running workflows in lagoon. +type Workflow interface { + GetWorkflowsByEnvironment(ctx context.Context, environment int, workflows *[]schema.WorkflowResponse) error + AddWorkflow(ctx context.Context, input *schema.WorkflowInput, taskDefinition *schema.WorkflowResponse) error + UpdateWorkflow(ctx context.Context, id int, patch *schema.WorkflowInput, taskDefinition *schema.WorkflowResponse) error + AddAdvancedTaskDefinition(ctx context.Context, input *schema.AdvancedTaskDefinitionInput, taskDefinition *schema.AdvancedTaskDefinitionResponse) error + GetTaskDefinitionByID(ctx context.Context, id int, taskDefinition *schema.AdvancedTaskDefinitionResponse) error + GetAdvancedTasksByEnvironment(ctx context.Context, environment int, tasks *[]schema.AdvancedTaskDefinitionResponse) error + UpdateAdvancedTaskDefinition(ctx context.Context, id int, patch *schema.AdvancedTaskDefinitionInput, taskDefinition *schema.AdvancedTaskDefinitionResponse) error +} + +// GetWorkflowsByEnvironment returns workflows by the associated environment id +func GetWorkflowsByEnvironment(ctx context.Context, environment int, w Workflow) (*[]schema.WorkflowResponse, error) { + var workflows []schema.WorkflowResponse + return &workflows, w.GetWorkflowsByEnvironment(ctx, environment, &workflows) +} + +// AddWorkflow Add Workflow from yaml file. +func AddWorkflow(ctx context.Context, input *schema.WorkflowInput, w Workflow) (*schema.WorkflowResponse, error) { + workflow := schema.WorkflowResponse{} + return &workflow, w.AddWorkflow(ctx, input, &workflow) +} + +// UpdateWorkflow updates a workflow. +func UpdateWorkflow(ctx context.Context, id int, patch *schema.WorkflowInput, w Workflow) (*schema.WorkflowResponse, error) { + workflow := schema.WorkflowResponse{} + return &workflow, w.UpdateWorkflow(ctx, id, patch, &workflow) +} + +// AddAdvancedTaskDefinition Add Advanced Task Definition from yaml file. +func AddAdvancedTaskDefinition(ctx context.Context, input *schema.AdvancedTaskDefinitionInput, w Workflow) (*schema.AdvancedTaskDefinitionResponse, error) { + taskDefinition := schema.AdvancedTaskDefinitionResponse{} + return &taskDefinition, w.AddAdvancedTaskDefinition(ctx, input, &taskDefinition) +} + +// GetTaskDefinitionByID returns an advanced task definition by the associated id +func GetTaskDefinitionByID(ctx context.Context, id int, w Workflow) (*schema.AdvancedTaskDefinitionResponse, error) { + taskDefinition := schema.AdvancedTaskDefinitionResponse{} + return &taskDefinition, w.GetTaskDefinitionByID(ctx, id, &taskDefinition) +} + +// GetAdvancedTasksByEnvironment returns an advanced task definition by the associated id +func GetAdvancedTasksByEnvironment(ctx context.Context, environment int, w Workflow) (*[]schema.AdvancedTaskDefinitionResponse, error) { + var tasks []schema.AdvancedTaskDefinitionResponse + return &tasks, w.GetAdvancedTasksByEnvironment(ctx, environment, &tasks) +} + +// UpdateAdvancedTaskDefinition updates an advanced task definition by ID. +func UpdateAdvancedTaskDefinition(ctx context.Context, id int, patch *schema.AdvancedTaskDefinitionInput, w Workflow) (*schema.AdvancedTaskDefinitionResponse, error) { + taskDefinition := schema.AdvancedTaskDefinitionResponse{} + return &taskDefinition, w.UpdateAdvancedTaskDefinition(ctx, id, patch, &taskDefinition) +} diff --git a/internal/schema/workflows.go b/internal/schema/workflows.go new file mode 100644 index 00000000..7548fa95 --- /dev/null +++ b/internal/schema/workflows.go @@ -0,0 +1,112 @@ +package schema + +type WorkflowInput struct { + ID uint `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Event EventType `json:"event,omitempty"` + Project int `json:"project,omitempty"` + AdvancedTaskDefinition int `json:"advancedTaskDefinition,omitempty"` +} + +type AdvancedTaskDefinitionInput struct { + ID uint `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Type AdvancedTaskDefinitionType `json:"type,omitempty"` + Command string `json:"command,omitempty"` + Image string `json:"image,omitempty"` + Arguments []AdvancedTaskDefinitionArgument `json:"advancedTaskDefinitionArguments,omitempty" yaml:"advancedTaskDefinitionArguments,omitempty"` + Service string `json:"service,omitempty"` + GroupName string `json:"groupName,omitempty"` + Project int `json:"project,omitempty"` + Environment int `json:"environment,omitempty"` + Permission string `json:"permission,omitempty"` +} + +type EventType string +type AdvancedTaskDefinitionType string + +const ( + APIDeployEnvironmentLatest EventType = "api:deployEnvironmentLatest" + APIDeployEnvironmentBranch EventType = "api:deployEnvironmentBranch" + APIDeleteEnvironment EventType = "api:deleteEnvironment" + + DeployOSFinished EventType = "task:builddeploy-openshift:complete" + DeployKubernetesFinished EventType = "task:builddeploy-kubernetes:complete" + RemoveOSFinished EventType = "task:remove-openshift:finished" + RemoveKubernetesFinished EventType = "task:remove-kubernetes:finished" + + DeployErrorRemoveKubernetes EventType = "task:remove-kubernetes:error" + DeployErrorRemoveOS EventType = "task:remove-openshift:error" + DeployErrorBuildDeployKubernetes EventType = "task:builddeploy-kubernetes:failed" + DeployErrorBuildDeployOS EventType = "task:builddeploy-openshift:failed" + + GithubPush EventType = "github:push:handled" + GithubPushSkip EventType = "github:push:skipped" + GithubPROpened EventType = "github:pull_request:opened:handled" + GithubPRUpdated EventType = "github:pull_request:synchronize:handled" + GithubPRClosed EventType = "github:pull_request:closed:handled" + GithubDeleteEnvironment EventType = "github:delete:handled" + GithubPRNotDeleted EventType = "github:pull_request:closed:CannotDeleteProductionEnvironment" + GithubPushNotDeleted EventType = "github:push:CannotDeleteProductionEnvironment" + + GitlabPush EventType = "gitlab:push:handled" + GitlabPushSkip EventType = "gitlab:push:skipped" + GitlabPROpened EventType = "gitlab:pull_request:opened:handled" + GitlabPRUpdated EventType = "gitlab:pull_request:synchronize:handled" + GitlabPRClosed EventType = "gitlab:pull_request:closed:handled" + GitlabDeleteEnvironment EventType = "gitlab:delete:handled" + GitlabPushNotDeleted EventType = "gitlab:push:CannotDeleteProductionEnvironment" + + BitbucketPush EventType = "bitbucket:repo:push:handled" + BitbucketPushSkip EventType = "bitbucket:push:skipped" + BitbucketPROpened EventType = "bitbucket:pullrequest:created:handled" + BitbucketPRCreatedOpened EventType = "bitbucket:pullrequest:created:opened:handled" + BitbucketPRUpdated EventType = "bitbucket:pullrequest:updated:handled" + BitbucketPRUpdatedOpened EventType = "bitbucket:pullrequest:updated:opened:handled" + BitbucketPRFulfilled EventType = "bitbucket:pullrequest:fulfilled:handled" + BitbucketPRRejected EventType = "bitbucket:pullrequest:rejected:handled" + BitbucketDeleteEnvironment EventType = "bitbucket:delete:handled" + BitbucketPushNotDeleted EventType = "bitbucket:repo:push:CannotDeleteProductionEnvironment" +) + +// WorkflowResponse A workflow response is based on the Lagoon API GraphQL type. +type WorkflowResponse struct { + ID uint `json:"id,omitempty" yaml:"id,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Event string `json:"event,omitempty" yaml:"event,omitempty"` + Project int `json:"project,omitempty" yaml:"project,omitempty"` + AdvancedTaskDefinition AdvancedTaskDefinitionResponse `json:"advancedTaskDefinition,omitempty" yaml:"advancedTaskDefinition,omitempty"` +} + +// AdvancedTaskDefinitionResponse An Advanced Task Definition is based on the Lagoon API GraphQL type. +type AdvancedTaskDefinitionResponse struct { + ID uint `json:"id,omitempty" yaml:"id,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Description string `json:"description,omitempty" yaml:"description,omitempty"` + Type AdvancedTaskDefinitionType `json:"type,omitempty" yaml:"type,omitempty"` + Command string `json:"command,omitempty" yaml:"command,omitempty"` + Image string `json:"image,omitempty" yaml:"image,omitempty"` + Arguments []AdvancedTaskDefinitionArgument `json:"advancedTaskDefinitionArguments,omitempty" yaml:"advancedTaskDefinitionArguments,omitempty"` + Service string `json:"service,omitempty" yaml:"service,omitempty"` + Environment int `json:"environment,omitempty" yaml:"environment,omitempty"` + Project int `json:"project,omitempty" yaml:"project,omitempty"` + GroupName string `json:"groupName,omitempty" yaml:"groupName,omitempty"` + Permission string `json:"permission,omitempty" yaml:"permission,omitempty"` + Created string `json:"created,omitempty" yaml:"created,omitempty"` + Deleted string `json:"deleted,omitempty" yaml:"deleted,omitempty"` +} + +type File struct { + ID uint `json:"id,omitempty"` + Filename uint `json:"filename,omitempty"` + Download uint `json:"download,omitempty"` + Created uint `json:"created,omitempty"` +} + +type AdvancedTaskDefinitionArgument struct { + ID uint `json:"id,omitempty" yaml:"id,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + AdvancedTaskDefinition int `json:"advancedTaskDefinition,omitempty" yaml:"advancedTaskDefinition,omitempty"` +}