Fix flux migrate -f not considering kind comments

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
(cherry picked from commit 7c5fb2297c)
pull/5564/head
Matheus Pimenta 1 week ago committed by github-actions[bot]
parent 8d0001f5b6
commit b398208c7e

@ -623,7 +623,8 @@ func (f *FileSystemMigrator) detectFileUpgrades(file string) ([]APIUpgrade, erro
if idx == -1 {
continue
}
kind := strings.TrimSpace(kindLine[idx+len(kindPrefix):])
kindValuePrefix := strings.TrimSpace(kindLine[idx+len(kindPrefix):])
kind := strings.Split(kindValuePrefix, " ")[0]
// Build GroupKind.
gk := schema.GroupKind{

@ -153,7 +153,7 @@ func TestFileSystemMigrator(t *testing.T) {
for _, wf := range tt.writtenFiles {
b, err := os.ReadFile(wf.goldenFile)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(fileSystem.writtenFiles[wf.file]).To(Equal(b),
g.Expect(string(fileSystem.writtenFiles[wf.file])).To(Equal(string(b)),
"file %s does not match golden file %s", wf.file, wf.goldenFile)
}
})

@ -12,7 +12,7 @@ spec:
wait: true
dependsOn:
- apiVersion: image.toolkit.fluxcd.io/v1 # update this from v1beta1
kind: ImageRepository
kind: ImageRepository # there can be comments here too
---

@ -12,7 +12,7 @@ spec:
wait: true
dependsOn:
- apiVersion: image.toolkit.fluxcd.io/v1beta1 # update this from v1beta1
kind: ImageRepository
kind: ImageRepository # there can be comments here too
---

Loading…
Cancel
Save