fix(actions): widen workflow_payload to MEDIUMBLOB — Actions creates no run (#815) #816

Merged
jmiller merged 1 commits from feature/815-workflow-payload into dev 2026-07-19 00:05:33 +00:00
3 changed files with 34 additions and 1 deletions
+3 -1
View File
@@ -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"`
+1
View File
@@ -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
}
+30
View File
@@ -0,0 +1,30 @@
// Copyright 2026 Moko Consulting <hello@mokoconsulting.tech>
// 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
}