From 087534437836f00841657e3457259f90ef2dd7ee Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Tue, 3 Aug 2021 12:31:11 +0000 Subject: [PATCH 1/3] app-emulation/amazon-ssm-agent: cross-compile and use correct go version The ebuild was missing a call to go_export() which exports GOARCH, and so was always built for host architecture. While COREOS_GO_VERSION was specified as go1.12, src_compile() has to use '${EGO}' to make use of it, so we were building with go1.16 (latest). Upstream builds with 1.12 for this version, so we will do the same. Signed-off-by: Jeremi Piotrowski --- ...build => amazon-ssm-agent-2.3.1319.0-r1.ebuild} | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) rename sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/{amazon-ssm-agent-2.3.1319.0.ebuild => amazon-ssm-agent-2.3.1319.0-r1.ebuild} (80%) diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/amazon-ssm-agent-2.3.1319.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/amazon-ssm-agent-2.3.1319.0-r1.ebuild similarity index 80% rename from sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/amazon-ssm-agent-2.3.1319.0.ebuild rename to sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/amazon-ssm-agent-2.3.1319.0-r1.ebuild index 1f31e8b76f..ce6c39e455 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/amazon-ssm-agent-2.3.1319.0.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/amazon-ssm-agent/amazon-ssm-agent-2.3.1319.0-r1.ebuild @@ -28,23 +28,25 @@ src_prepare() { } src_compile() { + go_export + # this is replication of commands from the vendor makefile # but without network activity during build phase local GO_LDFLAGS="-s -w -extldflags=-Wl,-z,now,-z,relro,-z,defs" export GOPATH="${WORKDIR}/${PN}-${PV}" export GO111MODULE="off" # set agent release version - BRAZIL_PACKAGE_VERSION=${PV} go run ./agent/version/versiongenerator/version-gen.go + BRAZIL_PACKAGE_VERSION=${PV} ${EGO} run ./agent/version/versiongenerator/version-gen.go # build all the tools - go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ + ${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ -o bin/amazon-ssm-agent ./agent || die - go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ + ${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ -o bin/ssm-cli ./agent/cli-main || die - go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ + ${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ -o bin/ssm-document-worker ./agent/framework/processor/executer/outofproc/worker || die - go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ + ${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ -o bin/ssm-session-logger ./agent/session/logging || die - go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ + ${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \ -o bin/ssm-session-worker ./agent/framework/processor/executer/outofproc/sessionworker || die } From 26767b01aa6015b8d71f19ba76f26c0a6a814c64 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Tue, 3 Aug 2021 12:55:08 +0000 Subject: [PATCH 2/3] Revert "Revert "Build app-emulation/amazon-ssm-agent with EC2 AMI images"" Now that the OEM partition is a btrfs partition with compression, we have enough space to install ssm agent. This reverts commit b6abb59c544be13e923a3e7240b5c9395c281fca. Signed-off-by: Jeremi Piotrowski --- .../oem-ec2-compat/files/base/base-ec2.ign | 25 +++++++++++++++++++ .../oem-ec2-compat-0.1.2.ebuild | 4 +++ 2 files changed, 29 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/base/base-ec2.ign b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/base/base-ec2.ign index bfcfd84e05..dd5ce9670a 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/base/base-ec2.ign +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/base/base-ec2.ign @@ -7,6 +7,31 @@ { "name": "coreos-metadata-sshkeys@.service", "enabled": true + }, + { + "name": "amazon-ssm-agent.service", + "enabled": true, + "contents": "[Unit]\nDescription=amazon-ssm-agent\nAfter=network-online.target\n\n[Service]\nType=simple\nWorkingDirectory=/usr/share/oem\nExecStart=/usr/share/oem/amazon-ssm-agent\nKillMode=process\nRestart=on-failure\nRestartForceExitStatus=SIGPIPE\nRestartSec=15min\n\n[Install]\nWantedBy=multi-user.target\n" + } + ] + }, + "storage": { + "files": [ + { + "filesystem": "root", + "path": "/etc/amazon/ssm/amazon-ssm-agent.json", + "contents": { + "source": "oem:///ssm/amazon-ssm-agent.json.template" + }, + "mode": 292 + }, + { + "filesystem": "root", + "path": "/etc/amazon/ssm/seelog.xml", + "contents": { + "source": "oem:///ssm/seelog.xml.template" + }, + "mode": 292 } ] } diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild index 7d029caff1..1e8993049a 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild @@ -26,6 +26,10 @@ RDEPEND=" ) " +RDEPEND=" + app-emulation/amazon-ssm-agent +" + # no source directory S="${WORKDIR}" From cbc6a8fb909d66ea36e6a4a9343cd19c8515e599 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Tue, 3 Aug 2021 12:56:55 +0000 Subject: [PATCH 3/3] coreos-base/oem-ec2-compat: make ssm agent conditional on ec2 and properly include all deps in RDEPEND. Signed-off-by: Jeremi Piotrowski --- .../oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild index 1e8993049a..f02447c2fb 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/oem-ec2-compat-0.1.2.ebuild @@ -13,23 +13,14 @@ KEYWORDS="amd64 arm64 x86" IUSE="ec2 openstack brightbox aws_pro" REQUIRED_USE="^^ ( ec2 openstack brightbox aws_pro )" -# TODO: The AWS SSM Agent is currently too big for the OEM partition -# but if it fits, uncomment the following and revert -# b6abb59c544be13e923a3e7240b5c9395c281fca -#RDEPEND=" -# ec2? ( app-emulation/amazon-ssm-agent ) -#" RDEPEND=" + ec2? ( app-emulation/amazon-ssm-agent ) aws_pro? ( coreos-base/flatcar-eks x11-drivers/nvidia-drivers ) " -RDEPEND=" - app-emulation/amazon-ssm-agent -" - # no source directory S="${WORKDIR}"