Repository: replicatedhq/ship (go)

Issue:
Template function ShipCustomerRelease in config map produces error data too long
### Expected behavior

I should be able to follow this guide for a titled installation https://help.replicated.com/docs/ship/playbooks/entitlements/

### Actual behavior

When i try to deploy the release yaml I get the following error:

```
The ConfigMap "titled" is invalid: metadata.annotations: Too long: must have at most 262144 characters
```

### Information

- Ship version: 0.51.0
- Command line run: ship init replicated.app/myslug


Pull request description:
remove unneeded fields from ShipCustomerRelease template func
What I Did
------------
remove unneeded fields from `ShipCustomerRelease` template func
also add `ShipCustomerReleaseFull` for if someone actually needed those
fix #1064 

How I Did it
------------


How to verify it
------------


Description for the Changelog
------------



Picture of a Ship (not required but encouraged)
------------

![USS Enterprise (CVN-65)](https://upload.wikimedia.org/wikipedia/commons/a/af/USS_Enterprise_%28CVN-65%29.jpg "USS Enterprise (CVN-65)")










<!-- (thanks https://github.com/docker/docker for this template) -->



Patch:
diff --git a/pkg/templates/installation_context.go b/pkg/templates/installation_context.go
index 1bb92018..6c1158e8 100644
--- a/pkg/templates/installation_context.go
+++ b/pkg/templates/installation_context.go
@@ -35,6 +35,22 @@ func (ctx *InstallationContext) entitlementValue(name string) string {
 }
 
 func (ctx *InstallationContext) shipCustomerRelease() string {
+	restrictedMeta := ctx.Meta
+	restrictedMeta.ConfigSpec = ""
+	restrictedMeta.CollectSpec = ""
+	restrictedMeta.AnalyzeSpec = ""
+	restrictedMeta.GithubContents = nil
+	restrictedMeta.Images = nil
+
+	data, err := util.MarshalIndent(2, restrictedMeta)
+	if err != nil {
+		level.Error(ctx.Logger).Log("msg", "unable to marshal release meta", "err", err)
+		return ""
+	}
+	return string(data)
+}
+
+func (ctx *InstallationContext) shipCustomerReleaseFull() string {
 	data, err := util.MarshalIndent(2, ctx.Meta)
 	if err != nil {
 		level.Error(ctx.Logger).Log("msg", "unable to marshal release meta", "err", err)
@@ -43,6 +59,10 @@ func (ctx *InstallationContext) shipCustomerRelease() string {
 	return string(data)
 }
 
+func (ctx *InstallationContext) configSpec() string {
+	return ctx.Meta.ConfigSpec
+}
+
 func (ctx *InstallationContext) collectSpec() string {
 	return ctx.Meta.CollectSpec
 }
@@ -53,11 +73,13 @@ func (ctx *InstallationContext) analyzeSpec() string {
 
 func (ctx *InstallationContext) FuncMap() template.FuncMap {
 	return template.FuncMap{
-		"ShipCustomerRelease": ctx.shipCustomerRelease,
-		"EntitlementValue":    ctx.entitlementValue,
-		"LicenseFieldValue":   ctx.entitlementValue,
-		"CollectSpec":         ctx.collectSpec,
-		"AnalyzeSpec":         ctx.analyzeSpec,
+		"ShipCustomerRelease":     ctx.shipCustomerRelease,
+		"ShipCustomerReleaseFull": ctx.shipCustomerReleaseFull,
+		"EntitlementValue":        ctx.entitlementValue,
+		"LicenseFieldValue":       ctx.entitlementValue,
+		"ConfigSpec":              ctx.configSpec,
+		"CollectSpec":             ctx.collectSpec,
+		"AnalyzeSpec":             ctx.analyzeSpec,
 		"Installation": func(name string) string {
 			switch name {
 			case "state_file_path":


Test patch:
diff --git a/pkg/templates/installation_context_test.go b/pkg/templates/installation_context_test.go
index d2fff66a..2bcd1d14 100644
--- a/pkg/templates/installation_context_test.go
+++ b/pkg/templates/installation_context_test.go
@@ -217,6 +217,165 @@ func testCases() []TestInstallation {
   v1:
     - {}`,
 		},
+		{
+			Name: "ship customer release",
+			Meta: api.ReleaseMetadata{
+				AnalyzeSpec: `this is not an analyze spec`,
+				ConfigSpec:  ``,
+				CollectSpec: ``,
+				GithubContents: []api.GithubContent{{
+					Repo: "abc",
+					Path: "xyz",
+					Ref:  "test",
+					Files: []api.GithubFile{{
+						Name: "abc",
+						Path: "xyz",
+						Sha:  "123",
+						Size: 456,
+						Data: "789",
+					}},
+				}},
+				Images: []api.Image{{
+					URL:      "abc",
+					Source:   "xyz",
+					AppSlug:  "123",
+					ImageKey: "456",
+				}},
+				LicenseID: "myLicenseID",
+			},
+			Tpl: `{{repl ShipCustomerRelease }}`,
+			Expected: `releaseId: ""
+sequence: 0
+customerId: ""
+installation: ""
+channelId: ""
+appSlug: ""
+licenseId: myLicenseID
+channelName: ""
+channelIcon: ""
+semver: ""
+releaseNotes: ""
+created: ""
+installed: ""
+registrySecret: ""
+images: []
+githubContents: []
+shipAppMetadata:
+  description: ""
+  version: ""
+  icon: ""
+  name: ""
+  readme: ""
+  url: ""
+  contentSHA: ""
+  releaseNotes: ""
+entitlements:
+  meta:
+    lastupdated: 0001-01-01T00:00:00Z
+    customerid: ""
+  serialized: ""
+  signature: ""
+  values: []
+  utilizations: []
+entitlementSpec: ""
+configSpec: ""
+collectSpec: ""
+analyzeSpec: ""
+type: ""
+license:
+  id: ""
+  assignee: ""
+  createdAt: 0001-01-01T00:00:00Z
+  expiresAt: 0001-01-01T00:00:00Z
+  type: ""
+`,
+		},
+		{
+			Name: "ship customer release full",
+			Meta: api.ReleaseMetadata{
+				AnalyzeSpec: `this is not an analyze spec`,
+				ConfigSpec:  `this is not a config spec`,
+				CollectSpec: `this is not a collect spec`,
+				GithubContents: []api.GithubContent{{
+					Repo: "abc",
+					Path: "xyz",
+					Ref:  "test",
+					Files: []api.GithubFile{{
+						Name: "abc",
+						Path: "xyz",
+						Sha:  "123",
+						Size: 456,
+						Data: "789",
+					}},
+				}},
+				Images: []api.Image{{
+					URL:      "abc",
+					Source:   "xyz",
+					AppSlug:  "123",
+					ImageKey: "456",
+				}},
+				LicenseID: "myLicenseID",
+			},
+			Tpl: `{{repl ShipCustomerReleaseFull }}`,
+			Expected: `releaseId: ""
+sequence: 0
+customerId: ""
+installation: ""
+channelId: ""
+appSlug: ""
+licenseId: myLicenseID
+channelName: ""
+channelIcon: ""
+semver: ""
+releaseNotes: ""
+created: ""
+installed: ""
+registrySecret: ""
+images:
+- url: abc
+  source: xyz
+  appSlug: "123"
+  imageKey: "456"
+githubContents:
+- repo: abc
+  path: xyz
+  ref: test
+  files:
+  - name: abc
+    path: xyz
+    sha: "123"
+    size: 456
+    data: "789"
+shipAppMetadata:
+  description: ""
+  version: ""
+  icon: ""
+  name: ""
+  readme: ""
+  url: ""
+  contentSHA: ""
+  releaseNotes: ""
+entitlements:
+  meta:
+    lastupdated: 0001-01-01T00:00:00Z
+    customerid: ""
+  serialized: ""
+  signature: ""
+  values: []
+  utilizations: []
+entitlementSpec: ""
+configSpec: this is not a config spec
+collectSpec: this is not a collect spec
+analyzeSpec: this is not an analyze spec
+type: ""
+license:
+  id: ""
+  assignee: ""
+  createdAt: 0001-01-01T00:00:00Z
+  expiresAt: 0001-01-01T00:00:00Z
+  type: ""
+`,
+		},
 	}
 	return tests
 }