fleetdm / fleet

Open device management
https://fleetdm.com
Other
5.22k stars 611 forks source link

Add MacOS_setup support to the generate-gitops flow #30210

Open AndreyKizimenko opened 2 weeks ago

AndreyKizimenko commented 2 weeks ago

https://github.com/user-attachments/assets/7648b09c-7e4d-4817-9728-7ecfbb50c84d

Problem

Running generate-gitops does not automatically pull any macos_setup settings. Using this config to then run gitops will result in all Setup Experience options resetting on the server.

What have you tried?

Configuring macos_setup within the yml file following the docs. This flow works but is reset every time I use generate-gitops

Potential solutions

macos_setup is synced similar to how other config settings are when generate-gitops is ran.

What is the expected workflow as a result of your proposal?

When I customize the setup experience for a team within a UI I can then easily sync my gitops repo with those settings and continue working with gitops.
iansltx commented 2 weeks ago

@sgress454 is there another ticket already for this? I know that per https://github.com/fleetdm/fleet/commit/d716265641cd377a9457ace8ffdaa22c24d2de90 the output files mention that values aren't filled in, so IIRC this qualifies as expected behavior, so this winds up being a feature request rather than a bug.

AndreyKizimenko commented 2 weeks ago

Talked to @sgress454 about this and what we are currently seeing is indeed expected. It is documented and warnings are added to the output. Nonetheless this is something that we want to support in the future and so I'm converting this bug into a feature request following that template. @rachaelshaw could you please take a look? I'm still new to the team and want to make sure that it has all the details and is properly routed.

sgress454 commented 1 week ago

Using this config to then run gitops will result in all Setup Experience options resetting on the server.

@AndreyKizimenko This should not be the case -- the output generated by generate-gitops for teams with mac setup experience set up should fail when attempting to apply gitops, with an error like:

Error: 1 error occurred:
    * failed to unmarshal controls: json: cannot unmarshal string into Go struct field GitOpsControls.macos_setup of type fleet.MacOSSetup

(we have a separate ticket for making error messages like this better)

If that's not the case and the output of generate-gitops is not failing gitops but is instead clearing the macos_settings on the server, then this is a bug that needs to be prioritized. I just tested it and got the expected behavior, but it's worth repeating the experiment on your system to be sure.

AndreyKizimenko commented 1 week ago

@sgress454 I just tested this on the local server on main and I'm indeed getting this error now. There is no error, though, on 4.70RC that is currently deployed on QA Render. I'm guessing it was resolved by some other work that was done on GitOps?

sgress454 commented 1 week ago

@sgress454 I just tested this on the local server on main and I'm indeed getting this error now. There is no error, though, on 4.70RC that is currently deployed on QA Render. I'm guessing it was resolved by some other work that was done on GitOps?

Not that I know of, we should always have that error. The macos_settings config can't be a string. I'll look at the RC.

sgress454 commented 1 week ago

Hm I still see the error using 4.70 versions of fleetctl and fleet server. I also tested with the server on main and fleetctl on 4.70, and vice versa. Want to shoot me the .yml you're testing with?