镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix invalid YAML in fleetctl new GitHub workflow template - #56479

Merged
lucasmrod merged 2 commits into
mainfrom
tux234-fix-fleetctl-new-workflow-yaml
Oct 26, 2026
Merged

lucasmrod merged 2 commits into
mainfrom
tux234-fix-fleetctl-new-workflow-yaml

Conversation

@tux234

@tux234 tux234 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Related issue: #56477

The pull_request_target trigger in the fleetctl new GitHub Actions workflow template had branches: indented two spaces deeper than its sibling paths:, so the generated .github/workflows/workflow.yml isn't valid YAML (did not find expected key while parsing a block mapping) and GitHub rejects it as an invalid workflow. This dedents branches: and - main to match the push: block. Nothing else in the template changes.

The bug came in with #53059 and is also on rc-minor-fleet-v4.94.0, so this needs a cherry-pick into rc-minor-fleet-v4.94.0 before 4.94.0 ships. 4.93.1 isn't affected.

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Testing

  • Added/updated automated tests

TestNewBasicFileStructure gets a new generates valid YAML files subtest that walks the fleetctl new output and parses every .yml/.yaml file with github.com/ghodss/yaml, the library new_test.go already uses. It fails on main and passes with the fix:

# before
--- FAIL: TestNewBasicFileStructure/generates_valid_YAML_files
    Error: error converting YAML to JSON: yaml: line 16: did not find expected key
    Messages: invalid YAML in .../out/.github/workflows/workflow.yml

# after
--- PASS: TestNewBasicFileStructure/generates_valid_YAML_files
ok  	github.com/fleetdm/fleet/v4/cmd/fleetctl/fleetctl
  • QA'd all new/changed functionality manually

Built fleetctl from this branch and ran fleetctl new --org-name "QA Org". All 11 generated YAML files parse with a second, independent parser (Ruby Psych), and yq '.on.pull_request_target' on the generated workflow.yml returns branches: [main] and paths: ["**"], matching push:. Psych rejects the main version of the template with the same "did not find expected key" error.

For unreleased bug fixes in a release candidate, one of:

  • Confirmed that the fix is not expected to adversely impact load test results

AI

AI: Claude Code (claude-opus-5-5)

Frontend

  • Attached a screenshot or screen recording of each user-visible change. Screenshot: N/A, no UI change.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the GitHub Actions workflow generated by fleetctl new so it uses valid YAML and can be accepted by GitHub. This prevents newly generated workflows from failing due to a YAML parsing error.
    • Added checks to help ensure YAML files in generated output are parseable, reducing the risk of invalid configuration files.

The pull_request_target trigger's branches key was over-indented, so
every workflow scaffolded by fleetctl new failed to parse. Add a test
that parses every YAML file the command writes.
@tux234
tux234 requested a review from a team as a code owner October 23, 2026 20:33
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: fleetdm/fleet
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: b2b73f1
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: db8f2190-14f7-4ff9-860b-6f1db033f054
📥 Commits

Reviewing files that changed from the base of the PR and between 92a3a37 and 04e724f.

📒 Files selected for processing: 1
  • cmd/fleetctl/fleetctl/new_test.go
🚧 Files skipped from review as they are similar to previous changes: 1
  • cmd/fleetctl/fleetctl/new_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

The generated GitHub Actions workflow now indents the pull_request_target branch filter correctly. The filter still targets main. A test walks the generated directory and checks that each YAML file can be unmarshaled. A change note states that the generated workflow previously failed to parse and was rejected by GitHub.

Possibly related issues

  • Issue 56477 — The change corrects indentation in the fleetctl new workflow and adds YAML parsing coverage.
  • Issue 56478 — The change fixes invalid workflow YAML in the generated repository scaffold.

Priority: ➖ Normal

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 04e72

The generated workflow has the corrected YAML indentation, with a test for generated YAML syntax. No issue identified here prevents merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: fixing invalid YAML in the fleetctl new GitHub workflow template.
Description check Passed The description explains the bug, fix, affected versions, testing, manual QA, changes file, and AI usage. It is complete for this non-UI template change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.56%. Comparing base (b2b73f1) to head (04e724f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #56479      +/-   ##
==========================================
- Coverage   77.56%   77.56%   -0.01%     
==========================================
  Files        4377     4377              
  Lines      272003   272003              
  Branches    16052    16052              
==========================================
- Hits       210971   210968       -3     
- Misses      60846    60849       +3     
  Partials      186      186              
Flag Coverage Δ
backend 78.76% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lucasmrod
lucasmrod merged commit 7d5f07e into main Oct 26, 2026
48 checks passed
@lucasmrod
lucasmrod deleted the tux234-fix-fleetctl-new-workflow-yaml branch October 26, 2026 09:03
lucasmrod added a commit that referenced this pull request Oct 27, 2026
…w template (#56685)

Cherry-pick of #56479 into the RC branch.

Co-authored-by: Mitch Francese <2227948+tux234@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Docker Hub — 04e724fc Deployed Oct 23, 2026 by tux234 via publish #110670
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants