From 04faba95cdf4744874efa1cf0ec48496f60db0a1 Mon Sep 17 00:00:00 2001
From: Stefan Prodan <stefan.prodan@gmail.com>
Date: Thu, 4 Nov 2021 14:59:40 +0200
Subject: [PATCH] Add DO NOT EDIT warn to bootstrap sync manifests

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
---
 pkg/manifestgen/manifest.go  | 2 ++
 pkg/manifestgen/sync/sync.go | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/pkg/manifestgen/manifest.go b/pkg/manifestgen/manifest.go
index 9509e0b1..693b22eb 100644
--- a/pkg/manifestgen/manifest.go
+++ b/pkg/manifestgen/manifest.go
@@ -24,6 +24,8 @@ import (
 	securejoin "github.com/cyphar/filepath-securejoin"
 )
 
+const GenWarning = "# This manifest was generated by flux bootstrap. DO NOT EDIT."
+
 // Manifest holds the data of a multi-doc YAML
 type Manifest struct {
 	// Relative path to the YAML file
diff --git a/pkg/manifestgen/sync/sync.go b/pkg/manifestgen/sync/sync.go
index ddddbf89..757d6bef 100644
--- a/pkg/manifestgen/sync/sync.go
+++ b/pkg/manifestgen/sync/sync.go
@@ -107,7 +107,7 @@ func Generate(options Options) (*manifestgen.Manifest, error) {
 
 	return &manifestgen.Manifest{
 		Path:    path.Join(options.TargetPath, options.Namespace, options.ManifestFile),
-		Content: fmt.Sprintf("---\n%s---\n%s", resourceToString(gitData), resourceToString(ksData)),
+		Content: fmt.Sprintf("%s\n---\n%s---\n%s", manifestgen.GenWarning, resourceToString(gitData), resourceToString(ksData)),
 	}, nil
 }
 
-- 
GitLab