From 23665646aa9e0505e5e3716f0bbb087ccc592969 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Wed, 24 Jul 2024 17:29:32 +0200 Subject: [PATCH 1/5] Refactor JSON and SDK fields --- docs/docs/91-migrations.md | 1 + server/model/cron.go | 16 +-- server/model/feed.go | 6 +- server/model/pipeline.go | 10 +- server/model/step.go | 4 +- server/model/workflow.go | 4 +- .../migration/033_rename_start_end_time.go | 59 ++++++++++ server/store/datastore/migration/migration.go | 1 + .../components/repo/pipeline/PipelineLog.vue | 12 +-- .../repo/pipeline/PipelineStepDuration.vue | 6 +- .../repo/pipeline/PipelineStepList.vue | 2 +- web/src/compositions/usePipeline.ts | 8 +- web/src/lib/api/types/pipeline.ts | 22 ++-- web/src/utils/helpers.ts | 2 +- woodpecker-go/woodpecker/types.go | 101 ++++++++---------- 15 files changed, 147 insertions(+), 107 deletions(-) create mode 100644 server/store/datastore/migration/033_rename_start_end_time.go diff --git a/docs/docs/91-migrations.md b/docs/docs/91-migrations.md index 42528ce252..a3afe6c269 100644 --- a/docs/docs/91-migrations.md +++ b/docs/docs/91-migrations.md @@ -23,6 +23,7 @@ Some versions need some changes to the server configuration or the pipeline conf - Deprecated `environment` filter, use `when.evaluate` - Deprecated `WOODPECKER_WEBHOOK_HOST` in favor of `WOODPECKER_EXPERT_WEBHOOK_HOST` - Migrated to rfc9421 for webhook signatures +- Renamed `start_time`, `end_time`, `created_at`, `started_at`, `finished_at` and `reviewed_at` JSON fields to `started`, `finished`, `created`, `started`, `finished`, `reviewed` ## 2.0.0 diff --git a/server/model/cron.go b/server/model/cron.go index 42467de357..06c0d9db28 100644 --- a/server/model/cron.go +++ b/server/model/cron.go @@ -21,14 +21,14 @@ import ( ) type Cron struct { - ID int64 `json:"id" xorm:"pk autoincr 'id'"` - Name string `json:"name" xorm:"name UNIQUE(s) INDEX"` - RepoID int64 `json:"repo_id" xorm:"repo_id UNIQUE(s) INDEX"` - CreatorID int64 `json:"creator_id" xorm:"creator_id INDEX"` - NextExec int64 `json:"next_exec" xorm:"next_exec"` - Schedule string `json:"schedule" xorm:"schedule NOT NULL"` // @weekly, 3min, ... - Created int64 `json:"created_at" xorm:"created NOT NULL DEFAULT 0"` // TODO change JSON field to "created" in 3.0 - Branch string `json:"branch" xorm:"branch"` + ID int64 `json:"id" xorm:"pk autoincr 'id'"` + Name string `json:"name" xorm:"name UNIQUE(s) INDEX"` + RepoID int64 `json:"repo_id" xorm:"repo_id UNIQUE(s) INDEX"` + CreatorID int64 `json:"creator_id" xorm:"creator_id INDEX"` + NextExec int64 `json:"next_exec" xorm:"next_exec"` + Schedule string `json:"schedule" xorm:"schedule NOT NULL"` // @weekly, 3min, ... + Created int64 `json:"created" xorm:"created NOT NULL DEFAULT 0"` + Branch string `json:"branch" xorm:"branch"` } // @name Cron // TableName returns the database table name for xorm. diff --git a/server/model/feed.go b/server/model/feed.go index 0dd4b5d3a3..e7152f53dd 100644 --- a/server/model/feed.go +++ b/server/model/feed.go @@ -22,9 +22,9 @@ type Feed struct { Number int64 `json:"number,omitempty" xorm:"pipeline_number"` Event string `json:"event,omitempty" xorm:"pipeline_event"` Status string `json:"status,omitempty" xorm:"pipeline_status"` - Created int64 `json:"created_at,omitempty" xorm:"pipeline_created"` // TODO change JSON field to "created" in 3.0 - Started int64 `json:"started_at,omitempty" xorm:"pipeline_started"` // TODO change JSON field to "started" in 3.0 - Finished int64 `json:"finished_at,omitempty" xorm:"pipeline_finished"` // TODO change JSON field to "finished" in 3.0 + Created int64 `json:"created,omitempty" xorm:"pipeline_created"` // TODO change JSON field to "created" in 3.0 + Started int64 `json:"started,omitempty" xorm:"pipeline_started"` // TODO change JSON field to "started" in 3.0 + Finished int64 `json:"finished,omitempty" xorm:"pipeline_finished"` // TODO change JSON field to "finished" in 3.0 Commit string `json:"commit,omitempty" xorm:"pipeline_commit"` Branch string `json:"branch,omitempty" xorm:"pipeline_branch"` Ref string `json:"ref,omitempty" xorm:"pipeline_ref"` diff --git a/server/model/pipeline.go b/server/model/pipeline.go index 5106308dee..a073ad15fb 100644 --- a/server/model/pipeline.go +++ b/server/model/pipeline.go @@ -28,10 +28,10 @@ type Pipeline struct { Event WebhookEvent `json:"event" xorm:"event"` Status StatusValue `json:"status" xorm:"INDEX 'status'"` Errors []*types.PipelineError `json:"errors" xorm:"json 'errors'"` - Created int64 `json:"created_at" xorm:"'created' NOT NULL DEFAULT 0 created"` // TODO change JSON field to "created" in 3.0 - Updated int64 `json:"updated_at" xorm:"'updated' NOT NULL DEFAULT 0 updated"` // TODO change JSON field to "updated" in 3.0 - Started int64 `json:"started_at" xorm:"started"` // TODO change JSON field to "started" in 3.0 - Finished int64 `json:"finished_at" xorm:"finished"` // TODO change JSON field to "finished" in 3.0 + Created int64 `json:"created" xorm:"'created' NOT NULL DEFAULT 0 created"` + Updated int64 `json:"updated" xorm:"'updated' NOT NULL DEFAULT 0 updated"` + Started int64 `json:"started" xorm:"started"` + Finished int64 `json:"finished" xorm:"finished"` DeployTo string `json:"deploy_to" xorm:"deploy"` DeployTask string `json:"deploy_task" xorm:"deploy_task"` Commit string `json:"commit" xorm:"commit"` @@ -46,7 +46,7 @@ type Pipeline struct { Email string `json:"author_email" xorm:"email"` ForgeURL string `json:"forge_url" xorm:"forge_url"` Reviewer string `json:"reviewed_by" xorm:"reviewer"` - Reviewed int64 `json:"reviewed_at" xorm:"reviewed"` // TODO change JSON field to "reviewed" in 3.0 + Reviewed int64 `json:"reviewed" xorm:"reviewed"` Workflows []*Workflow `json:"workflows,omitempty" xorm:"-"` ChangedFiles []string `json:"changed_files,omitempty" xorm:"LONGTEXT 'changed_files'"` AdditionalVariables map[string]string `json:"variables,omitempty" xorm:"json 'additional_variables'"` diff --git a/server/model/step.go b/server/model/step.go index 97189e733f..d39da2c8e9 100644 --- a/server/model/step.go +++ b/server/model/step.go @@ -36,8 +36,8 @@ type Step struct { Error string `json:"error,omitempty" xorm:"TEXT 'error'"` Failure string `json:"-" xorm:"failure"` ExitCode int `json:"exit_code" xorm:"exit_code"` - Started int64 `json:"start_time,omitempty" xorm:"started"` - Finished int64 `json:"end_time,omitempty" xorm:"stopped"` + Started int64 `json:"started,omitempty" xorm:"started"` + Finished int64 `json:"finished,omitempty" xorm:"stopped"` Type StepType `json:"type,omitempty" xorm:"type"` } // @name Step diff --git a/server/model/workflow.go b/server/model/workflow.go index 7efd5f1517..ad5cd94b4d 100644 --- a/server/model/workflow.go +++ b/server/model/workflow.go @@ -23,8 +23,8 @@ type Workflow struct { Name string `json:"name" xorm:"name"` State StatusValue `json:"state" xorm:"state"` Error string `json:"error,omitempty" xorm:"TEXT 'error'"` - Started int64 `json:"start_time,omitempty" xorm:"started"` - Finished int64 `json:"end_time,omitempty" xorm:"stopped"` + Started int64 `json:"started,omitempty" xorm:"started"` + Finished int64 `json:"finished,omitempty" xorm:"stopped"` AgentID int64 `json:"agent_id,omitempty" xorm:"agent_id"` Platform string `json:"platform,omitempty" xorm:"platform"` Environ map[string]string `json:"environ,omitempty" xorm:"json 'environ'"` diff --git a/server/store/datastore/migration/033_rename_start_end_time.go b/server/store/datastore/migration/033_rename_start_end_time.go new file mode 100644 index 0000000000..2bc968f6bf --- /dev/null +++ b/server/store/datastore/migration/033_rename_start_end_time.go @@ -0,0 +1,59 @@ +// Copyright 2024 Woodpecker Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package migration + +import ( + "fmt" + + "src.techknowlogick.com/xormigrate" + "xorm.io/xorm" +) + +type stepV033 struct { + Finished int64 `xorm:"stopped"` +} + +func (stepV033) TableName() string { + return "steps" +} + +type workflowV033 struct { + Finished int64 `xorm:"stopped"` +} + +func (workflowV033) TableName() string { + return "workflows" +} + +var renameStartEndTime = xormigrate.Migration{ + ID: "rename-start-end-time", + MigrateSession: func(sess *xorm.Session) (err error) { + if err := sess.Sync(new(stepV033), new(workflowV033)); err != nil { + return fmt.Errorf("sync models failed: %w", err) + } + + // Step + if err := renameColumn(sess, "steps", "stopped", "finished"); err != nil { + return err + } + + // Workflow + if err := renameColumn(sess, "workflows", "stopped", "finished"); err != nil { + return err + } + + return nil + }, +} diff --git a/server/store/datastore/migration/migration.go b/server/store/datastore/migration/migration.go index 4c905e66e0..1eb2224e74 100644 --- a/server/store/datastore/migration/migration.go +++ b/server/store/datastore/migration/migration.go @@ -63,6 +63,7 @@ var migrationTasks = []*xormigrate.Migration{ &setForgeID, &unifyColumnsTables, &alterTableRegistriesFixRequiredFields, + &renameStartEndTime, } var allBeans = []any{ diff --git a/web/src/components/repo/pipeline/PipelineLog.vue b/web/src/components/repo/pipeline/PipelineLog.vue index f296c5eff9..3611ea4d01 100644 --- a/web/src/components/repo/pipeline/PipelineLog.vue +++ b/web/src/components/repo/pipeline/PipelineLog.vue @@ -13,7 +13,7 @@
{{ step.error }} {{ $t('repo.pipeline.actions.canceled') }} - {{ $t('repo.pipeline.step_not_started') }} + {{ $t('repo.pipeline.step_not_started') }}
{{ $t('repo.pipeline.loading') }}
@@ -349,7 +349,7 @@ watch(stepSlug, async () => { watch(step, async (newStep, oldStep) => { if (oldStep?.name === newStep?.name) { - if (oldStep?.end_time !== newStep?.end_time && autoScroll.value) { + if (oldStep?.finished !== newStep?.finished && autoScroll.value) { scrollDown(); } diff --git a/web/src/components/repo/pipeline/PipelineStepDuration.vue b/web/src/components/repo/pipeline/PipelineStepDuration.vue index 8fd6e03d39..0b79a4bd1a 100644 --- a/web/src/components/repo/pipeline/PipelineStepDuration.vue +++ b/web/src/components/repo/pipeline/PipelineStepDuration.vue @@ -19,8 +19,8 @@ const workflow = toRef(props, 'workflow'); const { durationAsNumber } = useDate(); const durationRaw = computed(() => { - const start = (step.value ? step.value?.start_time : workflow.value?.start_time) || 0; - const end = (step.value ? step.value?.end_time : workflow.value?.end_time) || 0; + const start = (step.value ? step.value?.started : workflow.value?.started) || 0; + const end = (step.value ? step.value?.finished : workflow.value?.finished) || 0; if (end === 0 && start === 0) { return undefined; @@ -43,5 +43,5 @@ const duration = computed(() => { return durationAsNumber(durationElapsed.value || 0); }); -const started = computed(() => (step.value ? step.value?.start_time : workflow.value?.start_time) !== undefined); +const started = computed(() => (step.value ? step.value?.started : workflow.value?.started) !== undefined); diff --git a/web/src/components/repo/pipeline/PipelineStepList.vue b/web/src/components/repo/pipeline/PipelineStepList.vue index 18e117a4ce..50006de256 100644 --- a/web/src/components/repo/pipeline/PipelineStepList.vue +++ b/web/src/components/repo/pipeline/PipelineStepList.vue @@ -82,7 +82,7 @@ {{ workflow.name }} diff --git a/web/src/compositions/usePipeline.ts b/web/src/compositions/usePipeline.ts index d02409fdbb..b4c8a6804d 100644 --- a/web/src/compositions/usePipeline.ts +++ b/web/src/compositions/usePipeline.ts @@ -14,7 +14,7 @@ export default (pipeline: Ref) => { return undefined; } - const start = pipeline.value.created_at || 0; + const start = pipeline.value.created || 0; return start * 1000; }); @@ -44,8 +44,8 @@ export default (pipeline: Ref) => { return undefined; } - const start = pipeline.value.started_at || 0; - const end = pipeline.value.finished_at || pipeline.value.updated_at || 0; + const start = pipeline.value.started || 0; + const end = pipeline.value.finished || pipeline.value.updated || 0; if (start === 0 || end === 0) { return 0; @@ -109,7 +109,7 @@ export default (pipeline: Ref) => { return undefined; } - const start = pipeline.value.created_at || 0; + const start = pipeline.value.created || 0; return toLocaleString(new Date(start * 1000)); }); diff --git a/web/src/lib/api/types/pipeline.ts b/web/src/lib/api/types/pipeline.ts index 18b784e6d6..2ca9ccf0d8 100644 --- a/web/src/lib/api/types/pipeline.ts +++ b/web/src/lib/api/types/pipeline.ts @@ -25,16 +25,16 @@ export interface Pipeline { errors?: PipelineError[]; // When the pipeline request was received. - created_at: number; + created: number; // When the pipeline was updated last time in database. - updated_at: number; + updated: number; // When the pipeline began execution. - started_at: number; + started: number; // When the pipeline was finished. - finished_at: number; + finished: number; // Where the deployment should go. deploy_to: string; @@ -76,13 +76,9 @@ export interface Pipeline { // This url will point to the repository state associated with the pipeline's commit. forge_url: string; - signed: boolean; - - verified: boolean; - reviewed_by: string; - reviewed_at: number; + reviewed: number; // The steps associated with this pipeline. // A pipeline will have multiple steps if a matrix pipeline was used or if a rebuild was requested. @@ -110,8 +106,8 @@ export interface PipelineWorkflow { name: string; state: PipelineStatus; environ?: Record; - start_time?: number; - end_time?: number; + started?: number; + finished?: number; agent_id?: number; error?: string; children: PipelineStep[]; @@ -126,8 +122,8 @@ export interface PipelineStep { name: string; state: PipelineStatus; exit_code: number; - start_time?: number; - end_time?: number; + started?: number; + finished?: number; error?: string; type?: StepType; } diff --git a/web/src/utils/helpers.ts b/web/src/utils/helpers.ts index ecd2b47f23..2efb9818b6 100644 --- a/web/src/utils/helpers.ts +++ b/web/src/utils/helpers.ts @@ -46,7 +46,7 @@ export function isStepRunning(step: PipelineStep): boolean { * @returns {number} 0 if created at the same time, < 0 if b was create before a, > 0 otherwise */ export function comparePipelines(a: Pipeline, b: Pipeline): number { - return (b.created_at || -1) - (a.created_at || -1); + return (b.created || -1) - (a.created || -1); } /** diff --git a/woodpecker-go/woodpecker/types.go b/woodpecker-go/woodpecker/types.go index b9622ddb6b..09bf183cab 100644 --- a/woodpecker-go/woodpecker/types.go +++ b/woodpecker-go/woodpecker/types.go @@ -69,35 +69,32 @@ type ( // Pipeline defines a pipeline object. Pipeline struct { - ID int64 `json:"id"` - Number int64 `json:"number"` - Parent int64 `json:"parent"` - Event string `json:"event"` - Status string `json:"status"` - Errors []*PipelineError `json:"errors"` - // Deprecated TODO remove in 3.x - Enqueued int64 `json:"enqueued_at"` - Created int64 `json:"created_at"` - Updated int64 `json:"updated_at"` - Started int64 `json:"started_at"` - Finished int64 `json:"finished_at"` - Deploy string `json:"deploy_to"` - Commit string `json:"commit"` - Branch string `json:"branch"` - Ref string `json:"ref"` - Refspec string `json:"refspec"` - CloneURL string `json:"clone_url"` - Title string `json:"title"` - Message string `json:"message"` - Timestamp int64 `json:"timestamp"` - Sender string `json:"sender"` - Author string `json:"author"` - Avatar string `json:"author_avatar"` - Email string `json:"author_email"` - ForgeURL string `json:"forge_url"` - Reviewer string `json:"reviewed_by"` - Reviewed int64 `json:"reviewed_at"` - Workflows []*Workflow `json:"workflows,omitempty"` + ID int64 `json:"id"` + Number int64 `json:"number"` + Parent int64 `json:"parent"` + Event string `json:"event"` + Status string `json:"status"` + Errors []*PipelineError `json:"errors"` + Created int64 `json:"created_at"` + Updated int64 `json:"updated_at"` + Started int64 `json:"started_at"` + Finished int64 `json:"finished_at"` + Deploy string `json:"deploy_to"` + Commit string `json:"commit"` + Branch string `json:"branch"` + Ref string `json:"ref"` + Refspec string `json:"refspec"` + Title string `json:"title"` + Message string `json:"message"` + Timestamp int64 `json:"timestamp"` + Sender string `json:"sender"` + Author string `json:"author"` + Avatar string `json:"author_avatar"` + Email string `json:"author_email"` + ForgeURL string `json:"forge_url"` + Reviewer string `json:"reviewed_by"` + Reviewed int64 `json:"reviewed_at"` + Workflows []*Workflow `json:"workflows,omitempty"` } // Workflow represents a workflow in the pipeline. @@ -137,10 +134,6 @@ type ( Address string `json:"address"` Username string `json:"username"` Password string `json:"password,omitempty"` - // Deprecated - Email string `json:"email"` // TODO: remove in 3.x - // Deprecated - Token string `json:"token"` // TODO: remove in 3.x } // Secret represents a secret variable, such as a password or token. @@ -161,9 +154,9 @@ type ( Number int64 `json:"number,omitempty"` Event string `json:"event,omitempty"` Status string `json:"status,omitempty"` - Created int64 `json:"created_at,omitempty"` - Started int64 `json:"started_at,omitempty"` - Finished int64 `json:"finished_at,omitempty"` + Created int64 `json:"created,omitempty"` + Started int64 `json:"started,omitempty"` + Finished int64 `json:"finished,omitempty"` Commit string `json:"commit,omitempty"` Branch string `json:"branch,omitempty"` Ref string `json:"ref,omitempty"` @@ -183,31 +176,21 @@ type ( Commit string `json:"commit,omitempty"` } - //nolint:godot - // TODO: use dedicated struct in 3.x - // QueueStats struct { - // Workers int `json:"worker_count"` - // Pending int `json:"pending_count"` - // WaitingOnDeps int `json:"waiting_on_deps_count"` - // Running int `json:"running_count"` - // Complete int `json:"completed_count"` - // } + QueueStats struct { + Workers int `json:"worker_count"` + Pending int `json:"pending_count"` + WaitingOnDeps int `json:"waiting_on_deps_count"` + Running int `json:"running_count"` + Complete int `json:"completed_count"` + } // Info provides queue stats. Info struct { - Pending []Task `json:"pending"` - WaitingOnDeps []Task `json:"waiting_on_deps"` - Running []Task `json:"running"` - // TODO: use dedicated struct in 3.x - // Stats QueueStats `json:"stats"` - Stats struct { - Workers int `json:"worker_count"` - Pending int `json:"pending_count"` - WaitingOnDeps int `json:"waiting_on_deps_count"` - Running int `json:"running_count"` - Complete int `json:"completed_count"` - } `json:"stats"` - Paused bool `json:"paused,omitempty"` + Pending []Task `json:"pending"` + WaitingOnDeps []Task `json:"waiting_on_deps"` + Running []Task `json:"running"` + Stats QueueStats `json:"stats"` + Paused bool `json:"paused,omitempty"` } // LogLevel is for checking/setting logging level. @@ -233,7 +216,7 @@ type ( CreatorID int64 `json:"creator_id"` NextExec int64 `json:"next_exec"` Schedule string `json:"schedule"` - Created int64 `json:"created_at"` + Created int64 `json:"created"` Branch string `json:"branch"` } From 91f06988f65df9514100f192f1e8ef21cf2a1702 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:26:17 +0200 Subject: [PATCH 2/5] Aktualisieren von step.go --- server/model/step.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/step.go b/server/model/step.go index d39da2c8e9..dba0d3bac8 100644 --- a/server/model/step.go +++ b/server/model/step.go @@ -37,7 +37,7 @@ type Step struct { Failure string `json:"-" xorm:"failure"` ExitCode int `json:"exit_code" xorm:"exit_code"` Started int64 `json:"started,omitempty" xorm:"started"` - Finished int64 `json:"finished,omitempty" xorm:"stopped"` + Finished int64 `json:"finished,omitempty" xorm:"finished"` Type StepType `json:"type,omitempty" xorm:"type"` } // @name Step From 0a1cc561b860a167de5688e8693ff99468eec6d4 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:26:32 +0200 Subject: [PATCH 3/5] Aktualisieren von workflow.go --- server/model/workflow.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/workflow.go b/server/model/workflow.go index ad5cd94b4d..e6029ab69c 100644 --- a/server/model/workflow.go +++ b/server/model/workflow.go @@ -24,7 +24,7 @@ type Workflow struct { State StatusValue `json:"state" xorm:"state"` Error string `json:"error,omitempty" xorm:"TEXT 'error'"` Started int64 `json:"started,omitempty" xorm:"started"` - Finished int64 `json:"finished,omitempty" xorm:"stopped"` + Finished int64 `json:"finished,omitempty" xorm:"finished"` AgentID int64 `json:"agent_id,omitempty" xorm:"agent_id"` Platform string `json:"platform,omitempty" xorm:"platform"` Environ map[string]string `json:"environ,omitempty" xorm:"json 'environ'"` From 776d802abbd7bb84ca5c3f26b999b297024dee68 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Thu, 25 Jul 2024 16:53:56 +0200 Subject: [PATCH 4/5] swagger --- cmd/server/docs/docs.go | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 3113408cc6..22c8c9c4c5 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -4415,8 +4415,7 @@ const docTemplate = `{ "branch": { "type": "string" }, - "created_at": { - "description": "TODO change JSON field to \"created\" in 3.0", + "created": { "type": "integer" }, "creator_id": { @@ -4458,14 +4457,14 @@ const docTemplate = `{ "commit": { "type": "string" }, - "created_at": { + "created": { "description": "TODO change JSON field to \"created\" in 3.0", "type": "integer" }, "event": { "type": "string" }, - "finished_at": { + "finished": { "description": "TODO change JSON field to \"finished\" in 3.0", "type": "integer" }, @@ -4487,7 +4486,7 @@ const docTemplate = `{ "repo_id": { "type": "integer" }, - "started_at": { + "started": { "description": "TODO change JSON field to \"started\" in 3.0", "type": "integer" }, @@ -4645,8 +4644,7 @@ const docTemplate = `{ "commit": { "type": "string" }, - "created_at": { - "description": "TODO change JSON field to \"created\" in 3.0", + "created": { "type": "integer" }, "deploy_task": { @@ -4664,8 +4662,7 @@ const docTemplate = `{ "event": { "$ref": "#/definitions/WebhookEvent" }, - "finished_at": { - "description": "TODO change JSON field to \"finished\" in 3.0", + "finished": { "type": "integer" }, "forge_url": { @@ -4698,8 +4695,7 @@ const docTemplate = `{ "refspec": { "type": "string" }, - "reviewed_at": { - "description": "TODO change JSON field to \"reviewed\" in 3.0", + "reviewed": { "type": "integer" }, "reviewed_by": { @@ -4709,8 +4705,7 @@ const docTemplate = `{ "description": "uses reported user for webhooks and name of cron for cron pipelines", "type": "string" }, - "started_at": { - "description": "TODO change JSON field to \"started\" in 3.0", + "started": { "type": "integer" }, "status": { @@ -4722,8 +4717,7 @@ const docTemplate = `{ "title": { "type": "string" }, - "updated_at": { - "description": "TODO change JSON field to \"updated\" in 3.0", + "updated": { "type": "integer" }, "variables": { @@ -5012,15 +5006,15 @@ const docTemplate = `{ "Step": { "type": "object", "properties": { - "end_time": { - "type": "integer" - }, "error": { "type": "string" }, "exit_code": { "type": "integer" }, + "finished": { + "type": "integer" + }, "id": { "type": "integer" }, @@ -5036,7 +5030,7 @@ const docTemplate = `{ "ppid": { "type": "integer" }, - "start_time": { + "started": { "type": "integer" }, "state": { @@ -5196,9 +5190,6 @@ const docTemplate = `{ "$ref": "#/definitions/Step" } }, - "end_time": { - "type": "integer" - }, "environ": { "type": "object", "additionalProperties": { @@ -5208,6 +5199,9 @@ const docTemplate = `{ "error": { "type": "string" }, + "finished": { + "type": "integer" + }, "id": { "type": "integer" }, @@ -5223,7 +5217,7 @@ const docTemplate = `{ "platform": { "type": "string" }, - "start_time": { + "started": { "type": "integer" }, "state": { From 5e4a67c37b8ca38a175e40d283a5e2f491ebddcc Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 7 Aug 2024 10:23:34 +0200 Subject: [PATCH 5/5] TODOs got resolved --- server/model/feed.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/model/feed.go b/server/model/feed.go index e7152f53dd..04357fc4ec 100644 --- a/server/model/feed.go +++ b/server/model/feed.go @@ -22,9 +22,9 @@ type Feed struct { Number int64 `json:"number,omitempty" xorm:"pipeline_number"` Event string `json:"event,omitempty" xorm:"pipeline_event"` Status string `json:"status,omitempty" xorm:"pipeline_status"` - Created int64 `json:"created,omitempty" xorm:"pipeline_created"` // TODO change JSON field to "created" in 3.0 - Started int64 `json:"started,omitempty" xorm:"pipeline_started"` // TODO change JSON field to "started" in 3.0 - Finished int64 `json:"finished,omitempty" xorm:"pipeline_finished"` // TODO change JSON field to "finished" in 3.0 + Created int64 `json:"created,omitempty" xorm:"pipeline_created"` + Started int64 `json:"started,omitempty" xorm:"pipeline_started"` + Finished int64 `json:"finished,omitempty" xorm:"pipeline_finished"` Commit string `json:"commit,omitempty" xorm:"pipeline_commit"` Branch string `json:"branch,omitempty" xorm:"pipeline_branch"` Ref string `json:"ref,omitempty" xorm:"pipeline_ref"`