Provisioning: Add Connection reference to Repository resource (#115419)
* Provisioning: Add Connection reference to Repository resource * addressing comments
This commit is contained in:
@@ -84,6 +84,9 @@ repository: {
|
||||
// When non-zero, the sync will run periodically
|
||||
intervalSeconds?: int
|
||||
}
|
||||
#ConnectionInfo: {
|
||||
name: string
|
||||
}
|
||||
#HealthStatus: {
|
||||
// When not healthy, requests will not be executed
|
||||
healthy: bool
|
||||
@@ -152,6 +155,9 @@ repository: {
|
||||
// The repository on GitLab.
|
||||
// Mutually exclusive with local | github | git.
|
||||
gitlab?: #GitLabRepositoryConfig
|
||||
// The connection the repository references.
|
||||
// This means the Repository is interacting with git via a Connection.
|
||||
connection?: #ConnectionInfo
|
||||
}
|
||||
status: {
|
||||
// The generation of the spec last time reconciliation ran
|
||||
@@ -168,4 +174,4 @@ repository: {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +219,10 @@ func (r *Repository) Path() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type ConnectionInfo struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type RepositorySpec struct {
|
||||
// The repository display name (shown in the UI)
|
||||
Title string `json:"title"`
|
||||
@@ -256,6 +260,10 @@ type RepositorySpec struct {
|
||||
// The repository on GitLab.
|
||||
// Mutually exclusive with local | github | git.
|
||||
GitLab *GitLabRepositoryConfig `json:"gitlab,omitempty"`
|
||||
|
||||
// The connection the repository references.
|
||||
// This means the Repository is interacting with git via a Connection.
|
||||
Connection *ConnectionInfo `json:"connection,omitempty"`
|
||||
}
|
||||
|
||||
// SyncTargetType defines where we want all values to resolve
|
||||
|
||||
@@ -88,6 +88,22 @@ func (in *Connection) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ConnectionInfo) DeepCopyInto(out *ConnectionInfo) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectionInfo.
|
||||
func (in *ConnectionInfo) DeepCopy() *ConnectionInfo {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ConnectionInfo)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ConnectionList) DeepCopyInto(out *ConnectionList) {
|
||||
*out = *in
|
||||
@@ -922,6 +938,11 @@ func (in *RepositorySpec) DeepCopyInto(out *RepositorySpec) {
|
||||
*out = new(GitLabRepositoryConfig)
|
||||
**out = **in
|
||||
}
|
||||
if in.Connection != nil {
|
||||
in, out := &in.Connection, &out.Connection
|
||||
*out = new(ConnectionInfo)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.BitbucketConnectionConfig": schema_pkg_apis_provisioning_v0alpha1_BitbucketConnectionConfig(ref),
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.BitbucketRepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_BitbucketRepositoryConfig(ref),
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.Connection": schema_pkg_apis_provisioning_v0alpha1_Connection(ref),
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.ConnectionInfo": schema_pkg_apis_provisioning_v0alpha1_ConnectionInfo(ref),
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.ConnectionList": schema_pkg_apis_provisioning_v0alpha1_ConnectionList(ref),
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.ConnectionSecure": schema_pkg_apis_provisioning_v0alpha1_ConnectionSecure(ref),
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.ConnectionSpec": schema_pkg_apis_provisioning_v0alpha1_ConnectionSpec(ref),
|
||||
@@ -224,6 +225,26 @@ func schema_pkg_apis_provisioning_v0alpha1_Connection(ref common.ReferenceCallba
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_provisioning_v0alpha1_ConnectionInfo(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"name": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_provisioning_v0alpha1_ConnectionList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
@@ -1868,12 +1889,18 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCa
|
||||
Ref: ref("github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitLabRepositoryConfig"),
|
||||
},
|
||||
},
|
||||
"connection": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The connection the repository references. This means the Repository is interacting with git via a Connection.",
|
||||
Ref: ref("github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.ConnectionInfo"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"title", "workflows", "sync", "type"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.BitbucketRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitLabRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.SyncOptions"},
|
||||
"github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.BitbucketRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.ConnectionInfo", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitLabRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.GitRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1.SyncOptions"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// ConnectionInfoApplyConfiguration represents a declarative configuration of the ConnectionInfo type for use
|
||||
// with apply.
|
||||
type ConnectionInfoApplyConfiguration struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// ConnectionInfoApplyConfiguration constructs a declarative configuration of the ConnectionInfo type for use with
|
||||
// apply.
|
||||
func ConnectionInfo() *ConnectionInfoApplyConfiguration {
|
||||
return &ConnectionInfoApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *ConnectionInfoApplyConfiguration) WithName(value string) *ConnectionInfoApplyConfiguration {
|
||||
b.Name = &value
|
||||
return b
|
||||
}
|
||||
+9
@@ -21,6 +21,7 @@ type RepositorySpecApplyConfiguration struct {
|
||||
Git *GitRepositoryConfigApplyConfiguration `json:"git,omitempty"`
|
||||
Bitbucket *BitbucketRepositoryConfigApplyConfiguration `json:"bitbucket,omitempty"`
|
||||
GitLab *GitLabRepositoryConfigApplyConfiguration `json:"gitlab,omitempty"`
|
||||
Connection *ConnectionInfoApplyConfiguration `json:"connection,omitempty"`
|
||||
}
|
||||
|
||||
// RepositorySpecApplyConfiguration constructs a declarative configuration of the RepositorySpec type for use with
|
||||
@@ -110,3 +111,11 @@ func (b *RepositorySpecApplyConfiguration) WithGitLab(value *GitLabRepositoryCon
|
||||
b.GitLab = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithConnection sets the Connection field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Connection field is set to the value of the last call.
|
||||
func (b *RepositorySpecApplyConfiguration) WithConnection(value *ConnectionInfoApplyConfiguration) *RepositorySpecApplyConfiguration {
|
||||
b.Connection = value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
return &provisioningv0alpha1.BitbucketRepositoryConfigApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("Connection"):
|
||||
return &provisioningv0alpha1.ConnectionApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("ConnectionInfo"):
|
||||
return &provisioningv0alpha1.ConnectionInfoApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("ConnectionSecure"):
|
||||
return &provisioningv0alpha1.ConnectionSecureApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("ConnectionSpec"):
|
||||
|
||||
+5
@@ -1731,6 +1731,9 @@ export type BitbucketRepositoryConfig = {
|
||||
/** The repository URL (e.g. `https://bitbucket.org/example/test`). */
|
||||
url?: string;
|
||||
};
|
||||
export type ConnectionInfo = {
|
||||
name: string;
|
||||
};
|
||||
export type GitRepositoryConfig = {
|
||||
/** The branch to use in the repository. */
|
||||
branch: string;
|
||||
@@ -1783,6 +1786,8 @@ export type SyncOptions = {
|
||||
export type RepositorySpec = {
|
||||
/** The repository on Bitbucket. Mutually exclusive with local | github | git. */
|
||||
bitbucket?: BitbucketRepositoryConfig;
|
||||
/** The connection the repository references. This means the Repository is interacting with git via a Connection. */
|
||||
connection?: ConnectionInfo;
|
||||
/** Repository description */
|
||||
description?: string;
|
||||
/** The repository on Git. Mutually exclusive with local | github | git. */
|
||||
|
||||
@@ -4409,6 +4409,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"com.github.grafana.grafana.apps.provisioning.pkg.apis.provisioning.v0alpha1.ConnectionInfo": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"com.github.grafana.grafana.apps.provisioning.pkg.apis.provisioning.v0alpha1.ConnectionList": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -5525,6 +5537,14 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"connection": {
|
||||
"description": "The connection the repository references. This means the Repository is interacting with git via a Connection.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/com.github.grafana.grafana.apps.provisioning.pkg.apis.provisioning.v0alpha1.ConnectionInfo"
|
||||
}
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
"description": "Repository description",
|
||||
"type": "string"
|
||||
|
||||
Reference in New Issue
Block a user