fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.02k stars 420 forks source link

Inconsistent path resolution for scripts between normal teams and no-team in GitOps #22555

Open iansltx opened 1 week ago

iansltx commented 1 week ago

Fleet version: 4.57.0 (likely more)

💥  Actual behavior

Relative paths are inconsistent between "no team" scripts and scripts on teams; "no team" is relative to the GitOps root, while other teams' paths are specified relative to the directory the team files are in.

So, for identically located scripts, you have to specify:

controls:
  scripts:
    - path: ./lib/remove-zoom-artifacts.script.sh
    - path: ./lib/set-timezone.script.sh

for no-team.yml, but

controls:
  scripts:
    - path: ../lib/remove-zoom-artifacts.script.sh
    - path: ../lib/set-timezone.script.sh

for other teams.

🧑‍💻  Steps to reproduce

  1. Clone GitOps
  2. Copy-paste the controls section from teams/workstations.yml to teams/no-team.yml
  3. Run gitops.sh against a Fleet server to apply changes

🕯️ More info

99.99% sure this is a fleetctl bug.

@noahtalerman Fixing this is technically a BC break but I'm assuming that, as with #22187, we should go ahead and do it?

🛠️ To fix

Ensure no-team.yml paths are relative to where the file is, rather than the GitOps root.

iansltx commented 1 day ago

Test plan (all GitOps) /cc @xpkoala

(sorry :( )