Skip to content

Commit

Permalink
Add soci-snapshotter to bottlerocket and aws-dev
Browse files Browse the repository at this point in the history
Add the SOCI snapshotter package to aws-dev. This is a lazy-loading plugin for
containerd.

See:

https://github.com/awslabs/soci-snapshotter
  • Loading branch information
larvacea committed May 21, 2024
1 parent 8fc17e2 commit c031446
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/soci-snapshotter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "soci-snapshotter"
version = "0.1.0"
publish = false
build = "../build.rs"
edition = "2021"

[lib]
path = "../packages.rs"

[package.metadata.build-package]
releases-url = "https://github.com/awslabs/soci-snapshotter/releases"

[[package.metadata.build-package.external-files]]
url = "https://github.com/awslabs/soci-snapshotter/archive/refs/tags/v0.5.0.tar.gz"
sha512 = "9980688b71c149ea0f36c52906ba0cc862ca65b9ee0e4b813fef0df83716e313137886986cc78b694e35516fb21095b0cd0436caf485d4b63bd01b150769b6f4"
bundle-root-path = "soci-snapshotter-0.5.0/cmd"
bundle-output-path = "bundled-cmd.tar.gz"
bundle-modules = [ "go" ]

[[package.metadata.build-package.external-files]]
url = "https://github.com/awslabs/soci-snapshotter/archive/refs/tags/v0.5.0.tar.gz"
sha512 = "9980688b71c149ea0f36c52906ba0cc862ca65b9ee0e4b813fef0df83716e313137886986cc78b694e35516fb21095b0cd0436caf485d4b63bd01b150769b6f4"
bundle-modules = [ "go" ]

# RPM BuildRequires
[build-dependencies]
glibc = { path = "../glibc" }
libz = { path = "../libz" }
5 changes: 5 additions & 0 deletions packages/soci-snapshotter/clarify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[clarify."sigs.k8s.io/yaml"]
expression = "MIT AND Apache-2.0"
license-files = [
{ path = "LICENSE", hash = 0xcdf3ae00},
]
16 changes: 16 additions & 0 deletions packages/soci-snapshotter/soci-snapshotter.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=soci snapshotter containerd plugin
Documentation=https://github.com/awslabs/soci-snapshotter
After=configured.target
Wants=configured.target
Before=containerd.service

[Service]
Type=notify
ExecStart=/usr/bin/soci-snapshotter-grpc
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
RequiredBy=containerd.service
82 changes: 82 additions & 0 deletions packages/soci-snapshotter/soci-snapshotter.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
%global gorepo soci-snapshotter
%global gover 0.5.0
%global rpmver %{gover}

Name: %{_cross_os}soci-snapshotter
Version: %{gover}
Release: 1%{?dist}
Summary: A containerd snapshotter plugin which enables lazy loading for OCI images.
License: Apache-2.0
URL: https://github.com/awslabs/soci-snapshotter
Source0: https://github.com/awslabs/soci-snapshotter/archive/refs/tags/v0.5.0.tar.gz
Source1: bundled-v%{gover}.tar.gz
Source2: bundled-cmd.tar.gz
Source101: soci-snapshotter.service
Source1000: clarify.toml

BuildRequires: %{_cross_os}glibc-devel
BuildRequires: %{_cross_os}libz-devel
Requires: %{name}(binaries)

%description
%{summary}.

%package bin
Summary: Remote management agent binaries
Provides: %{name}(binaries)
Requires: (%{_cross_os}image-feature(no-fips) and %{name})
Conflicts: (%{_cross_os}image-feature(fips) or %{name}-fips-bin)

%description bin
%{summary}.

%package fips-bin
Summary: Remote management agent binaries, FIPS edition
Provides: %{name}(binaries)
Requires: (%{_cross_os}image-feature(fips) and %{name})
Conflicts: (%{_cross_os}image-feature(no-fips) or %{name}-bin)

%description fips-bin
%{summary}.

%prep
%setup -n %{gorepo}-%{gover} -q
%setup -T -D -n %{gorepo}-%{gover} -b 1 -q
%setup -T -D -n %{gorepo}-%{gover} -b 2 -q

%build
%set_cross_go_flags

go build -C cmd -ldflags="${GOLDFLAGS}" -o "../out/soci-snapshotter-grpc" ./soci-snapshotter-grpc
go build -C cmd -ldflags="${GOLDFLAGS}" -o "../out/soci" ./soci

gofips build -C cmd -ldflags="${GOLDFLAGS}" -o "../out/fips/soci-snapshotter-grpc" ./soci-snapshotter-grpc
gofips build -C cmd -ldflags="${GOLDFLAGS}" -o "../out/fips/soci" ./soci

%install
install -d %{buildroot}%{_cross_bindir}
install -d %{buildroot}%{_cross_fips_bindir}
install -d %{buildroot}%{_cross_unitdir}
install -p -m 0755 out/soci-snapshotter-grpc %{buildroot}%{_cross_bindir}
install -p -m 0755 out/soci %{buildroot}%{_cross_bindir}
install -p -m 0755 out/fips/soci-snapshotter-grpc %{buildroot}%{_cross_fips_bindir}
install -p -m 0755 out/fips/soci %{buildroot}%{_cross_fips_bindir}
install -D -p -m 0644 %{S:101} %{buildroot}%{_cross_unitdir}

%cross_scan_attribution --clarify %{S:1000} go-vendor vendor

%files
%license LICENSE NOTICE.md
%{_cross_unitdir}/soci-snapshotter.service
%{_cross_attribution_vendor_dir}
%{_cross_attribution_file}

%files bin
%{_cross_bindir}/soci-snapshotter-grpc
%{_cross_bindir}/soci

%files fips-bin
%{_cross_fips_bindir}/soci-snapshotter-grpc
%{_cross_fips_bindir}/soci

%changelog
9 changes: 9 additions & 0 deletions variants/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions variants/aws-dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ included-packages = [
"iputils",
"strace",
"chrony-tools",
"soci-snapshotter",
]

[lib]
Expand All @@ -54,3 +55,4 @@ login = { path = "../../packages/login" }
iputils = { path = "../../packages/iputils" }
strace = { path = "../../packages/strace" }
chrony = { path = "../../packages/chrony" }
soci-snapshotter = { path = "../../packages/soci-snapshotter" }

0 comments on commit c031446

Please sign in to comment.