fleet icon indicating copy to clipboard operation
fleet copied to clipboard

GitOps: Relative path fails when adding custom setup profile to unassigned.yml

Open rynsatterlee opened this issue 6 months ago • 3 comments

Fleet versions

  • Discovered: v4.85.0
  • Reproduced: v4.85.O

💥  Actual behavior

When adding a custom DEP profile to unassigned.yml, the GitOps action fails with the following error:

Error: applying fleet config: open ../lib/macos/enrollment-profiles/automatic-enrollment.dep.json: no such file or directory

Confirmed that the file path is correct, this is the structure of the relevant portions of the repo:

lib
    | default.yml
    | macos
        |  enrollment-profiles
               | automatic-enrollment.dep.json
fleets
    | unassigned.yml
    | workstations.yml

default.yml

unassigned.yaml:

name: Unassigned
policies:
queries:
agent_options:
  path: ../lib/agent-options.yml
controls:
  setup_experience:
    apple_setup_assistant: ../lib/macos/enrollment-profiles/automatic-enrollment.dep.json
software:

workstations.yml:

name: Workstations
policies:
queries:
agent_options:
  path: ../lib/agent-options.yml
controls:
  setup_experience:
    apple_setup_assistant: ../lib/macos/enrollment-profiles/automatic-enrollment.dep.json
team_settings:
  secrets:
    - secret: "$FLEET_WORKSTATIONS_ENROLL_SECRET"
software:

When controls.setup_experience.apple_setup_assistant is removed from unassigned.yml, the GitOps action completes successfully and the profile is applied to the Workstations team.

Updating the path defined in unassigned.yml to be relative to the root directory also succeeds, and the profile is applied to Unassigned as well as to Workstations:

name: Unassigned
policies:
queries:
agent_options:
  path: ../lib/agent-options.yml
controls:
  setup_experience:
    apple_setup_assistant: ./lib/macos/enrollment-profiles/automatic-enrollment.dep.json
software:

🛠️ Expected behavior

All relative paths defined in usassigned.yml should resolve from the fleets folder(or otherwise, the folder the file is actually in) rather than from the root of the repository.

🧑‍💻  Steps to reproduce

These steps:

  • [ x] Have been confirmed to consistently lead to reproduction in multiple Fleet instances.
  • [ ] Describe the workflow that led to the error, but have not yet been reproduced in multiple Fleet instances.
  1. Create a GitOps setup using the details listed above
  2. Run the GitOps action

🕯️ More info (optional)

N/A

rynsatterlee avatar May 15 '26 22:05 rynsatterlee

I've tested and confirmed that this same behavior is also impacting path references to organization logos (specifically reproduced the behavior on org_logo_path_dark_mode and org_logo_path_light_mode).

Customer thread: https://fleetdm.slack.com/archives/C09QZ73USMB/p1780438500101809?thread_ts=1780322205.782759&cid=C09QZ73USMB

mason-buettner avatar Jun 02 '26 22:06 mason-buettner

Reproduction (4.85.1)

  • Relative controls.setup_experience.apple_setup_assistant: ../lib/... in unassigned.yml fails with the exact reported error: Error: applying fleet config: open ../lib/macos/enrollment-profiles/automatic-enrollment.dep.json: no such file or directory
  • The documented workaround (./lib/...) succeeds, and removing the key succeeds

Verified fix - relative paths resolve from the authoring file

  • ../lib/... in unassigned.yml resolves from the file's own directory (fleets/) and applies cleanly, as the issue requested

  • Confirmed it re-anchors rather than suppresses: pointing at a genuinely missing file still fails, and the error path is now resolved under the no-team file's dir (.../gitops/lib/...), not the repo root

  • Deprecated no-team.yml name resolves correctly.

    • Applying org_settings relative to the nested file successful (pulled in via path:). Tested EULA upload: mdm.end_user_license_agreement: ./eula.pdf.
  • macos_setup paths in unassigned.yml (setup_experience.script) resolve.

  • No double-anchoring: parse-time paths (controls.scripts, *_settings profiles) still resolve when combined with the now-absolute apply-time paths in the same file

chrstphr84 avatar Jun 26 '26 18:06 chrstphr84

Path's relative journey, Fleet unites, no file lost, Clouds clear, work's not tossed.

fleet-release avatar Jul 15 '26 18:07 fleet-release