From 21754c9496763929d8d2e499e3a74946c2006a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 26 Aug 2021 14:14:07 +0200 Subject: [PATCH 1/7] fix: generate complete variant binaries properly --- dev-tools/packaging/packages.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index e3f45990424..703eca37efb 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -449,6 +449,10 @@ shared: from: 'arm64v8/centos:7' buildFrom: 'arm64v8/centos:7' + - &agent_docker_complete_spec + extra_vars: + image_name: '{{.BeatName}}-complete' + # Deb/RPM spec for community beats. - &deb_rpm_spec <<: *common @@ -1000,6 +1004,18 @@ specs: <<: *agent_docker_spec <<: *elastic_docker_spec <<: *elastic_license_for_binaries + files: + '{{.BeatName}}{{.BinaryExt}}': + source: ./build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} + + - os: linux + arch: amd64 + types: [docker] + spec: + <<: *agent_docker_spec + <<: *agent_docker_complete_spec + <<: *elastic_docker_spec + <<: *elastic_license_for_binaries # This image gets a 'complete' variant for synthetics and other large # packages too big to fit in the main image variants: ["complete"] @@ -1026,6 +1042,18 @@ specs: <<: *agent_docker_arm_spec <<: *elastic_docker_spec <<: *elastic_license_for_binaries + files: + '{{.BeatName}}{{.BinaryExt}}': + source: ./build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} + + - os: linux + arch: arm64 + types: [docker] + spec: + <<: *agent_docker_arm_spec + <<: *agent_docker_complete_spec + <<: *elastic_docker_spec + <<: *elastic_license_for_binaries # This image gets a 'complete' variant for synthetics and other large # packages too big to fit in the main image variants: ["complete"] From f69512250182493dd4c7cbdc9c9215f3a451f8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 9 Sep 2021 12:15:45 +0200 Subject: [PATCH 2/7] fix: pass agent dockerfile to complete spec --- dev-tools/packaging/packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 703eca37efb..ef8790eaf2e 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -451,6 +451,7 @@ shared: - &agent_docker_complete_spec extra_vars: + dockerfile: 'Dockerfile.elastic-agent.tmpl' image_name: '{{.BeatName}}-complete' # Deb/RPM spec for community beats. From 6a3888977a4d54f4f890780ba57c46e991bc6f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 9 Sep 2021 17:28:58 +0200 Subject: [PATCH 3/7] fix: do not append variant to the artifact name --- dev-tools/mage/dockerbuilder.go | 4 +--- dev-tools/mage/pkgtypes.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dev-tools/mage/dockerbuilder.go b/dev-tools/mage/dockerbuilder.go index c1027e94837..717d894a05a 100644 --- a/dev-tools/mage/dockerbuilder.go +++ b/dev-tools/mage/dockerbuilder.go @@ -196,9 +196,7 @@ func (b *dockerBuilder) expandDockerfile(templatesDir string, data map[string]in func (b *dockerBuilder) dockerBuild(variant string) (string, error) { imageName := b.imageName - if variant != "" { - imageName = fmt.Sprintf("%s-%s", imageName, variant) - } + taggedImageName := fmt.Sprintf("%s:%s", imageName, b.Version) if b.Snapshot { taggedImageName = taggedImageName + "-SNAPSHOT" diff --git a/dev-tools/mage/pkgtypes.go b/dev-tools/mage/pkgtypes.go index 3a011131501..e104550e3e2 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). From 2cfdc9b829f09a291a3d57cc30187c18687b13d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 9 Sep 2021 17:29:13 +0200 Subject: [PATCH 4/7] docs: update reference to complete variant --- x-pack/elastic-agent/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/elastic-agent/README.md b/x-pack/elastic-agent/README.md index 1483a206475..8d70b9b8420 100644 --- a/x-pack/elastic-agent/README.md +++ b/x-pack/elastic-agent/README.md @@ -17,6 +17,6 @@ If you are in the 7.13 branch, this will create the `docker.elastic.co/beats/ela elastic-package stack up --version=7.13.0-SNAPSHOT -v ``` -Please note that the docker container is built in both standard and 'offline' variants. -The 'offline' variant contains extra files, like the chromium browser, that are too large +Please note that the docker container is built in both standard and 'complete' variants. +The 'complete' variant contains extra files, like the chromium browser, that are too large for the standard variant. \ No newline at end of file From bbc386dd62421e0622404653d4cf72edc208401d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 9 Sep 2021 17:29:25 +0200 Subject: [PATCH 5/7] chore: reorder import --- x-pack/osquerybeat/beater/config_plugin_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/osquerybeat/beater/config_plugin_test.go b/x-pack/osquerybeat/beater/config_plugin_test.go index d38e6cc8fba..5f9c910957a 100644 --- a/x-pack/osquerybeat/beater/config_plugin_test.go +++ b/x-pack/osquerybeat/beater/config_plugin_test.go @@ -12,12 +12,11 @@ import ( "strings" "testing" - "github.com/google/go-cmp/cmp" - "github.com/elastic/beats/v7/libbeat/logp" "github.com/elastic/beats/v7/x-pack/osquerybeat/internal/config" "github.com/elastic/beats/v7/x-pack/osquerybeat/internal/ecs" "github.com/elastic/beats/v7/x-pack/osquerybeat/internal/testutil" + "github.com/google/go-cmp/cmp" ) func renderFullConfigJSON(inputs []config.InputConfig) (string, error) { From b0861220c561bd0fdcc0f036072c18446796e97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Mon, 13 Sep 2021 07:40:25 +0200 Subject: [PATCH 6/7] chore: remove unused param --- dev-tools/mage/dockerbuilder.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-tools/mage/dockerbuilder.go b/dev-tools/mage/dockerbuilder.go index 717d894a05a..37f9b2db7f6 100644 --- a/dev-tools/mage/dockerbuilder.go +++ b/dev-tools/mage/dockerbuilder.go @@ -73,13 +73,13 @@ func (b *dockerBuilder) Build() error { return errors.Wrap(err, "failed to prepare build") } - tag, err := b.dockerBuild(variant) + tag, err := b.dockerBuild() tries := 3 for err != nil && tries != 0 { fmt.Println(">> Building docker images again (after 10 s)") // This sleep is to avoid hitting the docker build issues when resources are not available. time.Sleep(time.Second * 10) - tag, err = b.dockerBuild(variant) + tag, err = b.dockerBuild() tries -= 1 } if err != nil { @@ -194,7 +194,7 @@ func (b *dockerBuilder) expandDockerfile(templatesDir string, data map[string]in return nil } -func (b *dockerBuilder) dockerBuild(variant string) (string, error) { +func (b *dockerBuilder) dockerBuild() (string, error) { imageName := b.imageName taggedImageName := fmt.Sprintf("%s:%s", imageName, b.Version) From 4e341c0f606cc7d3ca8449528adb34913cde6784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Mon, 13 Sep 2021 07:44:49 +0200 Subject: [PATCH 7/7] Revert "chore: reorder import" This reverts commit bbc386dd62421e0622404653d4cf72edc208401d. --- x-pack/osquerybeat/beater/config_plugin_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/osquerybeat/beater/config_plugin_test.go b/x-pack/osquerybeat/beater/config_plugin_test.go index 5f9c910957a..d38e6cc8fba 100644 --- a/x-pack/osquerybeat/beater/config_plugin_test.go +++ b/x-pack/osquerybeat/beater/config_plugin_test.go @@ -12,11 +12,12 @@ import ( "strings" "testing" + "github.com/google/go-cmp/cmp" + "github.com/elastic/beats/v7/libbeat/logp" "github.com/elastic/beats/v7/x-pack/osquerybeat/internal/config" "github.com/elastic/beats/v7/x-pack/osquerybeat/internal/ecs" "github.com/elastic/beats/v7/x-pack/osquerybeat/internal/testutil" - "github.com/google/go-cmp/cmp" ) func renderFullConfigJSON(inputs []config.InputConfig) (string, error) {