From 58123266acb5cbec45b2782a20adefbd99ecf1f4 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Thu, 11 Nov 2021 19:32:02 +0100 Subject: [PATCH 1/8] package java-attacher alongside apm-server --- Makefile | 10 +++++++++- magefile.go | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 229197769d1..e9a914420f1 100644 --- a/Makefile +++ b/Makefile @@ -260,7 +260,15 @@ release-manager-snapshot: release .PHONY: release-manager-release release-manager-release: release +JAVA_ATTACHER_VERSION:=1.26.0 +JAVA_ATTACHER_JAR:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION).jar +JAVA_ATTACHER_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR) + +build/$(JAVA_ATTACHER_JAR): + curl -sSL $(JAVA_ATTACHER_URL) > $@ + cp $@ build/java-attacher.jar + .PHONY: release release: export PATH:=$(dir $(BIN_MAGE)):$(PATH) -release: $(MAGE) +release: $(MAGE) build/$(JAVA_ATTACHER_JAR) $(MAGE) package diff --git a/magefile.go b/magefile.go index f5550102e81..a7f0555ffbc 100644 --- a/magefile.go +++ b/magefile.go @@ -339,6 +339,7 @@ func customizePackaging() { ) for idx := len(mage.Packages) - 1; idx >= 0; idx-- { args := &mage.Packages[idx] + args.Spec.Files["java-attacher.jar"] = mage.PackageFile{Mode: 0750, Source: "build/java-attacher.jar", Owner: mage.BeatUser} switch pkgType := args.Types[0]; pkgType { case mage.Zip, mage.TarGz: From 1da4821c97e3b3450e091595c9f970d47e71a593 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Thu, 11 Nov 2021 19:44:03 +0100 Subject: [PATCH 2/8] update changelog --- changelogs/head.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/changelogs/head.asciidoc b/changelogs/head.asciidoc index b92bbd0d6a8..2c9e4d55370 100644 --- a/changelogs/head.asciidoc +++ b/changelogs/head.asciidoc @@ -61,6 +61,7 @@ https://github.com/elastic/apm-server/compare/7.15\...master[View commits] - Added support for gzip compression to the experimental Elasticsearch output {pull}6449[6449] - Introduced a delete phase for all data streams. Traces, errors and logs are kept for 10 days, metrics are kept for 90 days {pull}6480[6480] - Changed RUM traces to use a dedicated data stream (`traces-apm.rum`). RUM traces are kept for 90 days {pull}6480[6480] +- `apm-server` artifacts now have the apm java-attacher.jar pacakaged alongside them {pull}6593[6593] [float] ==== Deprecated From 35d10e89099178fadc768bf419bb85911ca1d545 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Thu, 11 Nov 2021 19:59:16 +0100 Subject: [PATCH 3/8] update magefile for .deb/.rpm --- magefile.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magefile.go b/magefile.go index a7f0555ffbc..1e650bcc187 100644 --- a/magefile.go +++ b/magefile.go @@ -339,7 +339,6 @@ func customizePackaging() { ) for idx := len(mage.Packages) - 1; idx >= 0; idx-- { args := &mage.Packages[idx] - args.Spec.Files["java-attacher.jar"] = mage.PackageFile{Mode: 0750, Source: "build/java-attacher.jar", Owner: mage.BeatUser} switch pkgType := args.Types[0]; pkgType { case mage.Zip, mage.TarGz: @@ -349,6 +348,7 @@ func customizePackaging() { // Replace the README.md with an APM specific file. args.Spec.ReplaceFile("README.md", readmeTemplate) args.Spec.Files[ingestTarget] = ingest + args.Spec.Files["java-attacher.jar"] = mage.PackageFile{Mode: 0750, Source: "build/java-attacher.jar", Owner: mage.BeatUser} case mage.Docker: delete(args.Spec.Files, "{{.BeatName}}.reference.yml") @@ -356,11 +356,13 @@ func customizePackaging() { args.Spec.Files[ingestTarget] = ingest args.Spec.ExtraVars["expose_ports"] = config.DefaultPort args.Spec.ExtraVars["repository"] = "docker.elastic.co/apm" + args.Spec.Files["java-attacher.jar"] = mage.PackageFile{Mode: 0750, Source: "build/java-attacher.jar", Owner: mage.BeatUser} case mage.Deb, mage.RPM: delete(args.Spec.Files, "/etc/{{.BeatName}}/{{.BeatName}}.reference.yml") args.Spec.ReplaceFile("/usr/share/{{.BeatName}}/README.md", readmeTemplate) args.Spec.Files["/usr/share/{{.BeatName}}/"+ingestTarget] = ingest + args.Spec.Files["/usr/share/{{.BeatName}}/bin/java-attacher.jar"] = mage.PackageFile{Mode: 0750, Source: "build/java-attacher.jar", Owner: mage.BeatUser} // update config file Owner pf := args.Spec.Files["/etc/{{.BeatName}}/{{.BeatName}}.yml"] From 2c3f539a39d67c443055c03d9f6d8698bcd4e08d Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 15 Nov 2021 09:09:30 +0100 Subject: [PATCH 4/8] verify java attacher jar md5 --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e9a914420f1..f7f811b0bc0 100644 --- a/Makefile +++ b/Makefile @@ -262,11 +262,18 @@ release-manager-release: release JAVA_ATTACHER_VERSION:=1.26.0 JAVA_ATTACHER_JAR:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION).jar +JAVA_ATTACHER_JAR_MD5:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION).jar.md5 JAVA_ATTACHER_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR) +JAVA_ATTACHER_MD5_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR_MD5) -build/$(JAVA_ATTACHER_JAR): +build/$(JAVA_ATTACHER_JAR_MD5): + @curl -sSL $(JAVA_ATTACHER_MD5_URL) > $@ + @echo " build/$(JAVA_ATTACHER_JAR)" >> $@ + +build/$(JAVA_ATTACHER_JAR): build/$(JAVA_ATTACHER_JAR_MD5) curl -sSL $(JAVA_ATTACHER_URL) > $@ - cp $@ build/java-attacher.jar + @md5sum --quiet -c $< + @cp $@ build/java-attacher.jar .PHONY: release release: export PATH:=$(dir $(BIN_MAGE)):$(PATH) From 545d9342b615c1a618c91ddff1ec37591613e37f Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 15 Nov 2021 12:02:02 +0100 Subject: [PATCH 5/8] verify attacher with gpg signature --- .gitignore | 1 + Makefile | 19 ++++++++++++------- apm-agent-java-public-key.asc | 29 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 apm-agent-java-public-key.asc diff --git a/.gitignore b/.gitignore index dc0efee8e25..0ba3cc27b5c 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ html_docs docker-compose.yml.bck Dockerfile.bck version.asciidoc.bck +.imported-java-agent-pubkey diff --git a/Makefile b/Makefile index f7f811b0bc0..ba1ae967d43 100644 --- a/Makefile +++ b/Makefile @@ -262,17 +262,22 @@ release-manager-release: release JAVA_ATTACHER_VERSION:=1.26.0 JAVA_ATTACHER_JAR:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION).jar -JAVA_ATTACHER_JAR_MD5:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION).jar.md5 +JAVA_ATTACHER_SIG:=$(JAVA_ATTACHER_JAR).asc JAVA_ATTACHER_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR) -JAVA_ATTACHER_MD5_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR_MD5) +JAVA_ATTACHER_SIG_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_SIG) -build/$(JAVA_ATTACHER_JAR_MD5): - @curl -sSL $(JAVA_ATTACHER_MD5_URL) > $@ - @echo " build/$(JAVA_ATTACHER_JAR)" >> $@ +APM_AGENT_JAVA_PUB_KEY:=apm-agent-java-public-key.asc -build/$(JAVA_ATTACHER_JAR): build/$(JAVA_ATTACHER_JAR_MD5) +.imported-java-agent-pubkey: + @gpg --import $(APM_AGENT_JAVA_PUB_KEY) + @touch $@ + +build/$(JAVA_ATTACHER_SIG): + curl -sSL $(JAVA_ATTACHER_SIG_URL) > $@ + +build/$(JAVA_ATTACHER_JAR): build/$(JAVA_ATTACHER_SIG) .imported-java-agent-pubkey curl -sSL $(JAVA_ATTACHER_URL) > $@ - @md5sum --quiet -c $< + gpg --verify $< $@ @cp $@ build/java-attacher.jar .PHONY: release diff --git a/apm-agent-java-public-key.asc b/apm-agent-java-public-key.asc new file mode 100644 index 00000000000..1376947a9b9 --- /dev/null +++ b/apm-agent-java-public-key.asc @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: SKS 1.1.6 +Comment: Hostname: pgp.mit.edu + +mQENBFI3HsoBCADXDtbNJnxbPqB1vDNtCsqhe49vFYsZN9IOZsZXgp7aHjh6CJBDA+bGFOwy +hbd7at35jQjWAw1O3cfYsKAmFy+Ar3LHCMkV3oZspJACTIgCrwnkic/9CUliQe324qvObU2Q +RtP4Fl0zWcfb/S8UYzWXWIFuJqMvE9MaRY1bwUBvzoqavLGZj3SF1SPO+TB5QrHkrQHBsmX+ +Jda6d4Ylt8/t6CvMwgQNlrlzIO9WT+YN6zS+sqHd1YK/aY5qhoLNhp9G/HxhcSVCkLq8SStj +1ZZ1S9juBPoXV1ZWNbxFNGwOh/NYGldD2kmBf3YgCqeLzHahsAEpvAm8TBa7Q9W21C8vABEB +AAG0RUVsYXN0aWNzZWFyY2ggKEVsYXN0aWNzZWFyY2ggU2lnbmluZyBLZXkpIDxkZXZfb3Bz +QGVsYXN0aWNzZWFyY2gub3JnPokBOAQTAQIAIgUCUjceygIbAwYLCQgHAwIGFQgCCQoLBBYC +AwECHgECF4AACgkQ0n1mbNiOQrRzjAgAlTUQ1mgo3nK6BGXbj4XAJ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PDlGRlOgVTd9xUfHFkzB52c70E= +=92oX +-----END PGP PUBLIC KEY BLOCK----- From d10c59232d9357721d2ddeb1f1c9528df464d706 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 15 Nov 2021 12:44:20 +0100 Subject: [PATCH 6/8] use -slim jar + different base url --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c91237aaad1..fd9094b16a1 100644 --- a/Makefile +++ b/Makefile @@ -261,10 +261,11 @@ release-manager-snapshot: release release-manager-release: release JAVA_ATTACHER_VERSION:=1.26.0 -JAVA_ATTACHER_JAR:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION).jar +JAVA_ATTACHER_JAR:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION)-slim.jar JAVA_ATTACHER_SIG:=$(JAVA_ATTACHER_JAR).asc -JAVA_ATTACHER_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR) -JAVA_ATTACHER_SIG_URL:=https://search.maven.org/remotecontent?filepath=co/elastic/apm/apm-agent-attach-cli/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_SIG) +JAVA_ATTACHER_BASE_URL:=https://repo1.maven.org/maven2/co/elastic/apm/apm-agent-attach-cli +JAVA_ATTACHER_URL:=$(JAVA_ATTACHER_BASE_URL)/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_JAR) +JAVA_ATTACHER_SIG_URL:=$(JAVA_ATTACHER_BASE_URL)/$(JAVA_ATTACHER_VERSION)/$(JAVA_ATTACHER_SIG) APM_AGENT_JAVA_PUB_KEY:=apm-agent-java-public-key.asc From d174994be49d06ef46f0e956d955d585e8525f35 Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 15 Nov 2021 15:36:54 +0100 Subject: [PATCH 7/8] typo in changelog --- changelogs/head.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/head.asciidoc b/changelogs/head.asciidoc index 3cc408844d2..797b0defe46 100644 --- a/changelogs/head.asciidoc +++ b/changelogs/head.asciidoc @@ -64,7 +64,7 @@ https://github.com/elastic/apm-server/compare/7.15\...master[View commits] - Added support for gzip compression to the experimental Elasticsearch output {pull}6449[6449] - Introduced a delete phase for all data streams. Traces, errors and logs are kept for 10 days, metrics are kept for 90 days {pull}6480[6480] - Changed RUM traces to use a dedicated data stream (`traces-apm.rum`). RUM traces are kept for 90 days {pull}6480[6480] -- `apm-server` artifacts now have the apm java-attacher.jar pacakaged alongside them {pull}6593[6593] +- `apm-server` artifacts now have the apm java-attacher.jar packaged alongside them {pull}6593[6593] - When `auth.anonymous.enabled` isn't specified and RUM is enabled (`rum.enabled:true`), `auth.anonymous.enabled` will be set to `true` {pull}6607[6607] [float] From 94010ca8f44dca5fd2a8183879c94b63afcd3b23 Mon Sep 17 00:00:00 2001 From: Felix Barnsteiner Date: Mon, 15 Nov 2021 17:47:25 +0100 Subject: [PATCH 8/8] Update attacher to 1.27.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fd9094b16a1..f25c373a30e 100644 --- a/Makefile +++ b/Makefile @@ -260,7 +260,7 @@ release-manager-snapshot: release .PHONY: release-manager-release release-manager-release: release -JAVA_ATTACHER_VERSION:=1.26.0 +JAVA_ATTACHER_VERSION:=1.27.0 JAVA_ATTACHER_JAR:=apm-agent-attach-cli-$(JAVA_ATTACHER_VERSION)-slim.jar JAVA_ATTACHER_SIG:=$(JAVA_ATTACHER_JAR).asc JAVA_ATTACHER_BASE_URL:=https://repo1.maven.org/maven2/co/elastic/apm/apm-agent-attach-cli