fleet/cmd/gitops-migrate
2025-09-19 10:30:51 -05:00
..
ansi Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
limit Try more aggressive timeout on limiter test (#32854) 2025-09-11 09:54:32 -05:00
log Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
testdata Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
args.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
backup.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
backup_restore_test.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd_backup.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd_format.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd_migrate.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd_migrate_test.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd_restore.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
cmd_usage.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
fs.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
main.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
main_test.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00
README.md Revise README.md for installation and migration clarity (#33162) 2025-09-19 10:30:51 -05:00
restore.go Feat: GitOps YAML Migration Tool (#32237) 2025-09-08 12:42:25 -04:00

Overview

This directory contains the gitops-migrate tool, designed leading up to the 4.74 Fleet release to automate necessary GitOps YAML transformations.

4.74 YAML Changes

The 4.74 release moves GitOps YAML keys: self_service, categories, labels_exclude_any, and labels_include_any from the software files (example) to the team files (example).

Installation

Download the Binary

  1. Download the appropriate binary for your operating system and architecture:
Operating System Architecture Download Link
macos arm64 Download(Hash)
macos amd64 Download(Hash)
windows amd64 Download(Hash)
windows arm64 Download(Hash)
linux amd64 Download(Hash)
linux arm64 Download(Hash)
  1. Rename the file gitops-migrate with no extension.

  2. Move the file to the root of your Fleet GitOps directory. For example, the root of our GitOps directory is /it-and-security.

  3. Open terminal and navigate to your Fleet GitOps directory.

  4. Make the binary file executable. For example, on Linux and macOS use chmod +x gitops-migrate.

  5. Verify the installation was successful by running ./gitops-migrate usage which should display the help text.

Running the migration

When manipulating YAML files with this tool, the output will always alphabetize the keys and remove all comments.

The migration will unfold in two primary steps: format and migrate.

Step 1: Format

  1. Run ./gitops-migrate format ./.
  2. Commit the resulting changes to your repo.

Step 2: Migrate

  1. Run ./gitops-migrate migrate ./.

In the command output, you should see messages like the following:

> Successfully applied transforms to team file.
┣━ [Team File]=>[it-and-security/teams/workstations.yml]
┗━ [Count]=>[39]
  1. Commit the resulting changes to your repo.

Confirm

In cases where the team file previously contained software packages which referenced software files containing the fields described above, you can spot-check the results by confirming these fields are now present in the software packages array items, right alongside the path key(s).

When looking at a git diff you should see changes similar to the following:

Software file (./slack.yml):

url: https://downloads.slack-edge.com/desktop-releases/linux/x64/4.41.105/slack-desktop-4.41.105-amd64.deb
- self_service: true
- categories:
-  - Productivity
-  - Communication
- labels_include_any:
-  - "Debian-based Linux hosts"

Team File (./my_team.yml):

software:
  packages:
    - path: slack.yml
+     self_service: true
+     categories:
+       - Productivity
+       - Communication
+     labels_include_any:
+       - "Debian-based Linux hosts"