Build spec migration fails due to unrecognized tag #3198
Jimmy Kirk opened 23 hours ago

Environment

  • Upgrade path: OneDev 14.1.9 → 16.9.5 (Docker image 1dev/server:16.9.5, single server, embedded HSQLDB, data volume mounted at /opt/onedev). Also reproduced with 1dev/server:16.8.8.
  • Enterprise subscription active on the 14.1.9 server.

Symptom After the upgrade the server starts and the UI/API work, but no branch's .onedev-buildspec.yml can be parsed, so pushes trigger no builds and scheduled jobs don't run. On startup every branch logs:

WARN  i.o.server.job.DefaultJobService - Error caching branch schedules (project: <project>, branch: <branch>)
...
Caused by: org.yaml.snakeyaml.error.YAMLException: Invalid tag: !DefaultInterpreter

Our build spec declares version: 46 (written by 14.1.x) and its command steps use interpreter: !DefaultInterpreter, which the 16.0 incompatibility notes say is migrated automatically.

Root cause (as far as we can see) Calling io.onedev.server.buildspec.BuildSpec.parse(byte[]) on the same file inside the 16.9.5 image (classpath /app/boot + /app/lib) throws during migration:

java.lang.NoSuchMethodError: 'void org.yaml.snakeyaml.nodes.ScalarNode.<init>(org.yaml.snakeyaml.nodes.Tag, java.lang.String)'
  at io.onedev.server.buildspec.BuildSpec.migrate53(BuildSpec.java:2814)
  at io.onedev.server.data.migration.MigrationHelper.migrate(MigrationHelper.java:149)
  at io.onedev.server.data.migration.VersionedYamlDoc.toBean(VersionedYamlDoc.java:63)
  at io.onedev.server.buildspec.BuildSpec$1.load(BuildSpec.java:80)
  at io.onedev.server.buildspec.BuildSpec$1.load(BuildSpec.java:72)
  at io.onedev.server.buildspec.BuildSpec.parse(BuildSpec.java:573)

The image ships org.yaml.snakeyaml-2.7.jar (14.1.9 shipped 2.2). migrate53 uses the ScalarNode(Tag, String) constructor, which isn't present in snakeyaml 2.7, so migration from any build spec at version ≤ 52 aborts, and the un-migrated YAML (still containing !DefaultInterpreter) is then constructed and rejected.

Workarounds we tried:

  • Replacing !DefaultInterpreter with !PosixInterpreter while keeping version: 46 → the same Invalid tag: !DefaultInterpreter (migration still aborts in migrate53).
  • Declaring version: 56 to skip migration → fails on fields that later migrations would have changed (e.g. Unable to find property 'maxRetries' on class: io.onedev.server.buildspec.job.Job).

Questions

  1. Is this a known issue, and is there a fixed version (or a planned patch release)?
  2. Until then, what's the supported way to upgrade a 14.1.x install whose build specs are at version 46 — e.g. an intermediate version to upgrade through first that migrates and re-saves build specs, or a way to export a migrated build spec from a working version?
  3. Is there a safe way to get the migrated (version 56) YAML for our existing spec, so we can commit it before upgrading?

We've rolled back to 14.1.9 for now and have a separate test instance on 16.9.5 that reproduces the problem, and we're happy to run any diagnostic you need there.

  • Robin Shen changed title 21 hours ago
    Previous Value Current Value
    16.9.5: build spec migration fails (NoSuchMethodError ScalarNode in BuildSpec.migrate53) — CI stops after upgrading from 14.1.9
    Build spec migration fails due to unrecognized tag
  • OneDev commented 20 hours ago

    State changed as build OD-8756 (16.9.6) is successful

  • OneDev changed state to 'Closed' 20 hours ago
    Previous Value Current Value
    Open
    Closed
  • Robin Shen commented 20 hours ago

    This issue happens when build spec version is out of sync with its content, possibly due to manual editing of the build spec. The logic used to migrate old content is applied again in 16.9.6 to fix this specific error. Please avoid editing build spec manually in future.

1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
16.9.5
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-3198
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover