diff --git a/pipelines/package_names.go b/pipelines/package_names.go index 7c04666c..d46ad7be 100644 --- a/pipelines/package_names.go +++ b/pipelines/package_names.go @@ -51,7 +51,8 @@ func TarFilename(opts TarFileOpts) string { arch = strings.Join([]string{arch, archv}, "-") } - p := []string{name, opts.Version, opts.BuildID, os, arch} + versionTrimmed := strings.TrimSuffix(opts.Version, "-pre") + p := []string{name, versionTrimmed, opts.BuildID, os, arch} return fmt.Sprintf("%s.tar.gz", strings.Join(p, "_")) } diff --git a/pipelines/package_names_test.go b/pipelines/package_names_test.go index 0bb05ea3..a5648d05 100644 --- a/pipelines/package_names_test.go +++ b/pipelines/package_names_test.go @@ -58,6 +58,20 @@ func TestTarFilename(t *testing.T) { t.Errorf("name '%s' does not match expected name '%s'", name, expected) } }) + t.Run("It should use the correct name if Enterprise is false", func(t *testing.T) { + distro := executil.Distribution("plan9/amd64") + opts := pipelines.TarFileOpts{ + Edition: "", + Version: "v1.0.1-pre", + BuildID: "333", + Distro: distro, + } + + expected := "grafana_v1.0.1_333_plan9_amd64.tar.gz" + if name := pipelines.TarFilename(opts); name != expected { + t.Errorf("name '%s' does not match expected name '%s'", name, expected) + } + }) t.Run("It should use the correct name if Enterprise is true", func(t *testing.T) { distro := executil.Distribution("plan9/amd64") opts := pipelines.TarFileOpts{