From 71af960f3d4b057cd32687400c3b0a67fe6451fb Mon Sep 17 00:00:00 2001 From: Dimitris Sotirakis Date: Thu, 28 Sep 2023 13:57:40 +0300 Subject: [PATCH] Tarballs: Check if version contains build ID (#187) --- containers/opts_grafana.go | 2 +- pipelines/package_names.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/containers/opts_grafana.go b/containers/opts_grafana.go index 457d1d51..0ea7ddf3 100644 --- a/containers/opts_grafana.go +++ b/containers/opts_grafana.go @@ -126,7 +126,7 @@ func (g *GrafanaOpts) DetectVersion(ctx context.Context, client *dagger.Client, return "", err } - v = strings.ReplaceAll(v, "pre", "") + v = strings.ReplaceAll(v, "pre", g.BuildID) log.Println("Got version", v) return v, nil diff --git a/pipelines/package_names.go b/pipelines/package_names.go index 7c04666c..12810d8e 100644 --- a/pipelines/package_names.go +++ b/pipelines/package_names.go @@ -51,7 +51,12 @@ func TarFilename(opts TarFileOpts) string { arch = strings.Join([]string{arch, archv}, "-") } - p := []string{name, opts.Version, opts.BuildID, os, arch} + var p []string + if strings.Contains(opts.Version, opts.BuildID) { + p = []string{name, opts.Version, os, arch} + } else { + p = []string{name, opts.Version, opts.BuildID, os, arch} + } return fmt.Sprintf("%s.tar.gz", strings.Join(p, "_")) }