From 7a171fd14a77f050c2f149ac06a30a5551613e58 Mon Sep 17 00:00:00 2001 From: Alexander Weaver Date: Wed, 6 Mar 2024 16:08:45 -0600 Subject: [PATCH] Regenerate openapidocs at 1.21.8 to match ci (#84037) * Regenerate openapidocs at 1.21.8 to match ci * Adjust trigger to work on the actual outputted files * Also put go.mod and go.sum in the triggers * manually fix * Make an arbitrary change rather than touching the trigger to force a run * Drop all triggers - run all the time * Print diff - taken from @papagian's PR * Manual fixes to swagger doc --------- Co-authored-by: Ryan McKinley --- .drone.yml | 14 ++++---------- pkg/api/alerting.go | 2 +- pkg/services/ngalert/api/tooling/api.json | 2 +- pkg/services/ngalert/api/tooling/post.json | 2 +- pkg/services/ngalert/api/tooling/spec.json | 2 +- pkg/services/ngalert/schedule/schedule.go | 2 +- public/api-enterprise-spec.json | 2 +- public/api-merged.json | 6 +++--- public/openapi3.json | 6 +++--- scripts/drone/events/pr.star | 1 - scripts/drone/pipelines/swagger_gen.star | 8 +++++--- 11 files changed, 21 insertions(+), 26 deletions(-) diff --git a/.drone.yml b/.drone.yml index 14ae569f2be..6af8a77378b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1250,9 +1250,9 @@ steps: - make swagger-clean && make openapi3-gen - for f in public/api-merged.json public/openapi3.json; do git add $f; done - if [ -z "$(git diff --name-only --cached)" ]; then echo "Everything seems up to - date!"; else echo "Please ensure the branch is up-to-date, then regenerate the - specification by running make swagger-clean && make openapi3-gen" && return 1; - fi + date!"; else git diff --cached && echo "Please ensure the branch is up-to-date, + then regenerate the specification by running make swagger-clean && make openapi3-gen" + && return 1; fi depends_on: - clone-enterprise environment: @@ -1263,12 +1263,6 @@ steps: trigger: event: - pull_request - paths: - exclude: - - docs/** - - '*.md' - include: - - pkg/** type: docker volumes: - host: @@ -4926,6 +4920,6 @@ kind: secret name: gcr_credentials --- kind: signature -hmac: 32b6ed2f5819225842aa94379423bcf4354dde154e91af3e293bc919594c10b9 +hmac: 2f4a5620d00189804c2facf65fa2a17b75883cf330cd32e5612a2f36d3712847 ... diff --git a/pkg/api/alerting.go b/pkg/api/alerting.go index 8f6d8c4ac6c..22542636422 100644 --- a/pkg/api/alerting.go +++ b/pkg/api/alerting.go @@ -216,7 +216,7 @@ func (hs *HTTPServer) AlertTest(c *contextmodel.ReqContext) response.Response { // swagger:route GET /alerts/{alert_id} legacy_alerts getAlertByID // -// Get alert by ID. +// Get alert by internal ID. // // “evalMatches” data in the response is cached in the db when and only when the state of the alert changes (e.g. transitioning from “ok” to “alerting” state). // If data from one server triggers the alert first and, before that server is seen leaving alerting state, a second server also enters a state that would trigger the alert, the second server will not be visible in “evalMatches” data. diff --git a/pkg/services/ngalert/api/tooling/api.json b/pkg/services/ngalert/api/tooling/api.json index 9395f274c5d..dade93deb12 100644 --- a/pkg/services/ngalert/api/tooling/api.json +++ b/pkg/services/ngalert/api/tooling/api.json @@ -1368,7 +1368,7 @@ "type": "object" }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { diff --git a/pkg/services/ngalert/api/tooling/post.json b/pkg/services/ngalert/api/tooling/post.json index 8c9e8a312f7..8cd3d04a04f 100644 --- a/pkg/services/ngalert/api/tooling/post.json +++ b/pkg/services/ngalert/api/tooling/post.json @@ -1368,7 +1368,7 @@ "type": "object" }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { diff --git a/pkg/services/ngalert/api/tooling/spec.json b/pkg/services/ngalert/api/tooling/spec.json index 191253a57b8..5d23967fa7d 100644 --- a/pkg/services/ngalert/api/tooling/spec.json +++ b/pkg/services/ngalert/api/tooling/spec.json @@ -4972,7 +4972,7 @@ } }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { diff --git a/pkg/services/ngalert/schedule/schedule.go b/pkg/services/ngalert/schedule/schedule.go index 075cc9f9853..7a32e5bfebd 100644 --- a/pkg/services/ngalert/schedule/schedule.go +++ b/pkg/services/ngalert/schedule/schedule.go @@ -107,7 +107,7 @@ type SchedulerCfg struct { Log log.Logger } -// NewScheduler returns a new schedule. +// NewScheduler returns a new scheduler. func NewScheduler(cfg SchedulerCfg, stateManager *state.Manager) *schedule { const minMaxAttempts = int64(1) if cfg.MaxAttempts < minMaxAttempts { diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index ea1f0a592a5..3da3794f3ce 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -5959,7 +5959,7 @@ "type": "object", "title": "QueryDataResponse contains the results from a QueryDataRequest.", "properties": { - "Responses": { + "results": { "$ref": "#/definitions/Responses" } } diff --git a/public/api-merged.json b/public/api-merged.json index dd34a342523..9ad7eef2739 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -2368,7 +2368,7 @@ "tags": [ "legacy_alerts" ], - "summary": "Get alert by ID.", + "summary": "Get alert by internal ID.", "operationId": "getAlertByID", "parameters": [ { @@ -15287,7 +15287,7 @@ } }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { @@ -18459,7 +18459,7 @@ "type": "object", "title": "QueryDataResponse contains the results from a QueryDataRequest.", "properties": { - "Responses": { + "results": { "$ref": "#/definitions/Responses" } } diff --git a/public/openapi3.json b/public/openapi3.json index d6f99d851f9..3bd8efd4f2f 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -5797,7 +5797,7 @@ "type": "object" }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { @@ -8967,7 +8967,7 @@ "QueryDataResponse": { "description": "It is the return type of a QueryData call.", "properties": { - "Responses": { + "results": { "$ref": "#/components/schemas/Responses" } }, @@ -15537,7 +15537,7 @@ "$ref": "#/components/responses/internalServerError" } }, - "summary": "Get alert by ID.", + "summary": "Get alert by internal ID.", "tags": [ "legacy_alerts" ] diff --git a/scripts/drone/events/pr.star b/scripts/drone/events/pr.star index fb9f28e4535..0e14eab5c04 100644 --- a/scripts/drone/events/pr.star +++ b/scripts/drone/events/pr.star @@ -145,7 +145,6 @@ def pr_pipelines(): docs_pipelines(ver_mode, trigger_docs_pr()), shellcheck_pipeline(), swagger_gen( - get_pr_trigger(include_paths = ["pkg/**"]), ver_mode, ), integration_benchmarks( diff --git a/scripts/drone/pipelines/swagger_gen.star b/scripts/drone/pipelines/swagger_gen.star index ef82ce15474..7275f405bf2 100644 --- a/scripts/drone/pipelines/swagger_gen.star +++ b/scripts/drone/pipelines/swagger_gen.star @@ -33,14 +33,14 @@ def swagger_gen_step(ver_mode): "apk add --update git make", "make swagger-clean && make openapi3-gen", "for f in public/api-merged.json public/openapi3.json; do git add $f; done", - 'if [ -z "$(git diff --name-only --cached)" ]; then echo "Everything seems up to date!"; else echo "Please ensure the branch is up-to-date, then regenerate the specification by running make swagger-clean && make openapi3-gen" && return 1; fi', + 'if [ -z "$(git diff --name-only --cached)" ]; then echo "Everything seems up to date!"; else git diff --cached && echo "Please ensure the branch is up-to-date, then regenerate the specification by running make swagger-clean && make openapi3-gen" && return 1; fi', ], "depends_on": [ "clone-enterprise", ], } -def swagger_gen(trigger, ver_mode, source = "${DRONE_SOURCE_BRANCH}"): +def swagger_gen(ver_mode, source = "${DRONE_SOURCE_BRANCH}"): test_steps = [ clone_enterprise_step_pr(source = source, canFail = True), swagger_gen_step(ver_mode = ver_mode), @@ -48,7 +48,9 @@ def swagger_gen(trigger, ver_mode, source = "${DRONE_SOURCE_BRANCH}"): p = pipeline( name = "{}-swagger-gen".format(ver_mode), - trigger = trigger, + trigger = { + "event": ["pull_request"], + }, services = [], steps = test_steps, )