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

Cherry-pick #56479: Fix invalid YAML in fleetctl new GitHub workflow template - #56685

Merged
lucasmrod merged 1 commit into
rc-minor-fleet-v4.94.0from
lucasmrod/fix-fleetctl-new-workflow-yaml-cp
Oct 27, 2026
Merged

lucasmrod merged 1 commit into
rc-minor-fleet-v4.94.0from
lucasmrod/fix-fleetctl-new-workflow-yaml-cp

Conversation

@lucasmrod

Copy link
Copy Markdown
Member

Cherry-pick of #56479 into the RC branch.

**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

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [x] 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
```

- [x] 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:

- [x] 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.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@lucasmrod
lucasmrod merged commit 77edc75 into rc-minor-fleet-v4.94.0 Oct 27, 2026
24 of 26 checks passed
@lucasmrod
lucasmrod deleted the lucasmrod/fix-fleetctl-new-workflow-yaml-cp branch October 27, 2026 12:53
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (rc-minor-fleet-v4.94.0@2129db7). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                    @@
##             rc-minor-fleet-v4.94.0   #56685   +/-   ##
=========================================================
  Coverage                          ?   78.55%           
=========================================================
  Files                             ?     2020           
  Lines                             ?   222565           
  Branches                          ?        0           
=========================================================
  Hits                              ?   174847           
  Misses                            ?    47710           
  Partials                          ?        8           
Flag Coverage Δ
backend 78.55% <ø> (?)

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.

This branch was previously deployed

1 inactive deployment
Docker Hub — df98afda Deployed Oct 27, 2026 by lucasmrod via publish #111073
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