bug: validate complains about YAML merge keys (<<) #1011

Closed
opened 2025-09-17 18:55:40 +00:00 by Freso · 5 comments
Contributor

Can you reproduce the bug on the Forgejo test instance?

Yes

Description

forgejo-runner validate complains about malformed YAML for codeberg.org/Freso/python-blocklister@a467f85525/.forgejo/workflows/publish.yaml :

.forgejo/workflows/publish.yaml workflow schema validation failed:
Line: 11 Column 5: Failed to match job-factory: Line: 41 Column 9: Failed to match run-step: Line: 41 Column 9: Unknown Property <<
Line: 43 Column 9: Unknown Property with
Line: 41 Column 9: Failed to match regular-step: Line: 41 Column 9: Unknown Property <<
Line: 11 Column 5: Failed to match workflow-job: Line: 12 Column 5: Unknown Property steps
Line: 101 Column 5: Failed to match job-factory: Line: 104 Column 9: Failed to match run-step: Line: 104 Column 9: Expected a mapping got alias
Line: 104 Column 9: Failed to match regular-step: Line: 104 Column 9: Expected a mapping got alias
Line: 105 Column 9: Failed to match run-step: Line: 105 Column 9: Unknown Property <<
Line: 106 Column 9: Unknown Property with
Line: 105 Column 9: Failed to match regular-step: Line: 105 Column 9: Unknown Property <<
Line: 101 Column 5: Failed to match workflow-job: Line: 103 Column 5: Unknown Property steps
Forgejo Actions YAML Schema validation error

Merge keys (<<) are valid, albeit optional/extended, YAML syntax, but the YAML library Forgejo uses seems to understand it—at least, Codeberg has run various iterations of these actions just fine. It would be nice if validate would not balk at them, since they’re very useful for reducing copy/paste (and, as such, complexity and chances of things falling out-of-sync, etc.) in YAML files. :)

Forgejo Version

No response

Runner Version

11.0.0 (same behaviour as of 89f37985bd)

How are you running Forgejo?

I’m not.

How are you running the Runner?

I’ve experienced this both using forgejo-runner validate --repository . --clonedir . (with v11.0.0) and also with commit 89f37985bd / c9498b877d1be32672f1f5f2433d637d842ddcd3 using the pre-commit hook (see #1002 ) with pre-commit run forgejo-runner-validate --all-files.

The used pre-commit hook configuration:

  - repo: https://code.forgejo.org/forgejo/runner                                                                                                                                   
    rev: c9498b877d1be32672f1f5f2433d637d842ddcd3                                                                                                                                   
    hooks:                                                                                                                                                                          
      - id: forgejo-runner-validate

Logs

No response

Workflow file

No response

### Can you reproduce the bug on the Forgejo test instance? Yes ### Description `forgejo-runner validate` complains about malformed YAML for https://codeberg.org/Freso/python-blocklister/src/commit/a467f85525cd6b3249b52d75d1ae2e5f76f47435b9b7c55ed15f49af666a2c46/.forgejo/workflows/publish.yaml : ``` .forgejo/workflows/publish.yaml workflow schema validation failed: Line: 11 Column 5: Failed to match job-factory: Line: 41 Column 9: Failed to match run-step: Line: 41 Column 9: Unknown Property << Line: 43 Column 9: Unknown Property with Line: 41 Column 9: Failed to match regular-step: Line: 41 Column 9: Unknown Property << Line: 11 Column 5: Failed to match workflow-job: Line: 12 Column 5: Unknown Property steps Line: 101 Column 5: Failed to match job-factory: Line: 104 Column 9: Failed to match run-step: Line: 104 Column 9: Expected a mapping got alias Line: 104 Column 9: Failed to match regular-step: Line: 104 Column 9: Expected a mapping got alias Line: 105 Column 9: Failed to match run-step: Line: 105 Column 9: Unknown Property << Line: 106 Column 9: Unknown Property with Line: 105 Column 9: Failed to match regular-step: Line: 105 Column 9: Unknown Property << Line: 101 Column 5: Failed to match workflow-job: Line: 103 Column 5: Unknown Property steps Forgejo Actions YAML Schema validation error ``` Merge keys (`<<`) are valid, albeit optional/extended, YAML syntax, but the YAML library Forgejo uses seems to understand it—at least, Codeberg has run various iterations of these actions just fine. It would be nice if `validate` would not balk at them, since they’re _very_ useful for reducing copy/paste (and, as such, complexity and chances of things falling out-of-sync, etc.) in YAML files. :) ### Forgejo Version _No response_ ### Runner Version 11.0.0 (same behaviour as of 89f37985bdd8d56601ac837d253e061380666987) ### How are you running Forgejo? I’m not. ### How are you running the Runner? I’ve experienced this both using `forgejo-runner validate --repository . --clonedir .` (with v11.0.0) and also with commit 89f37985bdd8d56601ac837d253e061380666987 / c9498b877d1be32672f1f5f2433d637d842ddcd3 using the `pre-commit` hook (see https://code.forgejo.org/forgejo/runner/pulls/1002 ) with `pre-commit run forgejo-runner-validate --all-files`. The used pre-commit hook configuration: ```yaml - repo: https://code.forgejo.org/forgejo/runner rev: c9498b877d1be32672f1f5f2433d637d842ddcd3 hooks: - id: forgejo-runner-validate ``` ### Logs _No response_ ### Workflow file _No response_
Contributor
on: [push]
jobs:
  test:
    runs-on: docker
    steps:
      - &step
        run: echo All good!
      - <<: *step
        name: second step

v13 fails

v13.next.forgejo.org/earl-warren/validatemerge@b5bfca5294/.forgejo/workflows/try.yml

image

v11 passes

v11.next.forgejo.org/earl-warren/actionvalidate@87006f9128/.forgejo/workflows/try.yml

image

```yaml on: [push] jobs: test: runs-on: docker steps: - &step run: echo All good! - <<: *step name: second step ``` ## v13 fails https://v13.next.forgejo.org/earl-warren/validatemerge/src/commit/b5bfca5294d9cb17d741599d24c33f4f136406c6/.forgejo/workflows/try.yml ![image](/attachments/e4007277-27ff-417f-9524-75c77b6f2d80) ## v11 passes https://v11.next.forgejo.org/earl-warren/actionvalidate/src/commit/87006f912838c72dc51ca5040d4a73959273a9d9/.forgejo/workflows/try.yml ![image](/attachments/de359081-1151-4638-a256-0cbbca2e735b)
Contributor
on: [push]
jobs:
  test:
    runs-on: docker
    steps:
      - &step
        run: echo All good!
      - *step

also fails validation

```yaml on: [push] jobs: test: runs-on: docker steps: - &step run: echo All good! - *step ``` also fails validation
Contributor

For the record https://rhysd.github.io/actionlint/ does not validate any of those.

For the record https://rhysd.github.io/actionlint/ does not validate any of those.
Contributor

It is good you caught that right before the release 😅

It is good you caught that right before the release 😅
Author
Contributor

I made the pre-commit hook for that repository, so I’ve been testing it on that too. I actually noticed this some days ago, but I was too busy getting the hook to work to dive in and formulate my thoughts coherently enough for a bug report 🙈

Thanks for fixing it so swiftly! 🙇

I made the pre-commit hook for that repository, so I’ve been testing it on that too. I actually noticed this some days ago, but I was too busy getting the hook to work to dive in and formulate my thoughts coherently enough for a bug report 🙈 Thanks for fixing it so swiftly! 🙇
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner#1011
No description provided.