From 608c81e58a0ab144ddbb16161be245589c3efbaa Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:40:40 -0500 Subject: [PATCH 1/2] specify remote chart version --- modules/helm/template.go | 3 +++ modules/helm/template_test.go | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/helm/template.go b/modules/helm/template.go index 9ed474938..3cd7a6949 100644 --- a/modules/helm/template.go +++ b/modules/helm/template.go @@ -110,6 +110,9 @@ func RenderRemoteTemplateE(t testing.TestingT, options *Options, chartURL string // ... and add the helm chart name, the remote repo and chart URL at the end args = append(args, releaseName, "--repo", chartURL) + if options.Version != "" { + args = append(args, "--version", options.Version) + } // Finally, call out to helm template command return RunHelmCommandAndGetStdOutE(t, options, "template", args...) diff --git a/modules/helm/template_test.go b/modules/helm/template_test.go index 97ed8478e..edeaaad2b 100644 --- a/modules/helm/template_test.go +++ b/modules/helm/template_test.go @@ -27,6 +27,7 @@ func TestRemoteChartRender(t *testing.T) { remoteChartSource = "https://charts.bitnami.com/bitnami" remoteChartName = "nginx" remoteChartVersion = "13.2.24" + registry = "registry-1.docker.io" ) t.Parallel() @@ -42,11 +43,12 @@ func TestRemoteChartRender(t *testing.T) { options := &Options{ SetValues: map[string]string{ "image.repository": remoteChartName, - "image.registry": "", + "image.registry": registry, "image.tag": remoteChartVersion, }, KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), Logger: logger.Discard, + Version: remoteChartVersion, } // Run RenderTemplate to render the template and capture the output. Note that we use the version without `E`, since @@ -62,10 +64,10 @@ func TestRemoteChartRender(t *testing.T) { require.Equal(t, namespaceName, deployment.Namespace) // Finally, we verify the deployment pod template spec is set to the expected container image value - expectedContainerImage := remoteChartName + ":" + remoteChartVersion + expectedContainerImage := registry + "/" + remoteChartName + ":" + remoteChartVersion deploymentContainers := deployment.Spec.Template.Spec.Containers require.Equal(t, len(deploymentContainers), 1) - require.Equal(t, deploymentContainers[0].Image, expectedContainerImage) + require.Equal(t, expectedContainerImage, deploymentContainers[0].Image) } // Test that we can dump all the manifest locally a remote chart (e.g bitnami/nginx) @@ -81,15 +83,15 @@ func TestRemoteChartRenderDiff(t *testing.T) { initialSnapshot := t.TempDir() updatedSnapshot := t.TempDir() - renderChartDump(t, "5.0.0", initialSnapshot) - output := renderChartDump(t, "5.1.0", updatedSnapshot) + renderChartDump(t, "13.2.20", initialSnapshot) + output := renderChartDump(t, "13.2.24", updatedSnapshot) options := &Options{ Logger: logger.Default, SnapshotPath: initialSnapshot, } // diff in: spec.initContainers.preserve-logs-symlinks.imag, spec.containers.nginx.image, tls certificates - require.Equal(t, 5, DiffAgainstSnapshot(t, options, output, "nginx")) + require.Equal(t, 4, DiffAgainstSnapshot(t, options, output, "nginx")) } // render chart dump and return the rendered output @@ -111,6 +113,7 @@ func renderChartDump(t *testing.T, remoteChartVersion, snapshotDir string) strin }, KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName), Logger: logger.Discard, + Version: remoteChartVersion, } // Run RenderTemplate to render the template and capture the output. Note that we use the version without `E`, since From aa1ddcd12275b77028c8bef9d8276bb380623907 Mon Sep 17 00:00:00 2001 From: Yousif Akbar <11247449+yhakbar@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:20:22 -0500 Subject: [PATCH 2/2] feat: Adding release instructions in PR --- .github/pull_request_template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6b100e40e..cebc6ff96 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -14,6 +14,7 @@ Read the [Gruntwork contribution guidelines](https://gruntwork.notion.site/Grunt - [ ] Run the relevant tests successfully, including pre-commit checks. - [ ] Ensure any 3rd party code adheres with our [license policy](https://www.notion.so/gruntwork/Gruntwork-licenses-and-open-source-usage-policy-f7dece1f780341c7b69c1763f22b1378) or delete this line if its not applicable. - [ ] Include release notes. If this PR is backward incompatible, include a migration guide. +- [ ] Make a plan for release of the functionality in this PR. If it delivers value to an end user, you are responsible for ensuring it is released promptly, and correctly. If you are not a maintainer, you are responsible for finding a maintainer to do this for you. ## Release Notes (draft)