| .. | ||
| ansi | ||
| limit | ||
| log | ||
| testdata | ||
| args.go | ||
| backup.go | ||
| backup_restore_test.go | ||
| cmd.go | ||
| cmd_backup.go | ||
| cmd_format.go | ||
| cmd_migrate.go | ||
| cmd_migrate_test.go | ||
| cmd_restore.go | ||
| cmd_usage.go | ||
| fs.go | ||
| main.go | ||
| main_test.go | ||
| README.md | ||
| restore.go | ||
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
- 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) |
-
Rename the file
gitops-migratewith no extension. -
Move the file to the root of your Fleet GitOps directory. For example, the root of our GitOps directory is /it-and-security.
-
Open terminal and navigate to your Fleet GitOps directory.
-
Make the binary file executable. For example, on Linux and macOS use
chmod +x gitops-migrate. -
Verify the installation was successful by running
./gitops-migrate usagewhich 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
- Run
./gitops-migrate format ./. - Commit the resulting changes to your repo.
Step 2: Migrate
- 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]
- 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"