diff --git a/deploy/charts/rig-platform/templates/_config.tpl b/deploy/charts/rig-platform/templates/_config.tpl index 2511cd76b..de26fe4ef 100644 --- a/deploy/charts/rig-platform/templates/_config.tpl +++ b/deploy/charts/rig-platform/templates/_config.tpl @@ -83,6 +83,10 @@ client: baseUrl: {{ .client.operator.baseUrl }} {{- end }} + {{- if .client.git }} + git: + author: {{ .client.git.author | toYaml | nindent 6 }} + {{- end }} environments: {{- if .environments }} @@ -136,6 +140,13 @@ client: smtp: password: {{ .smtp.password | quote }} {{- end }} + {{- if and .git .git.auths }} + git: + auths: + {{- range .git.auths }} + - {{ . | toYaml | indent 8 | trim }} + {{- end }} + {{- end }} {{- end }} {{- if .repository.secret }} diff --git a/docs/docs/api/config/v1alpha1.md b/docs/docs/api/config/v1alpha1.md index 4dd7bf844..03f35e47c 100644 --- a/docs/docs/api/config/v1alpha1.md +++ b/docs/docs/api/config/v1alpha1.md @@ -80,6 +80,7 @@ _Appears in:_ | `smtp` _[ClientSMTP](#clientsmtp)_ | SMTP sets the host, port, username and password for the SMTP client. | | `operator` _[ClientOperator](#clientoperator)_ | Operator sets the base url for the Operator client. | | `slack` _[ClientSlack](#clientslack)_ | Slack holds configuration for sending slack messages. | +| `git` _[ClientGit](#clientgit)_ | Git client configuration for communicating with multiple repositories. | ### ClientDocker @@ -96,6 +97,21 @@ _Appears in:_ | `host` _string_ | Host where the docker daemon can be reached. | +### ClientGit + + + + + +_Appears in:_ +- [Client](#client) + +| Field | Description | +| --- | --- | +| `auths` _[GitAuth](#gitauth) array_ | Auths the git client can behave as. | +| `author` _[GitAuthor](#gitauthor)_ | Author used when creating commits. | + + ### ClientMailjet @@ -211,9 +227,9 @@ _Appears in:_ | `branch` _string_ | Branch to commit changes to. | | `pathPrefix` _string_ | PathPrefix path to commit to in git repository. Deprecated: Use `pathPrefixes` instead. | | `pathPrefixes` _[PathPrefixes](#pathprefixes)_ | PathPrefixes path to commit to in git repository | -| `credentials` _[GitCredentials](#gitcredentials)_ | Credentials to use when connecting to git. | -| `author` _[GitAuthor](#gitauthor)_ | Author used when creating commits. | | `templates` _[GitTemplates](#gittemplates)_ | Templates used for commit messages. | +| `credentials` _[GitCredentials](#gitcredentials)_ | Credentials to use when connecting to git. Deprecated: Use `client.git.auths` instead. | +| `author` _[GitAuthor](#gitauthor)_ | Author used when creating commits. Deprecated: Use `client.git.author` instead. | ### ClusterType @@ -282,6 +298,22 @@ _Appears in:_ +### GitAuth + + + + + +_Appears in:_ +- [ClientGit](#clientgit) + +| Field | Description | +| --- | --- | +| `url` _string_ | URL is a exact match for the repo-url this auth can be used for. | +| `urlPrefix` _string_ | URLPrefix is a prefix-match for the repo urls this auth can be used for. | +| `credentials` _[GitCredentials](#gitcredentials)_ | Credentials to use when connecting to git. | + + ### GitAuthor @@ -289,6 +321,7 @@ _Appears in:_ GitAuthor specifies a git commit author _Appears in:_ +- [ClientGit](#clientgit) - [ClusterGit](#clustergit) | Field | Description | @@ -305,6 +338,7 @@ GitCredentials specifies how to authenticate against git. _Appears in:_ - [ClusterGit](#clustergit) +- [GitAuth](#gitauth) | Field | Description | | --- | --- | @@ -329,17 +363,13 @@ _Appears in:_ ### HTTPSCredential - +_Underlying type:_ _[struct{Username string "json:\"username,omitempty\""; Password string "json:\"password,omitempty\""}](#struct{username-string-"json:\"username,omitempty\"";-password-string-"json:\"password,omitempty\""})_ HTTPSCredential specifies basic auth credentials _Appears in:_ - [GitCredentials](#gitcredentials) -| Field | Description | -| --- | --- | -| `username` _string_ | Username is the basic auth user name | -| `password` _string_ | Password is the basic auth password | ### Logging @@ -521,17 +551,13 @@ _Appears in:_ ### SSHCredential - +_Underlying type:_ _[struct{PrivateKey string "json:\"privateKey,omitempty\""; PrivateKeyPassword string "json:\"password,omitempty\""}](#struct{privatekey-string-"json:\"privatekey,omitempty\"";-privatekeypassword-string-"json:\"password,omitempty\""})_ SSHCredential specifies SSH credentials _Appears in:_ - [GitCredentials](#gitcredentials) -| Field | Description | -| --- | --- | -| `privateKey` _string_ | PrivateKey is a PEM encoded SSH private key. | -| `password` _string_ | PrivateKeyPassword is an optional password for the SSH private key. | ### SSO diff --git a/pkg/api/config/v1alpha1/platform_config_types.go b/pkg/api/config/v1alpha1/platform_config_types.go index 689502b63..7025d6be1 100644 --- a/pkg/api/config/v1alpha1/platform_config_types.go +++ b/pkg/api/config/v1alpha1/platform_config_types.go @@ -169,6 +169,9 @@ type Client struct { // Slack holds configuration for sending slack messages. Slack ClientSlack `json:"slack,omitempty"` + + // Git client configuration for communicating with multiple repositories. + Git ClientGit `json:"git,omitempty"` } // Logging specifies logging configuration. @@ -296,15 +299,16 @@ type ClusterGit struct { // PathPrefixes path to commit to in git repository PathPrefixes PathPrefixes `json:"pathPrefixes,omitempty"` + // Templates used for commit messages. + Templates GitTemplates `json:"templates,omitempty"` // Credentials to use when connecting to git. + // Deprecated: Use `client.git.auths` instead. Credentials GitCredentials `json:"credentials,omitempty"` // Author used when creating commits. + // Deprecated: Use `client.git.author` instead. Author GitAuthor `json:"author,omitempty"` - - // Templates used for commit messages. - Templates GitTemplates `json:"templates,omitempty"` } // PathPrefixes is the (possibly templated) path prefix to commit to in git repository @@ -314,6 +318,25 @@ type PathPrefixes struct { Project string `json:"project,omitempty"` } +type ClientGit struct { + // Auths the git client can behave as. + Auths []GitAuth `json:"auths,omitempty"` + + // Author used when creating commits. + Author GitAuthor `json:"author,omitempty"` +} + +type GitAuth struct { + // URL is a exact match for the repo-url this auth can be used for. + URL string `json:"url,omitempty"` + + // URLPrefix is a prefix-match for the repo urls this auth can be used for. + URLPrefix string `json:"urlPrefix,omitempty"` + + // Credentials to use when connecting to git. + Credentials GitCredentials `json:"credentials,omitempty"` +} + // GitCredentials specifies how to authenticate against git. type GitCredentials struct { // HTTPS specifies basic auth credentials. diff --git a/pkg/api/config/v1alpha1/zz_generated.deepcopy.go b/pkg/api/config/v1alpha1/zz_generated.deepcopy.go index 35354dba5..1233ded56 100644 --- a/pkg/api/config/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/api/config/v1alpha1/zz_generated.deepcopy.go @@ -80,6 +80,7 @@ func (in *Client) DeepCopyInto(out *Client) { out.SMTP = in.SMTP out.Operator = in.Operator out.Slack = in.Slack + in.Git.DeepCopyInto(&out.Git) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Client. @@ -107,6 +108,27 @@ func (in *ClientDocker) DeepCopy() *ClientDocker { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientGit) DeepCopyInto(out *ClientGit) { + *out = *in + if in.Auths != nil { + in, out := &in.Auths, &out.Auths + *out = make([]GitAuth, len(*in)) + copy(*out, *in) + } + out.Author = in.Author +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientGit. +func (in *ClientGit) DeepCopy() *ClientGit { + if in == nil { + return nil + } + out := new(ClientGit) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientMailjet) DeepCopyInto(out *ClientMailjet) { *out = *in @@ -208,9 +230,9 @@ func (in *Cluster) DeepCopy() *Cluster { func (in *ClusterGit) DeepCopyInto(out *ClusterGit) { *out = *in out.PathPrefixes = in.PathPrefixes + out.Templates = in.Templates out.Credentials = in.Credentials out.Author = in.Author - out.Templates = in.Templates } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterGit. @@ -268,6 +290,22 @@ func (in *Email) DeepCopy() *Email { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GitAuth) DeepCopyInto(out *GitAuth) { + *out = *in + out.Credentials = in.Credentials +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitAuth. +func (in *GitAuth) DeepCopy() *GitAuth { + if in == nil { + return nil + } + out := new(GitAuth) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitAuthor) DeepCopyInto(out *GitAuthor) { *out = *in @@ -500,7 +538,7 @@ func (in *PlatformConfig) DeepCopyInto(out *PlatformConfig) { *out = *in out.TypeMeta = in.TypeMeta in.Auth.DeepCopyInto(&out.Auth) - out.Client = in.Client + in.Client.DeepCopyInto(&out.Client) out.Repository = in.Repository in.Cluster.DeepCopyInto(&out.Cluster) out.Email = in.Email