Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option component to the create deploy pipeline job #84

Merged
merged 7 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions cmd/createDeployPipelineJob.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ import (
var createDeployPipelineJobCmd = &cobra.Command{
Use: "deploy",
Short: "Will trigger deploy of a Radix application",
Long: `Triggers deploy of a Radix application according to the radix config in its repository's master branch.

Examples:
# Create a Radix pipeline deploy-only job to deploy an application "radix-test" to an environment "dev"
Long: "Triggers deploy of a Radix application according to the radix config in its repository's master branch.",
Example: ` # Create a Radix pipeline deploy-only job to deploy an application "radix-test" to an environment "dev"
rx create job deploy --application radix-test --environment dev

# Create a Radix pipeline deploy-only job, short option versions
Expand All @@ -45,7 +43,9 @@ Examples:

# Create a Radix pipeline deploy-only job with re-defined image-tags for components, short option versions
rx create job deploy -a radix-test -e dev -t web-app=web-app-v2.1 -t api-server=api-v1.0
`,

# Create a Radix pipeline deploy-only job to deploy only specific components
rx create job deploy -a radix-test -e dev --component web-app --component api-server`,
RunE: func(cmd *cobra.Command, args []string) error {
var errs []error
appName, err := getAppNameFromConfigOrFromParameter(cmd, flagnames.Application)
Expand Down Expand Up @@ -79,6 +79,10 @@ Examples:
if err2 != nil {
return err2
}
componentsToDeploy, err := cmd.Flags().GetStringSlice(flagnames.Component)
if err != nil {
return err
}

cmd.SilenceUsage = true

Expand All @@ -89,12 +93,14 @@ Examples:

triggerPipelineParams := application.NewTriggerPipelineDeployParams()
triggerPipelineParams.SetAppName(*appName)
triggerPipelineParams.SetPipelineParametersDeploy(&models.PipelineParametersDeploy{
ToEnvironment: targetEnvironment,
ImageTagNames: imageTagNames,
TriggeredBy: triggeredByUser,
CommitID: commitID,
})
parametersDeploy := models.PipelineParametersDeploy{
ToEnvironment: targetEnvironment,
ImageTagNames: imageTagNames,
TriggeredBy: triggeredByUser,
CommitID: commitID,
ComponentsToDeploy: componentsToDeploy,
}
triggerPipelineParams.SetPipelineParametersDeploy(&parametersDeploy)

newJob, err := apiClient.Application.TriggerPipelineDeploy(triggerPipelineParams, nil)
if err != nil {
Expand Down Expand Up @@ -131,6 +137,7 @@ func init() {
createDeployPipelineJobCmd.Flags().StringP(flagnames.User, "u", "", "The user who triggered the deploy")
createDeployPipelineJobCmd.Flags().StringToStringP(flagnames.ImageTagName, "t", map[string]string{}, "Image tag name for a component: component-name=tag-name. Multiple pairs can be specified.")
createDeployPipelineJobCmd.Flags().StringP(flagnames.CommitID, "i", "", "An optional 40 character commit id to tag the new pipeline job")
createDeployPipelineJobCmd.Flags().StringSlice(flagnames.Component, []string{}, "Optional component to deploy, when only specific component need to be deployed. Multiple components can be specified.")
createDeployPipelineJobCmd.Flags().BoolP(flagnames.Follow, "f", false, "Follow deploy")
setContextSpecificPersistentFlags(createDeployPipelineJobCmd)
}
3 changes: 3 additions & 0 deletions generated-client/models/component.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions generated-client/models/job.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions generated-client/models/pipeline_parameters_deploy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 106 additions & 1 deletion generated-client/models/pipeline_run.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading