-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to GET/CREATE/UPDATE/DELETE pipeline config
Add support to get list of scheduled jobs Reorganize the flags for subcommand pipeline
- Loading branch information
1 parent
9c95093
commit 8793b01
Showing
99 changed files
with
754 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func registerJobsCommand() *cobra.Command { | ||
jobsCommand := &cobra.Command{ | ||
Use: "job", | ||
Short: "Command to operate on jobs present in GoCD", | ||
Long: `Command leverages GoCD job apis' | ||
[https://api.gocd.org/current/#scheduled-jobs] to | ||
GET/SCHEDULE jobs of specific pipelines present GoCD`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
if err := cmd.Usage(); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
jobsCommand.SetUsageTemplate(getUsageTemplate()) | ||
|
||
jobsCommand.AddCommand(getScheduledJobsCommand()) | ||
|
||
for _, command := range jobsCommand.Commands() { | ||
command.SilenceUsage = true | ||
} | ||
|
||
return jobsCommand | ||
} | ||
|
||
func getScheduledJobsCommand() *cobra.Command { | ||
getScheduledJobsCmd := &cobra.Command{ | ||
Use: "scheduled", | ||
Short: "Command to GET a list of scheduled jobs in GoCD [https://api.gocd.org/current/#scheduled-jobs]", | ||
Args: cobra.NoArgs, | ||
PreRunE: setCLIClient, | ||
Example: `gocd-cli job scheduled"`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
response, err := client.GetScheduledJobs() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return cliRenderer.Render(response) | ||
}, | ||
} | ||
|
||
registerPipelineFlags(getScheduledJobsCmd) | ||
|
||
return getScheduledJobsCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.