Use string for skip sync check#236
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts “skip sync” controls to be string-based (instead of boolean) so they can be passed through templating/parameterization layers more easily, updating both the grafanactl CLI and the pipelines type/schema surface.
Changes:
- Changed
SkipSyncfrombooltostringingrafanactlsync options and updated runtime check accordingly. - Changed
pipelinesGrafanaDatasourcesStep.skipSynctype from boolean to string (Go type + JSON schema) and added a guard test. - Regenerated graph SVG fixtures (Graphviz output differs due to version change).
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/grafanactl/cmd/sync/options.go | Changes --skip-sync flag storage from bool to string. |
| tools/grafanactl/cmd/sync/cmd.go | Updates skip logic to check string value. |
| pipelines/types/pipeline.schema.v1.json | Updates skipSync schema type to string. |
| pipelines/types/common.go | Updates GrafanaDatasourcesStep.SkipSync to string. |
| pipelines/types/common_test.go | Adds reflection-based guard test against bool fields. |
| pipelines/graph/testdata/zz_fixture_TestForPipeline.svg | Regenerated Graphviz fixture output. |
| pipelines/graph/testdata/zz_fixture_TestForEntrypoint.svg | Regenerated Graphviz fixture output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
64
to
68
| func (opts *RawSyncDashboardsOptions) Run(ctx context.Context) error { | ||
| logger := logr.FromContextOrDiscard(ctx) | ||
| if opts.SkipSync { | ||
| if strings.EqualFold(opts.SkipSync, "true") { | ||
| logger.Info("Skipping dashboard sync") | ||
| return nil |
| @@ -738,7 +738,7 @@ type GrafanaDatasourcesStep struct { | |||
| GrafanaName string `json:"grafanaName"` | |||
|
|
|||
| // SkipSync indicates whether to skip syncing datasources. It is intended for prow jobs to skip syncing datasources. | |||
Comment on lines
+316
to
+323
| func TestGrafanaDatasourcesStepNoBooleanFields(t *testing.T) { | ||
| rt := reflect.TypeOf(GrafanaDatasourcesStep{}) | ||
| for i := 0; i < rt.NumField(); i++ { | ||
| field := rt.Field(i) | ||
| if field.Type.Kind() == reflect.Bool { | ||
| t.Errorf("field %q has type bool, use string instead", field.Name) | ||
| } | ||
| } |
42d726f to
aa4e905
Compare
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
pipelines/types/common.go:745
- SkipSync is now a string, but the comment still describes it as a boolean and doesn’t document the accepted values ("true"/"false"). Also, YAML like
skipSync: truewill now fail unmarshalling into a string, which can break existing pipelines/templates; consider supporting both bool and string during unmarshalling (or at least documenting the required quoting).
GrafanaName string `json:"grafanaName"`
// SkipSync indicates whether to skip syncing datasources. It is intended for prow jobs to skip syncing datasources.
SkipSync string `json:"skipSync,omitempty"`
// IdentityFrom specifies the managed identity with which this deployment will run in Ev2.
IdentityFrom Input `json:"identityFrom,omitempty"`
}
Comment on lines
71
to
74
| flags := cmd.Flags() | ||
| flags.StringVar(&opts.ConfigFilePath, "config-file", "", "Path to config file with Grafana dashboard references (absolute or relative path, required)") | ||
| flags.BoolVar(&opts.SkipSync, "skip-sync", false, "Skip syncing dashboards") | ||
| flags.StringVar(&opts.SkipSync, "skip-sync", "false", "Skip syncing dashboards") | ||
|
|
Comment on lines
+66
to
68
| if strings.EqualFold(opts.SkipSync, "true") { | ||
| logger.Info("Skipping dashboard sync") | ||
| return nil |
Comment on lines
+317
to
+322
| rt := reflect.TypeOf(GrafanaDatasourcesStep{}) | ||
| for i := 0; i < rt.NumField(); i++ { | ||
| field := rt.Field(i) | ||
| if field.Type.Kind() == reflect.Bool { | ||
| t.Errorf("field %q has type bool, use string instead", field.Name) | ||
| } |
geoberle
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adjusts “skip sync” controls to be string-based (instead of boolean), cause ev2 templating appears to break with booleans