From c7507377c7f4eaa4aae21120cd4b0c70e2104dd3 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 18 Jul 2026 17:03:15 -0500 Subject: [PATCH] fix(actions): widen action_run_job.workflow_payload to MEDIUMBLOB (#815) Gitea Actions accepted workflow_dispatch (HTTP 204) but created no run: the async InsertRun failed with MySQL 1406 "Data too long for column 'workflow_payload'". ActionRunJob.WorkflowPayload was an untyped []byte -> plain BLOB (64 KiB) on MySQL/MariaDB. At run creation the whole SingleWorkflow is interpolated (every ${{ vars.* }} / git context) and marshaled into that column, so large single-job workflows (deploy-*.yml with big inline scripts + many vars) overflowed it and the run was silently dropped. - run_job.go: tag WorkflowPayload `xorm:"MEDIUMBLOB"` (16 MiB) so NEW installs get a wide column. - migration 371 (v372.go): ALTER existing action_run_job.workflow_payload BLOB -> MEDIUMBLOB on MySQL/MariaDB; no-op on Postgres/SQLite (unbounded). Permanently unblocks all deploy tiers regardless of the concurrency-block workaround. Fixes #815. Authored-by: Moko Consulting --- models/actions/run_job.go | 4 +++- models/migrations/migrations.go | 1 + models/migrations/v1_27/v372.go | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 models/migrations/v1_27/v372.go diff --git a/models/actions/run_job.go b/models/actions/run_job.go index 287c38fbe7..8bb192c94b 100644 --- a/models/actions/run_job.go +++ b/models/actions/run_job.go @@ -40,7 +40,9 @@ type ActionRunJob struct { // WorkflowPayload is act/jobparser.SingleWorkflow for act/jobparser.Parse // it should contain exactly one job with global workflow fields for this model - WorkflowPayload []byte + // MEDIUMBLOB: an untyped []byte maps to a 64 KiB BLOB on MySQL/MariaDB; large + // single-job workflows overflow it and InsertRun fails (see migration 371). + WorkflowPayload []byte `xorm:"MEDIUMBLOB"` JobID string `xorm:"VARCHAR(255)"` // job id in workflow, not job's id Needs []string `xorm:"JSON TEXT"` diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 7d0e4c5065..13c5c60701 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -448,6 +448,7 @@ func prepareMigrationTasks() []*migration { newMigration(368, "Drop org from repo manifest (derived from org profile)", v1_27.DropOrgFromRepoManifest), newMigration(369, "Rename mokogitea-actions system user to mokogit-actions", v1_27.RenameActionsUserToMokoGit), newMigration(370, "Remap saved gitea-* user themes to mokogit-*", v1_27.RemapGiteaThemesToMokogit), + newMigration(371, "Widen action_run_job.workflow_payload to MEDIUMBLOB", v1_27.WidenActionRunJobWorkflowPayload), } return preparedMigrations } diff --git a/models/migrations/v1_27/v372.go b/models/migrations/v1_27/v372.go new file mode 100644 index 0000000000..520e017775 --- /dev/null +++ b/models/migrations/v1_27/v372.go @@ -0,0 +1,30 @@ +// Copyright 2026 Moko Consulting +// SPDX-License-Identifier: GPL-3.0-or-later + +package v1_27 + +import ( + "xorm.io/xorm" + "xorm.io/xorm/schemas" +) + +// WidenActionRunJobWorkflowPayload widens action_run_job.workflow_payload on +// MySQL/MariaDB from the default BLOB (64 KiB) to MEDIUMBLOB (16 MiB). +// +// ActionRunJob.WorkflowPayload was declared as an untyped []byte, so xorm created +// a plain BLOB. At run creation the whole SingleWorkflow is interpolated (every +// ${{ vars.* }} / git-context) and marshaled into this column; large single-job +// workflows (e.g. deploy-*.yml with big inline SSH scripts and many vars) exceed +// 64 KiB, so InsertRun fails with MySQL error 1406 "Data too long for column +// 'workflow_payload'". Because workflow_dispatch returns 204 before that async +// insert runs, the run is silently dropped ("204 but no run" — issue #815). +// +// Postgres (bytea) and SQLite (BLOB) have no practical size limit, so this is a +// no-op there. +func WidenActionRunJobWorkflowPayload(x *xorm.Engine) error { + if x.Dialect().URI().DBType != schemas.MYSQL { + return nil + } + _, err := x.Exec("ALTER TABLE `action_run_job` MODIFY COLUMN `workflow_payload` MEDIUMBLOB") + return err +} -- 2.52.0