From f0d5b309167c5053d68ac39f1131339d331e56ee Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Tue, 16 Jan 2024 15:56:09 +0100 Subject: [PATCH 1/5] Added an option component to the create deploy pipeline job --- cmd/createDeployPipelineJob.go | 23 +- .../client/component/component_client.go | 41 ++ ...e_component_external_dns_tls_parameters.go | 291 +++++++++++ ...te_component_external_dns_tls_responses.go | 460 ++++++++++++++++++ generated-client/models/component.go | 62 +++ generated-client/models/external_dns.go | 126 +++++ generated-client/models/job.go | 4 - .../models/pipeline_parameters_deploy.go | 5 + generated-client/models/pipeline_run.go | 107 +++- generated-client/models/pipeline_run_task.go | 175 ++++++- .../models/pipeline_run_task_step.go | 107 +++- generated-client/models/secret.go | 89 +--- generated-client/models/secret_parameters.go | 8 +- generated-client/models/step.go | 40 +- generated-client/models/tls.go | 203 ++++++++ .../models/update_external_dns_tls_request.go | 91 ++++ generated-client/models/x509_certificate.go | 137 ++++++ 17 files changed, 1863 insertions(+), 106 deletions(-) create mode 100644 generated-client/client/component/update_component_external_dns_tls_parameters.go create mode 100644 generated-client/client/component/update_component_external_dns_tls_responses.go create mode 100644 generated-client/models/external_dns.go create mode 100644 generated-client/models/tls.go create mode 100644 generated-client/models/update_external_dns_tls_request.go create mode 100644 generated-client/models/x509_certificate.go diff --git a/cmd/createDeployPipelineJob.go b/cmd/createDeployPipelineJob.go index c4e4785..d10dacc 100644 --- a/cmd/createDeployPipelineJob.go +++ b/cmd/createDeployPipelineJob.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" "regexp" + "strings" log "github.com/sirupsen/logrus" @@ -44,6 +45,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 @@ -74,9 +78,13 @@ Examples: return errors.New("application name and target environment are required") } commitID, _ := cmd.Flags().GetString("commitID") - err2 := validateCommitID(commitID) - if err2 != nil { - return err2 + err = validateCommitID(commitID) + if err != nil { + return err + } + componentNames, err := cmd.Flags().GetStringSlice("component") + if err != nil { + errs = append(errs, err) } cmd.SilenceUsage = true @@ -88,12 +96,16 @@ Examples: triggerPipelineParams := application.NewTriggerPipelineDeployParams() triggerPipelineParams.SetAppName(*appName) - triggerPipelineParams.SetPipelineParametersDeploy(&models.PipelineParametersDeploy{ + parametersDeploy := models.PipelineParametersDeploy{ ToEnvironment: targetEnvironment, ImageTagNames: imageTagNames, TriggeredBy: triggeredByUser, CommitID: commitID, - }) + } + if components := strings.Join(componentNames, ","); len(components) > 0 { + parametersDeploy.Components = components + } + triggerPipelineParams.SetPipelineParametersDeploy(¶metersDeploy) newJob, err := apiClient.Application.TriggerPipelineDeploy(triggerPipelineParams, nil) if err != nil { @@ -130,6 +142,7 @@ func init() { createDeployPipelineJobCmd.Flags().StringP("user", "u", "", "The user who triggered the deploy") createDeployPipelineJobCmd.Flags().StringToStringP("image-tag-name", "t", map[string]string{}, "Image tag name for a component: component-name=tag-name. Multiple pairs can be specified.") createDeployPipelineJobCmd.Flags().StringP("commitID", "i", "", "An optional 40 character commit id to tag the new pipeline job") + createDeployPipelineJobCmd.Flags().StringSlice("component", []string{}, "Optional component to deploy, if only specific component need to be deployed") createDeployPipelineJobCmd.Flags().BoolP("follow", "f", false, "Follow deploy") setContextSpecificPersistentFlags(createDeployPipelineJobCmd) } diff --git a/generated-client/client/component/component_client.go b/generated-client/client/component/component_client.go index d98fa2f..1587575 100644 --- a/generated-client/client/component/component_client.go +++ b/generated-client/client/component/component_client.go @@ -52,6 +52,8 @@ type ClientService interface { StopComponent(params *StopComponentParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StopComponentOK, error) + UpdateComponentExternalDNSTLS(params *UpdateComponentExternalDNSTLSParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateComponentExternalDNSTLSOK, error) + SetTransport(transport runtime.ClientTransport) } @@ -484,6 +486,45 @@ func (a *Client) StopComponent(params *StopComponentParams, authInfo runtime.Cli panic(msg) } +/* +UpdateComponentExternalDNSTLS sets external DNS TLS private key certificate for a component +*/ +func (a *Client) UpdateComponentExternalDNSTLS(params *UpdateComponentExternalDNSTLSParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateComponentExternalDNSTLSOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUpdateComponentExternalDNSTLSParams() + } + op := &runtime.ClientOperation{ + ID: "updateComponentExternalDnsTls", + Method: "PUT", + PathPattern: "/applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UpdateComponentExternalDNSTLSReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UpdateComponentExternalDNSTLSOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for updateComponentExternalDnsTls: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport diff --git a/generated-client/client/component/update_component_external_dns_tls_parameters.go b/generated-client/client/component/update_component_external_dns_tls_parameters.go new file mode 100644 index 0000000..7413cba --- /dev/null +++ b/generated-client/client/component/update_component_external_dns_tls_parameters.go @@ -0,0 +1,291 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package component + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/equinor/radix-cli/generated-client/models" +) + +// NewUpdateComponentExternalDNSTLSParams creates a new UpdateComponentExternalDNSTLSParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUpdateComponentExternalDNSTLSParams() *UpdateComponentExternalDNSTLSParams { + return &UpdateComponentExternalDNSTLSParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUpdateComponentExternalDNSTLSParamsWithTimeout creates a new UpdateComponentExternalDNSTLSParams object +// with the ability to set a timeout on a request. +func NewUpdateComponentExternalDNSTLSParamsWithTimeout(timeout time.Duration) *UpdateComponentExternalDNSTLSParams { + return &UpdateComponentExternalDNSTLSParams{ + timeout: timeout, + } +} + +// NewUpdateComponentExternalDNSTLSParamsWithContext creates a new UpdateComponentExternalDNSTLSParams object +// with the ability to set a context for a request. +func NewUpdateComponentExternalDNSTLSParamsWithContext(ctx context.Context) *UpdateComponentExternalDNSTLSParams { + return &UpdateComponentExternalDNSTLSParams{ + Context: ctx, + } +} + +// NewUpdateComponentExternalDNSTLSParamsWithHTTPClient creates a new UpdateComponentExternalDNSTLSParams object +// with the ability to set a custom HTTPClient for a request. +func NewUpdateComponentExternalDNSTLSParamsWithHTTPClient(client *http.Client) *UpdateComponentExternalDNSTLSParams { + return &UpdateComponentExternalDNSTLSParams{ + HTTPClient: client, + } +} + +/* +UpdateComponentExternalDNSTLSParams contains all the parameters to send to the API endpoint + + for the update component external Dns Tls operation. + + Typically these are written to a http.Request. +*/ +type UpdateComponentExternalDNSTLSParams struct { + + /* ImpersonateGroup. + + Works only with custom setup of cluster. Allow impersonation of a comma-seperated list of test groups (Required if Impersonate-User is set) + */ + ImpersonateGroup *string + + /* ImpersonateUser. + + Works only with custom setup of cluster. Allow impersonation of test users (Required if Impersonate-Group is set) + */ + ImpersonateUser *string + + /* AppName. + + Name of application + */ + AppName string + + /* ComponentName. + + secret component of Radix application + */ + ComponentName string + + /* EnvName. + + secret of Radix application + */ + EnvName string + + /* Fqdn. + + FQDN to be updated + */ + Fqdn string + + /* TLSData. + + New TLS private key and certificate + */ + TLSData *models.UpdateExternalDNSTLSRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the update component external Dns Tls params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateComponentExternalDNSTLSParams) WithDefaults() *UpdateComponentExternalDNSTLSParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the update component external Dns Tls params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UpdateComponentExternalDNSTLSParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithTimeout(timeout time.Duration) *UpdateComponentExternalDNSTLSParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithContext(ctx context.Context) *UpdateComponentExternalDNSTLSParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithHTTPClient(client *http.Client) *UpdateComponentExternalDNSTLSParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithImpersonateGroup adds the impersonateGroup to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithImpersonateGroup(impersonateGroup *string) *UpdateComponentExternalDNSTLSParams { + o.SetImpersonateGroup(impersonateGroup) + return o +} + +// SetImpersonateGroup adds the impersonateGroup to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetImpersonateGroup(impersonateGroup *string) { + o.ImpersonateGroup = impersonateGroup +} + +// WithImpersonateUser adds the impersonateUser to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithImpersonateUser(impersonateUser *string) *UpdateComponentExternalDNSTLSParams { + o.SetImpersonateUser(impersonateUser) + return o +} + +// SetImpersonateUser adds the impersonateUser to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetImpersonateUser(impersonateUser *string) { + o.ImpersonateUser = impersonateUser +} + +// WithAppName adds the appName to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithAppName(appName string) *UpdateComponentExternalDNSTLSParams { + o.SetAppName(appName) + return o +} + +// SetAppName adds the appName to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetAppName(appName string) { + o.AppName = appName +} + +// WithComponentName adds the componentName to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithComponentName(componentName string) *UpdateComponentExternalDNSTLSParams { + o.SetComponentName(componentName) + return o +} + +// SetComponentName adds the componentName to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetComponentName(componentName string) { + o.ComponentName = componentName +} + +// WithEnvName adds the envName to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithEnvName(envName string) *UpdateComponentExternalDNSTLSParams { + o.SetEnvName(envName) + return o +} + +// SetEnvName adds the envName to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetEnvName(envName string) { + o.EnvName = envName +} + +// WithFqdn adds the fqdn to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithFqdn(fqdn string) *UpdateComponentExternalDNSTLSParams { + o.SetFqdn(fqdn) + return o +} + +// SetFqdn adds the fqdn to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetFqdn(fqdn string) { + o.Fqdn = fqdn +} + +// WithTLSData adds the tLSData to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) WithTLSData(tLSData *models.UpdateExternalDNSTLSRequest) *UpdateComponentExternalDNSTLSParams { + o.SetTLSData(tLSData) + return o +} + +// SetTLSData adds the tlsData to the update component external Dns Tls params +func (o *UpdateComponentExternalDNSTLSParams) SetTLSData(tLSData *models.UpdateExternalDNSTLSRequest) { + o.TLSData = tLSData +} + +// WriteToRequest writes these params to a swagger request +func (o *UpdateComponentExternalDNSTLSParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ImpersonateGroup != nil { + + // header param Impersonate-Group + if err := r.SetHeaderParam("Impersonate-Group", *o.ImpersonateGroup); err != nil { + return err + } + } + + if o.ImpersonateUser != nil { + + // header param Impersonate-User + if err := r.SetHeaderParam("Impersonate-User", *o.ImpersonateUser); err != nil { + return err + } + } + + // path param appName + if err := r.SetPathParam("appName", o.AppName); err != nil { + return err + } + + // path param componentName + if err := r.SetPathParam("componentName", o.ComponentName); err != nil { + return err + } + + // path param envName + if err := r.SetPathParam("envName", o.EnvName); err != nil { + return err + } + + // path param fqdn + if err := r.SetPathParam("fqdn", o.Fqdn); err != nil { + return err + } + if o.TLSData != nil { + if err := r.SetBodyParam(o.TLSData); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/generated-client/client/component/update_component_external_dns_tls_responses.go b/generated-client/client/component/update_component_external_dns_tls_responses.go new file mode 100644 index 0000000..8b4ed00 --- /dev/null +++ b/generated-client/client/component/update_component_external_dns_tls_responses.go @@ -0,0 +1,460 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package component + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// UpdateComponentExternalDNSTLSReader is a Reader for the UpdateComponentExternalDNSTLS structure. +type UpdateComponentExternalDNSTLSReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UpdateComponentExternalDNSTLSReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUpdateComponentExternalDNSTLSOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewUpdateComponentExternalDNSTLSBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewUpdateComponentExternalDNSTLSUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewUpdateComponentExternalDNSTLSForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewUpdateComponentExternalDNSTLSNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewUpdateComponentExternalDNSTLSConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUpdateComponentExternalDNSTLSInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls] updateComponentExternalDnsTls", response, response.Code()) + } +} + +// NewUpdateComponentExternalDNSTLSOK creates a UpdateComponentExternalDNSTLSOK with default headers values +func NewUpdateComponentExternalDNSTLSOK() *UpdateComponentExternalDNSTLSOK { + return &UpdateComponentExternalDNSTLSOK{} +} + +/* +UpdateComponentExternalDNSTLSOK describes a response with status code 200, with default header values. + +success +*/ +type UpdateComponentExternalDNSTLSOK struct { +} + +// IsSuccess returns true when this update component external Dns Tls o k response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this update component external Dns Tls o k response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls o k response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this update component external Dns Tls o k response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSOK) IsServerError() bool { + return false +} + +// IsCode returns true when this update component external Dns Tls o k response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the update component external Dns Tls o k response +func (o *UpdateComponentExternalDNSTLSOK) Code() int { + return 200 +} + +func (o *UpdateComponentExternalDNSTLSOK) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsOK ", 200) +} + +func (o *UpdateComponentExternalDNSTLSOK) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsOK ", 200) +} + +func (o *UpdateComponentExternalDNSTLSOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateComponentExternalDNSTLSBadRequest creates a UpdateComponentExternalDNSTLSBadRequest with default headers values +func NewUpdateComponentExternalDNSTLSBadRequest() *UpdateComponentExternalDNSTLSBadRequest { + return &UpdateComponentExternalDNSTLSBadRequest{} +} + +/* +UpdateComponentExternalDNSTLSBadRequest describes a response with status code 400, with default header values. + +Invalid application +*/ +type UpdateComponentExternalDNSTLSBadRequest struct { +} + +// IsSuccess returns true when this update component external Dns Tls bad request response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update component external Dns Tls bad request response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls bad request response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this update component external Dns Tls bad request response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this update component external Dns Tls bad request response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the update component external Dns Tls bad request response +func (o *UpdateComponentExternalDNSTLSBadRequest) Code() int { + return 400 +} + +func (o *UpdateComponentExternalDNSTLSBadRequest) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsBadRequest ", 400) +} + +func (o *UpdateComponentExternalDNSTLSBadRequest) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsBadRequest ", 400) +} + +func (o *UpdateComponentExternalDNSTLSBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateComponentExternalDNSTLSUnauthorized creates a UpdateComponentExternalDNSTLSUnauthorized with default headers values +func NewUpdateComponentExternalDNSTLSUnauthorized() *UpdateComponentExternalDNSTLSUnauthorized { + return &UpdateComponentExternalDNSTLSUnauthorized{} +} + +/* +UpdateComponentExternalDNSTLSUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type UpdateComponentExternalDNSTLSUnauthorized struct { +} + +// IsSuccess returns true when this update component external Dns Tls unauthorized response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update component external Dns Tls unauthorized response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls unauthorized response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this update component external Dns Tls unauthorized response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this update component external Dns Tls unauthorized response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the update component external Dns Tls unauthorized response +func (o *UpdateComponentExternalDNSTLSUnauthorized) Code() int { + return 401 +} + +func (o *UpdateComponentExternalDNSTLSUnauthorized) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsUnauthorized ", 401) +} + +func (o *UpdateComponentExternalDNSTLSUnauthorized) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsUnauthorized ", 401) +} + +func (o *UpdateComponentExternalDNSTLSUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateComponentExternalDNSTLSForbidden creates a UpdateComponentExternalDNSTLSForbidden with default headers values +func NewUpdateComponentExternalDNSTLSForbidden() *UpdateComponentExternalDNSTLSForbidden { + return &UpdateComponentExternalDNSTLSForbidden{} +} + +/* +UpdateComponentExternalDNSTLSForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type UpdateComponentExternalDNSTLSForbidden struct { +} + +// IsSuccess returns true when this update component external Dns Tls forbidden response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update component external Dns Tls forbidden response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls forbidden response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this update component external Dns Tls forbidden response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this update component external Dns Tls forbidden response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the update component external Dns Tls forbidden response +func (o *UpdateComponentExternalDNSTLSForbidden) Code() int { + return 403 +} + +func (o *UpdateComponentExternalDNSTLSForbidden) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsForbidden ", 403) +} + +func (o *UpdateComponentExternalDNSTLSForbidden) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsForbidden ", 403) +} + +func (o *UpdateComponentExternalDNSTLSForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateComponentExternalDNSTLSNotFound creates a UpdateComponentExternalDNSTLSNotFound with default headers values +func NewUpdateComponentExternalDNSTLSNotFound() *UpdateComponentExternalDNSTLSNotFound { + return &UpdateComponentExternalDNSTLSNotFound{} +} + +/* +UpdateComponentExternalDNSTLSNotFound describes a response with status code 404, with default header values. + +Not found +*/ +type UpdateComponentExternalDNSTLSNotFound struct { +} + +// IsSuccess returns true when this update component external Dns Tls not found response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update component external Dns Tls not found response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls not found response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this update component external Dns Tls not found response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this update component external Dns Tls not found response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the update component external Dns Tls not found response +func (o *UpdateComponentExternalDNSTLSNotFound) Code() int { + return 404 +} + +func (o *UpdateComponentExternalDNSTLSNotFound) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsNotFound ", 404) +} + +func (o *UpdateComponentExternalDNSTLSNotFound) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsNotFound ", 404) +} + +func (o *UpdateComponentExternalDNSTLSNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateComponentExternalDNSTLSConflict creates a UpdateComponentExternalDNSTLSConflict with default headers values +func NewUpdateComponentExternalDNSTLSConflict() *UpdateComponentExternalDNSTLSConflict { + return &UpdateComponentExternalDNSTLSConflict{} +} + +/* +UpdateComponentExternalDNSTLSConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type UpdateComponentExternalDNSTLSConflict struct { +} + +// IsSuccess returns true when this update component external Dns Tls conflict response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update component external Dns Tls conflict response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls conflict response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this update component external Dns Tls conflict response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this update component external Dns Tls conflict response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the update component external Dns Tls conflict response +func (o *UpdateComponentExternalDNSTLSConflict) Code() int { + return 409 +} + +func (o *UpdateComponentExternalDNSTLSConflict) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsConflict ", 409) +} + +func (o *UpdateComponentExternalDNSTLSConflict) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsConflict ", 409) +} + +func (o *UpdateComponentExternalDNSTLSConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUpdateComponentExternalDNSTLSInternalServerError creates a UpdateComponentExternalDNSTLSInternalServerError with default headers values +func NewUpdateComponentExternalDNSTLSInternalServerError() *UpdateComponentExternalDNSTLSInternalServerError { + return &UpdateComponentExternalDNSTLSInternalServerError{} +} + +/* +UpdateComponentExternalDNSTLSInternalServerError describes a response with status code 500, with default header values. + +Internal server error +*/ +type UpdateComponentExternalDNSTLSInternalServerError struct { +} + +// IsSuccess returns true when this update component external Dns Tls internal server error response has a 2xx status code +func (o *UpdateComponentExternalDNSTLSInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this update component external Dns Tls internal server error response has a 3xx status code +func (o *UpdateComponentExternalDNSTLSInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this update component external Dns Tls internal server error response has a 4xx status code +func (o *UpdateComponentExternalDNSTLSInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this update component external Dns Tls internal server error response has a 5xx status code +func (o *UpdateComponentExternalDNSTLSInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this update component external Dns Tls internal server error response a status code equal to that given +func (o *UpdateComponentExternalDNSTLSInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the update component external Dns Tls internal server error response +func (o *UpdateComponentExternalDNSTLSInternalServerError) Code() int { + return 500 +} + +func (o *UpdateComponentExternalDNSTLSInternalServerError) Error() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsInternalServerError ", 500) +} + +func (o *UpdateComponentExternalDNSTLSInternalServerError) String() string { + return fmt.Sprintf("[PUT /applications/{appName}/environments/{envName}/components/{componentName}/externaldns/{fqdn}/tls][%d] updateComponentExternalDnsTlsInternalServerError ", 500) +} + +func (o *UpdateComponentExternalDNSTLSInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/generated-client/models/component.go b/generated-client/models/component.go index df70340..d1d70e4 100644 --- a/generated-client/models/component.go +++ b/generated-client/models/component.go @@ -21,6 +21,9 @@ import ( // swagger:model Component type Component struct { + // Array of external DNS configurations + ExternalDNS []*ExternalDNS `json:"externalDNS"` + // Image name // Example: radixdev.azurecr.io/app-server:cdgkg // Required: true @@ -84,6 +87,10 @@ type Component struct { func (m *Component) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateExternalDNS(formats); err != nil { + res = append(res, err) + } + if err := m.validateImage(formats); err != nil { res = append(res, err) } @@ -130,6 +137,32 @@ func (m *Component) Validate(formats strfmt.Registry) error { return nil } +func (m *Component) validateExternalDNS(formats strfmt.Registry) error { + if swag.IsZero(m.ExternalDNS) { // not required + return nil + } + + for i := 0; i < len(m.ExternalDNS); i++ { + if swag.IsZero(m.ExternalDNS[i]) { // not required + continue + } + + if m.ExternalDNS[i] != nil { + if err := m.ExternalDNS[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("externalDNS" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("externalDNS" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *Component) validateImage(formats strfmt.Registry) error { if err := validate.Required("image", "body", m.Image); err != nil { @@ -374,6 +407,10 @@ func (m *Component) validateOauth2(formats strfmt.Registry) error { func (m *Component) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateExternalDNS(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidatePorts(ctx, formats); err != nil { res = append(res, err) } @@ -404,6 +441,31 @@ func (m *Component) ContextValidate(ctx context.Context, formats strfmt.Registry return nil } +func (m *Component) contextValidateExternalDNS(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ExternalDNS); i++ { + + if m.ExternalDNS[i] != nil { + + if swag.IsZero(m.ExternalDNS[i]) { // not required + return nil + } + + if err := m.ExternalDNS[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("externalDNS" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("externalDNS" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *Component) contextValidatePorts(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Ports); i++ { diff --git a/generated-client/models/external_dns.go b/generated-client/models/external_dns.go new file mode 100644 index 0000000..d5239d8 --- /dev/null +++ b/generated-client/models/external_dns.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ExternalDNS ExternalDNS describes an external DNS entry for a component +// +// swagger:model ExternalDNS +type ExternalDNS struct { + + // Fully Qualified Domain Name + // Example: site.example.com + // Required: true + FQDN *string `json:"fqdn"` + + // tls + // Required: true + TLS *TLS `json:"tls"` +} + +// Validate validates this external DNS +func (m *ExternalDNS) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFQDN(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTLS(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExternalDNS) validateFQDN(formats strfmt.Registry) error { + + if err := validate.Required("fqdn", "body", m.FQDN); err != nil { + return err + } + + return nil +} + +func (m *ExternalDNS) validateTLS(formats strfmt.Registry) error { + + if err := validate.Required("tls", "body", m.TLS); err != nil { + return err + } + + if m.TLS != nil { + if err := m.TLS.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tls") + } + return err + } + } + + return nil +} + +// ContextValidate validate this external DNS based on the context it is used +func (m *ExternalDNS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTLS(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExternalDNS) contextValidateTLS(ctx context.Context, formats strfmt.Registry) error { + + if m.TLS != nil { + + if err := m.TLS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tls") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ExternalDNS) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExternalDNS) UnmarshalBinary(b []byte) error { + var res ExternalDNS + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/generated-client/models/job.go b/generated-client/models/job.go index 37fa653..489e8c6 100644 --- a/generated-client/models/job.go +++ b/generated-client/models/job.go @@ -58,10 +58,6 @@ type Job struct { // Enum: [build build-deploy promote deploy] Pipeline string `json:"pipeline,omitempty"` - // PromotedDeploymentName the name of the deployment that was promoted - // Example: component-6hznh - PromotedDeploymentName string `json:"promotedDeploymentName,omitempty"` - // RadixDeployment name, which is promoted PromotedFromDeployment string `json:"promotedFromDeployment,omitempty"` diff --git a/generated-client/models/pipeline_parameters_deploy.go b/generated-client/models/pipeline_parameters_deploy.go index 35c43ca..d7a589e 100644 --- a/generated-client/models/pipeline_parameters_deploy.go +++ b/generated-client/models/pipeline_parameters_deploy.go @@ -22,6 +22,11 @@ type PipelineParametersDeploy struct { // Example: 4faca8595c5283a9d0f17a623b9255a0d9866a2e CommitID string `json:"commitID,omitempty"` + // Components List of components to deploy + // OPTIONAL If specified, only these components are deployed + // Example: component1,component2 + Components string `json:"components,omitempty"` + // Image tags names for components // Example: component1=tag1,component2=tag2 ImageTagNames map[string]string `json:"imageTagNames,omitempty"` diff --git a/generated-client/models/pipeline_run.go b/generated-client/models/pipeline_run.go index f564f22..9c74cc3 100644 --- a/generated-client/models/pipeline_run.go +++ b/generated-client/models/pipeline_run.go @@ -7,6 +7,7 @@ package models import ( "context" + "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -43,7 +44,23 @@ type PipelineRun struct { Started string `json:"started,omitempty"` // Status of the step - // Example: Started + // Started TaskRunReasonStarted TaskRunReasonStarted is the reason set when the TaskRun has just started + // Running TaskRunReasonRunning TaskRunReasonRunning is the reason set when the TaskRun is running + // Succeeded TaskRunReasonSuccessful TaskRunReasonSuccessful is the reason set when the TaskRun completed successfully + // Failed TaskRunReasonFailed TaskRunReasonFailed is the reason set when the TaskRun completed with a failure + // ToBeRetried TaskRunReasonToBeRetried TaskRunReasonToBeRetried is the reason set when the last TaskRun execution failed, and will be retried + // TaskRunCancelled TaskRunReasonCancelled TaskRunReasonCancelled is the reason set when the TaskRun is cancelled by the user + // TaskRunTimeout TaskRunReasonTimedOut TaskRunReasonTimedOut is the reason set when one TaskRun execution has timed out + // TaskRunImagePullFailed TaskRunReasonImagePullFailed TaskRunReasonImagePullFailed is the reason set when the step of a task fails due to image not being pulled + // TaskRunResultLargerThanAllowedLimit TaskRunReasonResultLargerThanAllowedLimit TaskRunReasonResultLargerThanAllowedLimit is the reason set when one of the results exceeds its maximum allowed limit of 1 KB + // TaskRunStopSidecarFailed TaskRunReasonStopSidecarFailed TaskRunReasonStopSidecarFailed indicates that the sidecar is not properly stopped. + // InvalidParamValue TaskRunReasonInvalidParamValue TaskRunReasonInvalidParamValue indicates that the TaskRun Param input value is not allowed. + // TaskRunResolutionFailed TaskRunReasonFailedResolution TaskRunReasonFailedResolution indicated that the reason for failure status is that references within the TaskRun could not be resolved + // TaskRunValidationFailed TaskRunReasonFailedValidation TaskRunReasonFailedValidation indicated that the reason for failure status is that taskrun failed runtime validation + // TaskValidationFailed TaskRunReasonTaskFailedValidation TaskRunReasonTaskFailedValidation indicated that the reason for failure status is that task failed runtime validation + // ResourceVerificationFailed TaskRunReasonResourceVerificationFailed TaskRunReasonResourceVerificationFailed indicates that the task fails the trusted resource verification, it could be the content has changed, signature is invalid or public key is invalid + // FailureIgnored TaskRunReasonFailureIgnored TaskRunReasonFailureIgnored is the reason set when the Taskrun has failed due to pod execution error and the failure is ignored for the owning PipelineRun. TaskRuns failed due to reconciler/validation error should not use this reason. + // Enum: [Started Running Succeeded Failed ToBeRetried TaskRunCancelled TaskRunTimeout TaskRunImagePullFailed TaskRunResultLargerThanAllowedLimit TaskRunStopSidecarFailed InvalidParamValue TaskRunResolutionFailed TaskRunValidationFailed TaskValidationFailed ResourceVerificationFailed FailureIgnored] Status string `json:"status,omitempty"` // StatusMessage of the task @@ -66,6 +83,10 @@ func (m *PipelineRun) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -99,6 +120,90 @@ func (m *PipelineRun) validateRealName(formats strfmt.Registry) error { return nil } +var pipelineRunTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Started","Running","Succeeded","Failed","ToBeRetried","TaskRunCancelled","TaskRunTimeout","TaskRunImagePullFailed","TaskRunResultLargerThanAllowedLimit","TaskRunStopSidecarFailed","InvalidParamValue","TaskRunResolutionFailed","TaskRunValidationFailed","TaskValidationFailed","ResourceVerificationFailed","FailureIgnored"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pipelineRunTypeStatusPropEnum = append(pipelineRunTypeStatusPropEnum, v) + } +} + +const ( + + // PipelineRunStatusStarted captures enum value "Started" + PipelineRunStatusStarted string = "Started" + + // PipelineRunStatusRunning captures enum value "Running" + PipelineRunStatusRunning string = "Running" + + // PipelineRunStatusSucceeded captures enum value "Succeeded" + PipelineRunStatusSucceeded string = "Succeeded" + + // PipelineRunStatusFailed captures enum value "Failed" + PipelineRunStatusFailed string = "Failed" + + // PipelineRunStatusToBeRetried captures enum value "ToBeRetried" + PipelineRunStatusToBeRetried string = "ToBeRetried" + + // PipelineRunStatusTaskRunCancelled captures enum value "TaskRunCancelled" + PipelineRunStatusTaskRunCancelled string = "TaskRunCancelled" + + // PipelineRunStatusTaskRunTimeout captures enum value "TaskRunTimeout" + PipelineRunStatusTaskRunTimeout string = "TaskRunTimeout" + + // PipelineRunStatusTaskRunImagePullFailed captures enum value "TaskRunImagePullFailed" + PipelineRunStatusTaskRunImagePullFailed string = "TaskRunImagePullFailed" + + // PipelineRunStatusTaskRunResultLargerThanAllowedLimit captures enum value "TaskRunResultLargerThanAllowedLimit" + PipelineRunStatusTaskRunResultLargerThanAllowedLimit string = "TaskRunResultLargerThanAllowedLimit" + + // PipelineRunStatusTaskRunStopSidecarFailed captures enum value "TaskRunStopSidecarFailed" + PipelineRunStatusTaskRunStopSidecarFailed string = "TaskRunStopSidecarFailed" + + // PipelineRunStatusInvalidParamValue captures enum value "InvalidParamValue" + PipelineRunStatusInvalidParamValue string = "InvalidParamValue" + + // PipelineRunStatusTaskRunResolutionFailed captures enum value "TaskRunResolutionFailed" + PipelineRunStatusTaskRunResolutionFailed string = "TaskRunResolutionFailed" + + // PipelineRunStatusTaskRunValidationFailed captures enum value "TaskRunValidationFailed" + PipelineRunStatusTaskRunValidationFailed string = "TaskRunValidationFailed" + + // PipelineRunStatusTaskValidationFailed captures enum value "TaskValidationFailed" + PipelineRunStatusTaskValidationFailed string = "TaskValidationFailed" + + // PipelineRunStatusResourceVerificationFailed captures enum value "ResourceVerificationFailed" + PipelineRunStatusResourceVerificationFailed string = "ResourceVerificationFailed" + + // PipelineRunStatusFailureIgnored captures enum value "FailureIgnored" + PipelineRunStatusFailureIgnored string = "FailureIgnored" +) + +// prop value enum +func (m *PipelineRun) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pipelineRunTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PipelineRun) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + // value enum + if err := m.validateStatusEnum("status", "body", m.Status); err != nil { + return err + } + + return nil +} + // ContextValidate validates this pipeline run based on context it is used func (m *PipelineRun) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil diff --git a/generated-client/models/pipeline_run_task.go b/generated-client/models/pipeline_run_task.go index 6743667..3350933 100644 --- a/generated-client/models/pipeline_run_task.go +++ b/generated-client/models/pipeline_run_task.go @@ -7,6 +7,7 @@ package models import ( "context" + "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -48,7 +49,40 @@ type PipelineRunTask struct { Started string `json:"started,omitempty"` // Status of the task - // Example: Running + // Started PipelineRunReasonStarted PipelineRunReasonStarted is the reason set when the PipelineRun has just started + // Running PipelineRunReasonRunning PipelineRunReasonRunning is the reason set when the PipelineRun is running + // Succeeded PipelineRunReasonSuccessful PipelineRunReasonSuccessful is the reason set when the PipelineRun completed successfully + // Completed PipelineRunReasonCompleted PipelineRunReasonCompleted is the reason set when the PipelineRun completed successfully with one or more skipped Tasks + // Failed PipelineRunReasonFailed PipelineRunReasonFailed is the reason set when the PipelineRun completed with a failure + // Cancelled PipelineRunReasonCancelled PipelineRunReasonCancelled is the reason set when the PipelineRun cancelled by the user This reason may be found with a corev1.ConditionFalse status, if the cancellation was processed successfully This reason may be found with a corev1.ConditionUnknown status, if the cancellation is being processed or failed + // PipelineRunPending PipelineRunReasonPending PipelineRunReasonPending is the reason set when the PipelineRun is in the pending state + // PipelineRunTimeout PipelineRunReasonTimedOut PipelineRunReasonTimedOut is the reason set when the PipelineRun has timed out + // PipelineRunStopping PipelineRunReasonStopping PipelineRunReasonStopping indicates that no new Tasks will be scheduled by the controller, and the pipeline will stop once all running tasks complete their work + // CancelledRunningFinally PipelineRunReasonCancelledRunningFinally PipelineRunReasonCancelledRunningFinally indicates that pipeline has been gracefully cancelled and no new Tasks will be scheduled by the controller, but final tasks are now running + // StoppedRunningFinally PipelineRunReasonStoppedRunningFinally PipelineRunReasonStoppedRunningFinally indicates that pipeline has been gracefully stopped and no new Tasks will be scheduled by the controller, but final tasks are now running + // CouldntGetPipeline PipelineRunReasonCouldntGetPipeline ReasonCouldntGetPipeline indicates that the reason for the failure status is that the associated Pipeline couldn't be retrieved + // InvalidPipelineResourceBindings PipelineRunReasonInvalidBindings ReasonInvalidBindings indicates that the reason for the failure status is that the PipelineResources bound in the PipelineRun didn't match those declared in the Pipeline + // InvalidWorkspaceBindings PipelineRunReasonInvalidWorkspaceBinding ReasonInvalidWorkspaceBinding indicates that a Pipeline expects a workspace but a PipelineRun has provided an invalid binding. + // InvalidTaskRunSpecs PipelineRunReasonInvalidTaskRunSpec ReasonInvalidTaskRunSpec indicates that PipelineRun.Spec.TaskRunSpecs[].PipelineTaskName is defined with a not exist taskName in pipelineSpec. + // ParameterTypeMismatch PipelineRunReasonParameterTypeMismatch ReasonParameterTypeMismatch indicates that the reason for the failure status is that parameter(s) declared in the PipelineRun do not have the some declared type as the parameters(s) declared in the Pipeline that they are supposed to override. + // ObjectParameterMissKeys PipelineRunReasonObjectParameterMissKeys ReasonObjectParameterMissKeys indicates that the object param value provided from PipelineRun spec misses some keys required for the object param declared in Pipeline spec. + // ParamArrayIndexingInvalid PipelineRunReasonParamArrayIndexingInvalid ReasonParamArrayIndexingInvalid indicates that the use of param array indexing is not under correct api fields feature gate or the array is out of bound. + // CouldntGetTask PipelineRunReasonCouldntGetTask ReasonCouldntGetTask indicates that the reason for the failure status is that the associated Pipeline's Tasks couldn't all be retrieved + // ParameterMissing PipelineRunReasonParameterMissing ReasonParameterMissing indicates that the reason for the failure status is that the associated PipelineRun didn't provide all the required parameters + // PipelineValidationFailed PipelineRunReasonFailedValidation ReasonFailedValidation indicates that the reason for failure status is that pipelinerun failed runtime validation + // CouldntGetPipelineResult PipelineRunReasonCouldntGetPipelineResult PipelineRunReasonCouldntGetPipelineResult indicates that the pipeline fails to retrieve the referenced result. This could be due to failed TaskRuns or Runs that were supposed to produce the results + // PipelineInvalidGraph PipelineRunReasonInvalidGraph ReasonInvalidGraph indicates that the reason for the failure status is that the associated Pipeline is an invalid graph (a.k.a wrong order, cycle, …) + // PipelineRunCouldntCancel PipelineRunReasonCouldntCancel ReasonCouldntCancel indicates that a PipelineRun was cancelled but attempting to update all of the running TaskRuns as cancelled failed. + // PipelineRunCouldntTimeOut PipelineRunReasonCouldntTimeOut ReasonCouldntTimeOut indicates that a PipelineRun was timed out but attempting to update all of the running TaskRuns as timed out failed. + // InvalidMatrixParameterTypes PipelineRunReasonInvalidMatrixParameterTypes ReasonInvalidMatrixParameterTypes indicates a matrix contains invalid parameter types + // InvalidTaskResultReference PipelineRunReasonInvalidTaskResultReference ReasonInvalidTaskResultReference indicates a task result was declared but was not initialized by that task + // RequiredWorkspaceMarkedOptional PipelineRunReasonRequiredWorkspaceMarkedOptional ReasonRequiredWorkspaceMarkedOptional indicates an optional workspace has been passed to a Task that is expecting a non-optional workspace + // ResolvingPipelineRef PipelineRunReasonResolvingPipelineRef ReasonResolvingPipelineRef indicates that the PipelineRun is waiting for its pipelineRef to be asynchronously resolved. + // ResourceVerificationFailed PipelineRunReasonResourceVerificationFailed ReasonResourceVerificationFailed indicates that the pipeline fails the trusted resource verification, it could be the content has changed, signature is invalid or public key is invalid + // CreateRunFailed PipelineRunReasonCreateRunFailed ReasonCreateRunFailed indicates that the pipeline fails to create the taskrun or other run resources + // CELEvaluationFailed PipelineRunReasonCELEvaluationFailed ReasonCELEvaluationFailed indicates the pipeline fails the CEL evaluation + // InvalidParamValue PipelineRunReasonInvalidParamValue PipelineRunReasonInvalidParamValue indicates that the PipelineRun Param input value is not allowed. + // Enum: [Started Running Succeeded Completed Failed Cancelled PipelineRunPending PipelineRunTimeout PipelineRunStopping CancelledRunningFinally StoppedRunningFinally CouldntGetPipeline InvalidPipelineResourceBindings InvalidWorkspaceBindings InvalidTaskRunSpecs ParameterTypeMismatch ObjectParameterMissKeys ParamArrayIndexingInvalid CouldntGetTask ParameterMissing PipelineValidationFailed CouldntGetPipelineResult PipelineInvalidGraph PipelineRunCouldntCancel PipelineRunCouldntTimeOut InvalidMatrixParameterTypes InvalidTaskResultReference RequiredWorkspaceMarkedOptional ResolvingPipelineRef ResourceVerificationFailed CreateRunFailed CELEvaluationFailed InvalidParamValue] Status string `json:"status,omitempty"` // StatusMessage of the task @@ -75,6 +109,10 @@ func (m *PipelineRunTask) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -117,6 +155,141 @@ func (m *PipelineRunTask) validateRealName(formats strfmt.Registry) error { return nil } +var pipelineRunTaskTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Started","Running","Succeeded","Completed","Failed","Cancelled","PipelineRunPending","PipelineRunTimeout","PipelineRunStopping","CancelledRunningFinally","StoppedRunningFinally","CouldntGetPipeline","InvalidPipelineResourceBindings","InvalidWorkspaceBindings","InvalidTaskRunSpecs","ParameterTypeMismatch","ObjectParameterMissKeys","ParamArrayIndexingInvalid","CouldntGetTask","ParameterMissing","PipelineValidationFailed","CouldntGetPipelineResult","PipelineInvalidGraph","PipelineRunCouldntCancel","PipelineRunCouldntTimeOut","InvalidMatrixParameterTypes","InvalidTaskResultReference","RequiredWorkspaceMarkedOptional","ResolvingPipelineRef","ResourceVerificationFailed","CreateRunFailed","CELEvaluationFailed","InvalidParamValue"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pipelineRunTaskTypeStatusPropEnum = append(pipelineRunTaskTypeStatusPropEnum, v) + } +} + +const ( + + // PipelineRunTaskStatusStarted captures enum value "Started" + PipelineRunTaskStatusStarted string = "Started" + + // PipelineRunTaskStatusRunning captures enum value "Running" + PipelineRunTaskStatusRunning string = "Running" + + // PipelineRunTaskStatusSucceeded captures enum value "Succeeded" + PipelineRunTaskStatusSucceeded string = "Succeeded" + + // PipelineRunTaskStatusCompleted captures enum value "Completed" + PipelineRunTaskStatusCompleted string = "Completed" + + // PipelineRunTaskStatusFailed captures enum value "Failed" + PipelineRunTaskStatusFailed string = "Failed" + + // PipelineRunTaskStatusCancelled captures enum value "Cancelled" + PipelineRunTaskStatusCancelled string = "Cancelled" + + // PipelineRunTaskStatusPipelineRunPending captures enum value "PipelineRunPending" + PipelineRunTaskStatusPipelineRunPending string = "PipelineRunPending" + + // PipelineRunTaskStatusPipelineRunTimeout captures enum value "PipelineRunTimeout" + PipelineRunTaskStatusPipelineRunTimeout string = "PipelineRunTimeout" + + // PipelineRunTaskStatusPipelineRunStopping captures enum value "PipelineRunStopping" + PipelineRunTaskStatusPipelineRunStopping string = "PipelineRunStopping" + + // PipelineRunTaskStatusCancelledRunningFinally captures enum value "CancelledRunningFinally" + PipelineRunTaskStatusCancelledRunningFinally string = "CancelledRunningFinally" + + // PipelineRunTaskStatusStoppedRunningFinally captures enum value "StoppedRunningFinally" + PipelineRunTaskStatusStoppedRunningFinally string = "StoppedRunningFinally" + + // PipelineRunTaskStatusCouldntGetPipeline captures enum value "CouldntGetPipeline" + PipelineRunTaskStatusCouldntGetPipeline string = "CouldntGetPipeline" + + // PipelineRunTaskStatusInvalidPipelineResourceBindings captures enum value "InvalidPipelineResourceBindings" + PipelineRunTaskStatusInvalidPipelineResourceBindings string = "InvalidPipelineResourceBindings" + + // PipelineRunTaskStatusInvalidWorkspaceBindings captures enum value "InvalidWorkspaceBindings" + PipelineRunTaskStatusInvalidWorkspaceBindings string = "InvalidWorkspaceBindings" + + // PipelineRunTaskStatusInvalidTaskRunSpecs captures enum value "InvalidTaskRunSpecs" + PipelineRunTaskStatusInvalidTaskRunSpecs string = "InvalidTaskRunSpecs" + + // PipelineRunTaskStatusParameterTypeMismatch captures enum value "ParameterTypeMismatch" + PipelineRunTaskStatusParameterTypeMismatch string = "ParameterTypeMismatch" + + // PipelineRunTaskStatusObjectParameterMissKeys captures enum value "ObjectParameterMissKeys" + PipelineRunTaskStatusObjectParameterMissKeys string = "ObjectParameterMissKeys" + + // PipelineRunTaskStatusParamArrayIndexingInvalid captures enum value "ParamArrayIndexingInvalid" + PipelineRunTaskStatusParamArrayIndexingInvalid string = "ParamArrayIndexingInvalid" + + // PipelineRunTaskStatusCouldntGetTask captures enum value "CouldntGetTask" + PipelineRunTaskStatusCouldntGetTask string = "CouldntGetTask" + + // PipelineRunTaskStatusParameterMissing captures enum value "ParameterMissing" + PipelineRunTaskStatusParameterMissing string = "ParameterMissing" + + // PipelineRunTaskStatusPipelineValidationFailed captures enum value "PipelineValidationFailed" + PipelineRunTaskStatusPipelineValidationFailed string = "PipelineValidationFailed" + + // PipelineRunTaskStatusCouldntGetPipelineResult captures enum value "CouldntGetPipelineResult" + PipelineRunTaskStatusCouldntGetPipelineResult string = "CouldntGetPipelineResult" + + // PipelineRunTaskStatusPipelineInvalidGraph captures enum value "PipelineInvalidGraph" + PipelineRunTaskStatusPipelineInvalidGraph string = "PipelineInvalidGraph" + + // PipelineRunTaskStatusPipelineRunCouldntCancel captures enum value "PipelineRunCouldntCancel" + PipelineRunTaskStatusPipelineRunCouldntCancel string = "PipelineRunCouldntCancel" + + // PipelineRunTaskStatusPipelineRunCouldntTimeOut captures enum value "PipelineRunCouldntTimeOut" + PipelineRunTaskStatusPipelineRunCouldntTimeOut string = "PipelineRunCouldntTimeOut" + + // PipelineRunTaskStatusInvalidMatrixParameterTypes captures enum value "InvalidMatrixParameterTypes" + PipelineRunTaskStatusInvalidMatrixParameterTypes string = "InvalidMatrixParameterTypes" + + // PipelineRunTaskStatusInvalidTaskResultReference captures enum value "InvalidTaskResultReference" + PipelineRunTaskStatusInvalidTaskResultReference string = "InvalidTaskResultReference" + + // PipelineRunTaskStatusRequiredWorkspaceMarkedOptional captures enum value "RequiredWorkspaceMarkedOptional" + PipelineRunTaskStatusRequiredWorkspaceMarkedOptional string = "RequiredWorkspaceMarkedOptional" + + // PipelineRunTaskStatusResolvingPipelineRef captures enum value "ResolvingPipelineRef" + PipelineRunTaskStatusResolvingPipelineRef string = "ResolvingPipelineRef" + + // PipelineRunTaskStatusResourceVerificationFailed captures enum value "ResourceVerificationFailed" + PipelineRunTaskStatusResourceVerificationFailed string = "ResourceVerificationFailed" + + // PipelineRunTaskStatusCreateRunFailed captures enum value "CreateRunFailed" + PipelineRunTaskStatusCreateRunFailed string = "CreateRunFailed" + + // PipelineRunTaskStatusCELEvaluationFailed captures enum value "CELEvaluationFailed" + PipelineRunTaskStatusCELEvaluationFailed string = "CELEvaluationFailed" + + // PipelineRunTaskStatusInvalidParamValue captures enum value "InvalidParamValue" + PipelineRunTaskStatusInvalidParamValue string = "InvalidParamValue" +) + +// prop value enum +func (m *PipelineRunTask) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pipelineRunTaskTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PipelineRunTask) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + // value enum + if err := m.validateStatusEnum("status", "body", m.Status); err != nil { + return err + } + + return nil +} + // ContextValidate validates this pipeline run task based on context it is used func (m *PipelineRunTask) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil diff --git a/generated-client/models/pipeline_run_task_step.go b/generated-client/models/pipeline_run_task_step.go index 9815aaa..4f76ecb 100644 --- a/generated-client/models/pipeline_run_task_step.go +++ b/generated-client/models/pipeline_run_task_step.go @@ -7,6 +7,7 @@ package models import ( "context" + "encoding/json" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -33,7 +34,23 @@ type PipelineRunTaskStep struct { Started string `json:"started,omitempty"` // Status of the task - // Example: Completed + // Started TaskRunReasonStarted TaskRunReasonStarted is the reason set when the TaskRun has just started + // Running TaskRunReasonRunning TaskRunReasonRunning is the reason set when the TaskRun is running + // Succeeded TaskRunReasonSuccessful TaskRunReasonSuccessful is the reason set when the TaskRun completed successfully + // Failed TaskRunReasonFailed TaskRunReasonFailed is the reason set when the TaskRun completed with a failure + // ToBeRetried TaskRunReasonToBeRetried TaskRunReasonToBeRetried is the reason set when the last TaskRun execution failed, and will be retried + // TaskRunCancelled TaskRunReasonCancelled TaskRunReasonCancelled is the reason set when the TaskRun is cancelled by the user + // TaskRunTimeout TaskRunReasonTimedOut TaskRunReasonTimedOut is the reason set when one TaskRun execution has timed out + // TaskRunImagePullFailed TaskRunReasonImagePullFailed TaskRunReasonImagePullFailed is the reason set when the step of a task fails due to image not being pulled + // TaskRunResultLargerThanAllowedLimit TaskRunReasonResultLargerThanAllowedLimit TaskRunReasonResultLargerThanAllowedLimit is the reason set when one of the results exceeds its maximum allowed limit of 1 KB + // TaskRunStopSidecarFailed TaskRunReasonStopSidecarFailed TaskRunReasonStopSidecarFailed indicates that the sidecar is not properly stopped. + // InvalidParamValue TaskRunReasonInvalidParamValue TaskRunReasonInvalidParamValue indicates that the TaskRun Param input value is not allowed. + // TaskRunResolutionFailed TaskRunReasonFailedResolution TaskRunReasonFailedResolution indicated that the reason for failure status is that references within the TaskRun could not be resolved + // TaskRunValidationFailed TaskRunReasonFailedValidation TaskRunReasonFailedValidation indicated that the reason for failure status is that taskrun failed runtime validation + // TaskValidationFailed TaskRunReasonTaskFailedValidation TaskRunReasonTaskFailedValidation indicated that the reason for failure status is that task failed runtime validation + // ResourceVerificationFailed TaskRunReasonResourceVerificationFailed TaskRunReasonResourceVerificationFailed indicates that the task fails the trusted resource verification, it could be the content has changed, signature is invalid or public key is invalid + // FailureIgnored TaskRunReasonFailureIgnored TaskRunReasonFailureIgnored is the reason set when the Taskrun has failed due to pod execution error and the failure is ignored for the owning PipelineRun. TaskRuns failed due to reconciler/validation error should not use this reason. + // Enum: [Started Running Succeeded Failed ToBeRetried TaskRunCancelled TaskRunTimeout TaskRunImagePullFailed TaskRunResultLargerThanAllowedLimit TaskRunStopSidecarFailed InvalidParamValue TaskRunResolutionFailed TaskRunValidationFailed TaskValidationFailed ResourceVerificationFailed FailureIgnored] Status string `json:"status,omitempty"` // StatusMessage of the task @@ -48,6 +65,10 @@ func (m *PipelineRunTaskStep) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -63,6 +84,90 @@ func (m *PipelineRunTaskStep) validateName(formats strfmt.Registry) error { return nil } +var pipelineRunTaskStepTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Started","Running","Succeeded","Failed","ToBeRetried","TaskRunCancelled","TaskRunTimeout","TaskRunImagePullFailed","TaskRunResultLargerThanAllowedLimit","TaskRunStopSidecarFailed","InvalidParamValue","TaskRunResolutionFailed","TaskRunValidationFailed","TaskValidationFailed","ResourceVerificationFailed","FailureIgnored"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pipelineRunTaskStepTypeStatusPropEnum = append(pipelineRunTaskStepTypeStatusPropEnum, v) + } +} + +const ( + + // PipelineRunTaskStepStatusStarted captures enum value "Started" + PipelineRunTaskStepStatusStarted string = "Started" + + // PipelineRunTaskStepStatusRunning captures enum value "Running" + PipelineRunTaskStepStatusRunning string = "Running" + + // PipelineRunTaskStepStatusSucceeded captures enum value "Succeeded" + PipelineRunTaskStepStatusSucceeded string = "Succeeded" + + // PipelineRunTaskStepStatusFailed captures enum value "Failed" + PipelineRunTaskStepStatusFailed string = "Failed" + + // PipelineRunTaskStepStatusToBeRetried captures enum value "ToBeRetried" + PipelineRunTaskStepStatusToBeRetried string = "ToBeRetried" + + // PipelineRunTaskStepStatusTaskRunCancelled captures enum value "TaskRunCancelled" + PipelineRunTaskStepStatusTaskRunCancelled string = "TaskRunCancelled" + + // PipelineRunTaskStepStatusTaskRunTimeout captures enum value "TaskRunTimeout" + PipelineRunTaskStepStatusTaskRunTimeout string = "TaskRunTimeout" + + // PipelineRunTaskStepStatusTaskRunImagePullFailed captures enum value "TaskRunImagePullFailed" + PipelineRunTaskStepStatusTaskRunImagePullFailed string = "TaskRunImagePullFailed" + + // PipelineRunTaskStepStatusTaskRunResultLargerThanAllowedLimit captures enum value "TaskRunResultLargerThanAllowedLimit" + PipelineRunTaskStepStatusTaskRunResultLargerThanAllowedLimit string = "TaskRunResultLargerThanAllowedLimit" + + // PipelineRunTaskStepStatusTaskRunStopSidecarFailed captures enum value "TaskRunStopSidecarFailed" + PipelineRunTaskStepStatusTaskRunStopSidecarFailed string = "TaskRunStopSidecarFailed" + + // PipelineRunTaskStepStatusInvalidParamValue captures enum value "InvalidParamValue" + PipelineRunTaskStepStatusInvalidParamValue string = "InvalidParamValue" + + // PipelineRunTaskStepStatusTaskRunResolutionFailed captures enum value "TaskRunResolutionFailed" + PipelineRunTaskStepStatusTaskRunResolutionFailed string = "TaskRunResolutionFailed" + + // PipelineRunTaskStepStatusTaskRunValidationFailed captures enum value "TaskRunValidationFailed" + PipelineRunTaskStepStatusTaskRunValidationFailed string = "TaskRunValidationFailed" + + // PipelineRunTaskStepStatusTaskValidationFailed captures enum value "TaskValidationFailed" + PipelineRunTaskStepStatusTaskValidationFailed string = "TaskValidationFailed" + + // PipelineRunTaskStepStatusResourceVerificationFailed captures enum value "ResourceVerificationFailed" + PipelineRunTaskStepStatusResourceVerificationFailed string = "ResourceVerificationFailed" + + // PipelineRunTaskStepStatusFailureIgnored captures enum value "FailureIgnored" + PipelineRunTaskStepStatusFailureIgnored string = "FailureIgnored" +) + +// prop value enum +func (m *PipelineRunTaskStep) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pipelineRunTaskStepTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PipelineRunTaskStep) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + // value enum + if err := m.validateStatusEnum("status", "body", m.Status); err != nil { + return err + } + + return nil +} + // ContextValidate validates this pipeline run task step based on context it is used func (m *PipelineRunTaskStep) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil diff --git a/generated-client/models/secret.go b/generated-client/models/secret.go index a6016e9..e332d9d 100644 --- a/generated-client/models/secret.go +++ b/generated-client/models/secret.go @@ -8,7 +8,6 @@ package models import ( "context" "encoding/json" - "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -47,19 +46,11 @@ type Secret struct { // Consistent = Secret exists in Radix config and in cluster // NotAvailable = Secret is available in external secret configuration but not in cluster // Example: Consistent - // Enum: [Pending Consistent NotAvailable Invalid] + // Enum: [Pending Consistent NotAvailable] Status string `json:"status,omitempty"` - // StatusMessages contains a list of messages related to the Status - StatusMessages []string `json:"statusMessages"` - - // TLSCertificates holds the TLS certificate and certificate authorities (CA) - // The first certificate in the list should be the TLS certificate and the rest should be CA certificates - TLSCertificates []*TLSCertificate `json:"tlsCertificates"` - // Type of the secret // generic SecretTypeGeneric - // client-cert SecretTypeClientCert // azure-blob-fuse-volume SecretTypeAzureBlobFuseVolume // csi-azure-blob-volume SecretTypeCsiAzureBlobVolume // csi-azure-key-vault-creds SecretTypeCsiAzureKeyVaultCreds @@ -67,7 +58,7 @@ type Secret struct { // client-cert-auth SecretTypeClientCertificateAuth // oauth2-proxy SecretTypeOAuth2Proxy // Example: client-cert - // Enum: [generic client-cert azure-blob-fuse-volume csi-azure-blob-volume csi-azure-key-vault-creds csi-azure-key-vault-item client-cert-auth oauth2-proxy] + // Enum: [generic azure-blob-fuse-volume csi-azure-blob-volume csi-azure-key-vault-creds csi-azure-key-vault-item client-cert-auth oauth2-proxy] Type string `json:"type,omitempty"` } @@ -83,10 +74,6 @@ func (m *Secret) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateTLSCertificates(formats); err != nil { - res = append(res, err) - } - if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -110,7 +97,7 @@ var secretTypeStatusPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["Pending","Consistent","NotAvailable","Invalid"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["Pending","Consistent","NotAvailable"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -128,9 +115,6 @@ const ( // SecretStatusNotAvailable captures enum value "NotAvailable" SecretStatusNotAvailable string = "NotAvailable" - - // SecretStatusInvalid captures enum value "Invalid" - SecretStatusInvalid string = "Invalid" ) // prop value enum @@ -154,37 +138,11 @@ func (m *Secret) validateStatus(formats strfmt.Registry) error { return nil } -func (m *Secret) validateTLSCertificates(formats strfmt.Registry) error { - if swag.IsZero(m.TLSCertificates) { // not required - return nil - } - - for i := 0; i < len(m.TLSCertificates); i++ { - if swag.IsZero(m.TLSCertificates[i]) { // not required - continue - } - - if m.TLSCertificates[i] != nil { - if err := m.TLSCertificates[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tlsCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tlsCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - var secretTypeTypePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["generic","client-cert","azure-blob-fuse-volume","csi-azure-blob-volume","csi-azure-key-vault-creds","csi-azure-key-vault-item","client-cert-auth","oauth2-proxy"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["generic","azure-blob-fuse-volume","csi-azure-blob-volume","csi-azure-key-vault-creds","csi-azure-key-vault-item","client-cert-auth","oauth2-proxy"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -197,9 +155,6 @@ const ( // SecretTypeGeneric captures enum value "generic" SecretTypeGeneric string = "generic" - // SecretTypeClientDashCert captures enum value "client-cert" - SecretTypeClientDashCert string = "client-cert" - // SecretTypeAzureDashBlobDashFuseDashVolume captures enum value "azure-blob-fuse-volume" SecretTypeAzureDashBlobDashFuseDashVolume string = "azure-blob-fuse-volume" @@ -240,42 +195,8 @@ func (m *Secret) validateType(formats strfmt.Registry) error { return nil } -// ContextValidate validate this secret based on the context it is used +// ContextValidate validates this secret based on context it is used func (m *Secret) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateTLSCertificates(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *Secret) contextValidateTLSCertificates(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.TLSCertificates); i++ { - - if m.TLSCertificates[i] != nil { - - if swag.IsZero(m.TLSCertificates[i]) { // not required - return nil - } - - if err := m.TLSCertificates[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("tlsCertificates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("tlsCertificates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - return nil } diff --git a/generated-client/models/secret_parameters.go b/generated-client/models/secret_parameters.go index b48776c..643f646 100644 --- a/generated-client/models/secret_parameters.go +++ b/generated-client/models/secret_parameters.go @@ -27,7 +27,6 @@ type SecretParameters struct { // Type of the secret // generic SecretTypeGeneric - // client-cert SecretTypeClientCert // azure-blob-fuse-volume SecretTypeAzureBlobFuseVolume // csi-azure-blob-volume SecretTypeCsiAzureBlobVolume // csi-azure-key-vault-creds SecretTypeCsiAzureKeyVaultCreds @@ -35,7 +34,7 @@ type SecretParameters struct { // client-cert-auth SecretTypeClientCertificateAuth // oauth2-proxy SecretTypeOAuth2Proxy // Example: azure-blob-fuse-volume - // Enum: [generic client-cert azure-blob-fuse-volume csi-azure-blob-volume csi-azure-key-vault-creds csi-azure-key-vault-item client-cert-auth oauth2-proxy] + // Enum: [generic azure-blob-fuse-volume csi-azure-blob-volume csi-azure-key-vault-creds csi-azure-key-vault-item client-cert-auth oauth2-proxy] Type string `json:"type,omitempty"` } @@ -70,7 +69,7 @@ var secretParametersTypeTypePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["generic","client-cert","azure-blob-fuse-volume","csi-azure-blob-volume","csi-azure-key-vault-creds","csi-azure-key-vault-item","client-cert-auth","oauth2-proxy"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["generic","azure-blob-fuse-volume","csi-azure-blob-volume","csi-azure-key-vault-creds","csi-azure-key-vault-item","client-cert-auth","oauth2-proxy"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -83,9 +82,6 @@ const ( // SecretParametersTypeGeneric captures enum value "generic" SecretParametersTypeGeneric string = "generic" - // SecretParametersTypeClientDashCert captures enum value "client-cert" - SecretParametersTypeClientDashCert string = "client-cert" - // SecretParametersTypeAzureDashBlobDashFuseDashVolume captures enum value "azure-blob-fuse-volume" SecretParametersTypeAzureDashBlobDashFuseDashVolume string = "azure-blob-fuse-volume" diff --git a/generated-client/models/step.go b/generated-client/models/step.go index f433f9c..b47e10f 100644 --- a/generated-client/models/step.go +++ b/generated-client/models/step.go @@ -24,16 +24,16 @@ type Step struct { Components []string `json:"components"` // Ended timestamp - // Example: 2006-01-02T15:04:05Z - Ended string `json:"ended,omitempty"` + // Format: date-time + Ended strfmt.DateTime `json:"ended,omitempty"` // Name of the step // Example: build Name string `json:"name,omitempty"` // Started timestamp - // Example: 2006-01-02T15:04:05Z - Started string `json:"started,omitempty"` + // Format: date-time + Started strfmt.DateTime `json:"started,omitempty"` // Status of the step // Example: Waiting @@ -45,6 +45,14 @@ type Step struct { func (m *Step) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateEnded(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStarted(formats); err != nil { + res = append(res, err) + } + if err := m.validateStatus(formats); err != nil { res = append(res, err) } @@ -55,6 +63,30 @@ func (m *Step) Validate(formats strfmt.Registry) error { return nil } +func (m *Step) validateEnded(formats strfmt.Registry) error { + if swag.IsZero(m.Ended) { // not required + return nil + } + + if err := validate.FormatOf("ended", "body", "date-time", m.Ended.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Step) validateStarted(formats strfmt.Registry) error { + if swag.IsZero(m.Started) { // not required + return nil + } + + if err := validate.FormatOf("started", "body", "date-time", m.Started.String(), formats); err != nil { + return err + } + + return nil +} + var stepTypeStatusPropEnum []interface{} func init() { diff --git a/generated-client/models/tls.go b/generated-client/models/tls.go new file mode 100644 index 0000000..31d3421 --- /dev/null +++ b/generated-client/models/tls.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TLS TLS configuration and status for external DNS +// +// swagger:model TLS +type TLS struct { + + // Certificates holds the X509 certificate chain + // The first certificate in the list should be the host certificate and the rest should be intermediate certificates + Certificates []*X509Certificate `json:"certificates"` + + // Status of TLS certificate and private key + // Pending TLSStatusPending TLS certificate and private key not set + // Consistent TLSStatusConsistent TLS certificate and private key is valid + // Invalid TLSStatusInvalid TLS certificate and private key is invalid + // Example: Consistent + // Required: true + // Enum: [Pending Consistent Invalid] + Status *string `json:"status"` + + // StatusMessages contains a list of messages related to Status + StatusMessages []string `json:"statusMessages"` + + // UseAutomation describes if TLS certificate is automatically issued using automation (ACME) + // Required: true + UseAutomation *bool `json:"useAutomation"` +} + +// Validate validates this TLS +func (m *TLS) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCertificates(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUseAutomation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TLS) validateCertificates(formats strfmt.Registry) error { + if swag.IsZero(m.Certificates) { // not required + return nil + } + + for i := 0; i < len(m.Certificates); i++ { + if swag.IsZero(m.Certificates[i]) { // not required + continue + } + + if m.Certificates[i] != nil { + if err := m.Certificates[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("certificates" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("certificates" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var tlsTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["Pending","Consistent","Invalid"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + tlsTypeStatusPropEnum = append(tlsTypeStatusPropEnum, v) + } +} + +const ( + + // TLSStatusPending captures enum value "Pending" + TLSStatusPending string = "Pending" + + // TLSStatusConsistent captures enum value "Consistent" + TLSStatusConsistent string = "Consistent" + + // TLSStatusInvalid captures enum value "Invalid" + TLSStatusInvalid string = "Invalid" +) + +// prop value enum +func (m *TLS) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, tlsTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *TLS) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + // value enum + if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { + return err + } + + return nil +} + +func (m *TLS) validateUseAutomation(formats strfmt.Registry) error { + + if err := validate.Required("useAutomation", "body", m.UseAutomation); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this TLS based on the context it is used +func (m *TLS) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCertificates(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TLS) contextValidateCertificates(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Certificates); i++ { + + if m.Certificates[i] != nil { + + if swag.IsZero(m.Certificates[i]) { // not required + return nil + } + + if err := m.Certificates[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("certificates" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("certificates" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TLS) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TLS) UnmarshalBinary(b []byte) error { + var res TLS + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/generated-client/models/update_external_dns_tls_request.go b/generated-client/models/update_external_dns_tls_request.go new file mode 100644 index 0000000..29120a3 --- /dev/null +++ b/generated-client/models/update_external_dns_tls_request.go @@ -0,0 +1,91 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UpdateExternalDNSTLSRequest UpdateExternalDNSTLSRequest describes request body for setting private key and certificate for external DNS TLS +// +// swagger:model UpdateExternalDNSTLSRequest +type UpdateExternalDNSTLSRequest struct { + + // X509 certificate in PEM format + // Required: true + Certificate *string `json:"certificate"` + + // Private key in PEM format + // Required: true + PrivateKey *string `json:"privateKey"` + + // Skip validation of certificate and private key + SkipValidation bool `json:"skipValidation,omitempty"` +} + +// Validate validates this update external DNS TLS request +func (m *UpdateExternalDNSTLSRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCertificate(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePrivateKey(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateExternalDNSTLSRequest) validateCertificate(formats strfmt.Registry) error { + + if err := validate.Required("certificate", "body", m.Certificate); err != nil { + return err + } + + return nil +} + +func (m *UpdateExternalDNSTLSRequest) validatePrivateKey(formats strfmt.Registry) error { + + if err := validate.Required("privateKey", "body", m.PrivateKey); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this update external DNS TLS request based on context it is used +func (m *UpdateExternalDNSTLSRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateExternalDNSTLSRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateExternalDNSTLSRequest) UnmarshalBinary(b []byte) error { + var res UpdateExternalDNSTLSRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/generated-client/models/x509_certificate.go b/generated-client/models/x509_certificate.go new file mode 100644 index 0000000..f47f4d2 --- /dev/null +++ b/generated-client/models/x509_certificate.go @@ -0,0 +1,137 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// X509Certificate X509Certificate holds information about a X509 certificate +// +// swagger:model X509Certificate +type X509Certificate struct { + + // DNSNames defines list of Subject Alternate Names in the certificate + DNSNames []string `json:"dnsNames"` + + // Issuer contains the distinguished name for the certificate's issuer + // Example: CN=DigiCert TLS RSA SHA256 2020 CA1,O=DigiCert Inc,C=US + // Required: true + Issuer *string `json:"issuer"` + + // NotAfter defines the uppdater date/time validity boundary + // Required: true + // Format: date-time + NotAfter *strfmt.DateTime `json:"notAfter"` + + // NotBefore defines the lower date/time validity boundary + // Required: true + // Format: date-time + NotBefore *strfmt.DateTime `json:"notBefore"` + + // Subject contains the distinguished name for the certificate + // Example: CN=mysite.example.com,O=MyOrg,L=MyLocation,C=NO + // Required: true + Subject *string `json:"subject"` +} + +// Validate validates this x509 certificate +func (m *X509Certificate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIssuer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNotAfter(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNotBefore(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubject(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *X509Certificate) validateIssuer(formats strfmt.Registry) error { + + if err := validate.Required("issuer", "body", m.Issuer); err != nil { + return err + } + + return nil +} + +func (m *X509Certificate) validateNotAfter(formats strfmt.Registry) error { + + if err := validate.Required("notAfter", "body", m.NotAfter); err != nil { + return err + } + + if err := validate.FormatOf("notAfter", "body", "date-time", m.NotAfter.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *X509Certificate) validateNotBefore(formats strfmt.Registry) error { + + if err := validate.Required("notBefore", "body", m.NotBefore); err != nil { + return err + } + + if err := validate.FormatOf("notBefore", "body", "date-time", m.NotBefore.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *X509Certificate) validateSubject(formats strfmt.Registry) error { + + if err := validate.Required("subject", "body", m.Subject); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this x509 certificate based on context it is used +func (m *X509Certificate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *X509Certificate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *X509Certificate) UnmarshalBinary(b []byte) error { + var res X509Certificate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 434f36e34e1ba2b3a6da17ec5bbb9928fab2ddc2 Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Tue, 16 Jan 2024 16:21:28 +0100 Subject: [PATCH 2/5] Fixed error handling --- cmd/createDeployPipelineJob.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/createDeployPipelineJob.go b/cmd/createDeployPipelineJob.go index d10dacc..0961bee 100644 --- a/cmd/createDeployPipelineJob.go +++ b/cmd/createDeployPipelineJob.go @@ -82,9 +82,9 @@ Examples: if err != nil { return err } - componentNames, err := cmd.Flags().GetStringSlice("component") + componentsToDeploy, err := cmd.Flags().GetStringSlice("component") if err != nil { - errs = append(errs, err) + return err } cmd.SilenceUsage = true @@ -102,7 +102,7 @@ Examples: TriggeredBy: triggeredByUser, CommitID: commitID, } - if components := strings.Join(componentNames, ","); len(components) > 0 { + if components := strings.Join(componentsToDeploy, ","); len(components) > 0 { parametersDeploy.Components = components } triggerPipelineParams.SetPipelineParametersDeploy(¶metersDeploy) @@ -142,7 +142,7 @@ func init() { createDeployPipelineJobCmd.Flags().StringP("user", "u", "", "The user who triggered the deploy") createDeployPipelineJobCmd.Flags().StringToStringP("image-tag-name", "t", map[string]string{}, "Image tag name for a component: component-name=tag-name. Multiple pairs can be specified.") createDeployPipelineJobCmd.Flags().StringP("commitID", "i", "", "An optional 40 character commit id to tag the new pipeline job") - createDeployPipelineJobCmd.Flags().StringSlice("component", []string{}, "Optional component to deploy, if only specific component need to be deployed") + createDeployPipelineJobCmd.Flags().StringSlice("component", []string{}, "Optional component to deploy, when only specific component need to be deployed. Multiple components can be specified.") createDeployPipelineJobCmd.Flags().BoolP("follow", "f", false, "Follow deploy") setContextSpecificPersistentFlags(createDeployPipelineJobCmd) } From 9a79661e4ae554445c2192b6ef2cc1eb88f00514 Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Thu, 18 Jan 2024 09:48:58 +0100 Subject: [PATCH 3/5] Merged --- cmd/createDeployPipelineJob.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/createDeployPipelineJob.go b/cmd/createDeployPipelineJob.go index 5e53c50..5a3368f 100644 --- a/cmd/createDeployPipelineJob.go +++ b/cmd/createDeployPipelineJob.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" "regexp" + "strings" log "github.com/sirupsen/logrus" From 3b6d3bad20b906c1fcaaf81da84ea0150658e9ae Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Fri, 19 Jan 2024 17:05:59 +0100 Subject: [PATCH 4/5] Changed api option componentToDeploy to array --- cmd/createDeployPipelineJob.go | 13 +++++-------- generated-client/models/component.go | 3 +++ generated-client/models/job.go | 4 ++++ .../models/pipeline_parameters_deploy.go | 5 ++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cmd/createDeployPipelineJob.go b/cmd/createDeployPipelineJob.go index bb39c71..0db3069 100644 --- a/cmd/createDeployPipelineJob.go +++ b/cmd/createDeployPipelineJob.go @@ -18,7 +18,6 @@ import ( "errors" "fmt" "regexp" - "strings" log "github.com/sirupsen/logrus" @@ -98,13 +97,11 @@ Examples: triggerPipelineParams := application.NewTriggerPipelineDeployParams() triggerPipelineParams.SetAppName(*appName) parametersDeploy := models.PipelineParametersDeploy{ - ToEnvironment: targetEnvironment, - ImageTagNames: imageTagNames, - TriggeredBy: triggeredByUser, - CommitID: commitID, - } - if components := strings.Join(componentsToDeploy, ","); len(components) > 0 { - parametersDeploy.Components = components + ToEnvironment: targetEnvironment, + ImageTagNames: imageTagNames, + TriggeredBy: triggeredByUser, + CommitID: commitID, + ComponentsToDeploy: componentsToDeploy, } triggerPipelineParams.SetPipelineParametersDeploy(¶metersDeploy) diff --git a/generated-client/models/component.go b/generated-client/models/component.go index d1d70e4..d6ea085 100644 --- a/generated-client/models/component.go +++ b/generated-client/models/component.go @@ -21,6 +21,9 @@ import ( // swagger:model Component type Component struct { + // Commit ID for the component. It can be different from the Commit ID, specified in deployment label + CommitID string `json:"CommitID,omitempty"` + // Array of external DNS configurations ExternalDNS []*ExternalDNS `json:"externalDNS"` diff --git a/generated-client/models/job.go b/generated-client/models/job.go index 489e8c6..9f1884a 100644 --- a/generated-client/models/job.go +++ b/generated-client/models/job.go @@ -34,6 +34,10 @@ type Job struct { // Deprecated: Inspect each deployment to get list of components created by the job Components []*ComponentSummary `json:"components"` + // ComponentsToDeploy List of components to deploy + // OPTIONAL If specified, only these components are deployed + ComponentsToDeploy []string `json:"componentsToDeploy"` + // Created timestamp // Example: 2006-01-02T15:04:05Z Created string `json:"created,omitempty"` diff --git a/generated-client/models/pipeline_parameters_deploy.go b/generated-client/models/pipeline_parameters_deploy.go index d7a589e..8ee636f 100644 --- a/generated-client/models/pipeline_parameters_deploy.go +++ b/generated-client/models/pipeline_parameters_deploy.go @@ -22,10 +22,9 @@ type PipelineParametersDeploy struct { // Example: 4faca8595c5283a9d0f17a623b9255a0d9866a2e CommitID string `json:"commitID,omitempty"` - // Components List of components to deploy + // ComponentsToDeploy List of components to deploy // OPTIONAL If specified, only these components are deployed - // Example: component1,component2 - Components string `json:"components,omitempty"` + ComponentsToDeploy []string `json:"componentsToDeploy"` // Image tags names for components // Example: component1=tag1,component2=tag2 From 8ba708726b9d7f1dfc7d3837d26cfc45ab888911 Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Mon, 22 Jan 2024 10:38:03 +0100 Subject: [PATCH 5/5] Using example field --- cmd/createDeployPipelineJob.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/createDeployPipelineJob.go b/cmd/createDeployPipelineJob.go index 0db3069..4e07f48 100644 --- a/cmd/createDeployPipelineJob.go +++ b/cmd/createDeployPipelineJob.go @@ -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 @@ -47,8 +45,7 @@ Examples: 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 -`, + 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)