diff --git a/artifacts/package_docker.go b/artifacts/package_docker.go index c3df6922..d9e06e23 100644 --- a/artifacts/package_docker.go +++ b/artifacts/package_docker.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log/slog" + "strings" "dagger.io/dagger" "github.com/grafana/grafana-build/arguments" @@ -78,9 +79,13 @@ func (d *Docker) Builder(ctx context.Context, opts *pipeline.ArtifactContainerOp } func (d *Docker) BuildFile(ctx context.Context, builder *dagger.Container, opts *pipeline.ArtifactContainerOpts) (*dagger.File, error) { + // Unlike most other things we push to, docker image tags do not support all characters. + // Specifically, the `+` character used in the `buildmetadata` section of semver. + version := strings.ReplaceAll(d.Version, "+", "-") + tags, err := docker.Tags(d.Org, d.Registry, d.Repositories, d.TagFormat, packages.NameOpts{ Name: d.Name, - Version: d.Version, + Version: version, BuildID: d.BuildID, Distro: d.Distro, }) diff --git a/packages/artifact_name.go b/packages/artifact_name.go deleted file mode 100644 index e893b044..00000000 --- a/packages/artifact_name.go +++ /dev/null @@ -1,34 +0,0 @@ -package packages - -// func ArtifactFilename(ctx context.Context, a pipeline.Artifact, h pipeline.StateHandler, ext string) (string, error) { -// name, err := a.Option(flags.PackageName) -// if err != nil { -// return "", err -// } -// -// distro, err := a.Option(flags.PackageDistribution) -// if err != nil { -// return "", err -// } -// -// buildID, err := h.String(ctx, arguments.BuildID) -// if err != nil { -// return "", err -// } -// -// version, err := h.String(ctx, arguments.Version) -// if err != nil { -// return "", err -// } -// -// opts := NameOpts{ -// // Name is the name of the product in the package. 99% of the time, this will be "grafana" or "grafana-enterprise". -// Name: name, -// Version: version, -// BuildID: buildID, -// Distro: executil.Distribution(distro), -// Extension: ext, -// } -// -// return FileName(opts) -// }