Merge pull request #365 from samm-git/flatcar-ssm

Add Amazon SSM manager to the EC2 images
This commit is contained in:
Sayan Chowdhury 2020-07-13 23:59:58 +05:30 committed by GitHub
commit 091b16e493
6 changed files with 125 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST amazon-ssm-agent-2.3.1319.0.tar.gz 22207875 BLAKE2B 9c94f6837079d8117dffea09b1f793d261ac0cb2321c5e0f5a422ea1c57f5abeb3eb38fae74f91481d70ab3bb55dd2098fca4136c37a692d182b45560ed05900 SHA512 bb1d09704981277701bd0b70fadb8c6c917b72fce3f228511def621ea85ee4f401b20456e82bd7e9eed28350260b63076d49cf5f4004555fa16d645bafbecc41

View File

@ -0,0 +1,57 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=7
COREOS_GO_PACKAGE="${GITHUB_URI}"
COREOS_GO_VERSION="go1.12"
inherit coreos-go-depend golang-vcs-snapshot
EGO_PN="github.com/aws/${PN}"
DESCRIPTION="AWS Systems Manager Agent"
HOMEPAGE="https://github.com/aws/amazon-ssm-agent"
LICENSE="Apache-2.0"
SRC_URI="https://${EGO_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz ${EGO_VENDOR_URI}"
SLOT="0"
KEYWORDS="amd64 arm64"
S="${WORKDIR}/${PN}-${PV}/src/${EGO_PN}"
PATCHES=(
# patch generated by `goimports -w ./agent` command
"${FILESDIR}"/${P}-goimports.patch
)
src_prepare() {
default
ln -s ${PWD}/vendor/src/* ${PWD}/vendor/
}
src_compile() {
# 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}"
# set agent release version
BRAZIL_PACKAGE_VERSION=${PV} go run ./agent/version/versiongenerator/version-gen.go
# build all the tools
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/amazon-ssm-agent ./agent || die
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/ssm-cli ./agent/cli-main || die
go 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 \
-o bin/ssm-session-logger ./agent/session/logging || die
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/ssm-session-worker ./agent/framework/processor/executer/outofproc/sessionworker || die
}
src_install() {
into "/usr/share/oem"
dobin bin/amazon-ssm-agent bin/ssm-cli bin/ssm-document-worker bin/ssm-session-logger bin/ssm-session-worker
# files used by ignition on a first run
insinto "/usr/share/oem/ssm"
newins seelog_unix.xml seelog.xml.template
doins amazon-ssm-agent.json.template
}

View File

@ -0,0 +1,23 @@
diff --git a/agent/plugins/inventory/gatherers/application/dataProvider.go b/agent/plugins/inventory/gatherers/application/dataProvider.go
index d252ffb4..d1a010ed 100644
--- a/agent/plugins/inventory/gatherers/application/dataProvider.go
+++ b/agent/plugins/inventory/gatherers/application/dataProvider.go
@@ -7,7 +7,6 @@ import (
"fmt"
"github.com/aws/amazon-ssm-agent/agent/context"
- "github.com/aws/amazon-ssm-agent/agent/plugins/configurepackage/localpackages"
"github.com/aws/amazon-ssm-agent/agent/plugins/inventory/model"
)
diff --git a/agent/plugins/inventory/gatherers/application/dataProvider_unix_test.go b/agent/plugins/inventory/gatherers/application/dataProvider_unix_test.go
index af51fa2d..a2757005 100644
--- a/agent/plugins/inventory/gatherers/application/dataProvider_unix_test.go
+++ b/agent/plugins/inventory/gatherers/application/dataProvider_unix_test.go
@@ -241,4 +241,4 @@ func TestApplicationDataWithPackageRepositoryData(t *testing.T) {
data := CollectApplicationData(mockContext)
assert.Equal(t, len(sampleDataParsed), len(data))
assert.NotEqual(t, len(mockData), len(data))
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<longdescription lang="en">
Amazon EC2 Simple Systems Manager (SSM) Agent is software developed
for the Simple Systems Manager Service.
</longdescription>
<maintainer type="person">
<email>samm@os2.kiev.ua</email>
<name>Oleksii Samorukov</name>
</maintainer>
<upstream>
<remote-id type="github">aws/amazon-ssm-agent</remote-id>
</upstream>
</pkgmetadata>

View File

@ -7,6 +7,31 @@
{ {
"name": "coreos-metadata-sshkeys@.service", "name": "coreos-metadata-sshkeys@.service",
"enabled": true "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
} }
] ]
} }

View File

@ -13,6 +13,10 @@ KEYWORDS="amd64 arm64 x86"
IUSE="ec2 openstack brightbox" IUSE="ec2 openstack brightbox"
REQUIRED_USE="^^ ( ec2 openstack brightbox )" REQUIRED_USE="^^ ( ec2 openstack brightbox )"
RDEPEND="
app-emulation/amazon-ssm-agent
"
# no source directory # no source directory
S="${WORKDIR}" S="${WORKDIR}"