From 08c6c2097f508be9d876696893f9a6b3ec6010ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Tue, 19 Oct 2021 11:29:52 +0200 Subject: [PATCH] Revert "[elastic-agent] Fix docker tar.gz generation for complete image (#27621)" This reverts commit 89e415d049772424ca078e830d3f7565c6c0129e. --- dev-tools/mage/dockerbuilder.go | 7 +++---- dev-tools/mage/pkgtypes.go | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dev-tools/mage/dockerbuilder.go b/dev-tools/mage/dockerbuilder.go index c1027e94837..0fba00b4e26 100644 --- a/dev-tools/mage/dockerbuilder.go +++ b/dev-tools/mage/dockerbuilder.go @@ -86,7 +86,7 @@ func (b *dockerBuilder) Build() error { return errors.Wrap(err, "failed to build docker") } - if err := b.dockerSave(tag, variant); err != nil { + if err := b.dockerSave(tag); err != nil { return errors.Wrap(err, "failed to save docker as artifact") } } @@ -209,7 +209,7 @@ func (b *dockerBuilder) dockerBuild(variant string) (string, error) { return taggedImageName, sh.Run("docker", "build", "-t", taggedImageName, b.buildDir) } -func (b *dockerBuilder) dockerSave(tag string, variant string) error { +func (b *dockerBuilder) dockerSave(tag string) error { if _, err := os.Stat(distributionsDir); os.IsNotExist(err) { err := os.MkdirAll(distributionsDir, 0750) if err != nil { @@ -220,8 +220,7 @@ func (b *dockerBuilder) dockerSave(tag string, variant string) error { outputFile := b.OutputFile if outputFile == "" { outputTar, err := b.Expand(defaultBinaryName+".docker.tar.gz", map[string]interface{}{ - "Name": b.imageName, - "Variant": variant, + "Name": b.imageName, }) if err != nil { return err diff --git a/dev-tools/mage/pkgtypes.go b/dev-tools/mage/pkgtypes.go index 3a011131501..9a8ebc6d2ad 100644 --- a/dev-tools/mage/pkgtypes.go +++ b/dev-tools/mage/pkgtypes.go @@ -48,7 +48,7 @@ const ( packageStagingDir = "build/package" // defaultBinaryName specifies the output file for zip and tar.gz. - defaultBinaryName = "{{.Name}}-{{if .Variant}}{{.Variant}}-{{end}}{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}{{if .OS}}-{{.OS}}{{end}}{{if .Arch}}-{{.Arch}}{{end}}" + defaultBinaryName = "{{.Name}}-{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}{{if .OS}}-{{.OS}}{{end}}{{if .Arch}}-{{.Arch}}{{end}}" ) // PackageType defines the file format of the package (e.g. zip, rpm, etc). @@ -329,10 +329,8 @@ func (s *PackageSpec) ExtraVar(key, value string) { // Expand expands a templated string using data from the spec. func (s PackageSpec) Expand(in string, args ...map[string]interface{}) (string, error) { - // Assign a default value for variant since it's not always passed in return expandTemplate("inline", in, FuncMap, - - EnvMap(append([]map[string]interface{}{s.evalContext, {"Variant": ""}, s.toMap()}, args...)...)) + EnvMap(append([]map[string]interface{}{s.evalContext, s.toMap()}, args...)...)) } // MustExpand expands a templated string using data from the spec. It panics if