Provisioning: Use repository view rather than raw config (#103449)

This commit is contained in:
Ryan McKinley
2025-04-07 09:39:31 +03:00
committed by GitHub
parent 8cd6f837a5
commit 8dbaeac9da
22 changed files with 233 additions and 235 deletions
+3 -3
View File
@@ -25,12 +25,12 @@ type RepositoryView struct {
// Repository display
Title string `json:"title"`
// Edit options within the repository
ReadOnly bool `json:"readOnly"`
// The repository type
Type RepositoryType `json:"type"`
// When syncing, where values are saved
Target SyncTargetType `json:"target"`
// The supported workflows
Workflows []Workflow `json:"workflows"`
}
@@ -590,6 +590,11 @@ func (in *RepositoryStatus) DeepCopy() *RepositoryStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RepositoryView) DeepCopyInto(out *RepositoryView) {
*out = *in
if in.Workflows != nil {
in, out := &in.Workflows, &out.Workflows
*out = make([]Workflow, len(*in))
copy(*out, *in)
}
return
}
@@ -610,7 +615,9 @@ func (in *RepositoryViewList) DeepCopyInto(out *RepositoryViewList) {
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RepositoryView, len(*in))
copy(*out, *in)
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
@@ -1212,14 +1212,6 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryView(ref common.ReferenceCa
Format: "",
},
},
"readOnly": {
SchemaProps: spec.SchemaProps{
Description: "Edit options within the repository",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
"type": {
SchemaProps: spec.SchemaProps{
Description: "The repository type\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`",
@@ -1238,8 +1230,24 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryView(ref common.ReferenceCa
Enum: []interface{}{"folder", "instance"},
},
},
"workflows": {
SchemaProps: spec.SchemaProps{
Description: "The supported workflows",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"branch", "write"},
},
},
},
},
},
},
Required: []string{"name", "title", "readOnly", "type", "target"},
Required: []string{"name", "title", "type", "target", "workflows"},
},
},
}
@@ -6,6 +6,7 @@ API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provis
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ManagerStats,Stats
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositoryList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositorySpec,Workflows
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositoryView,Workflows
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositoryViewList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,TestResults,Errors