-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
packages: build Go binaries for FIPS and non-FIPS #3887
Changes from all commits
4fca8e7
bc40d95
fc7157a
2ca4fa1
2ac1f48
f4ff8a0
c663004
e3af6d9
156e0e7
948e132
cd746c3
ead001c
526540c
0d47953
8f8eff6
ad66abd
2a871a0
2a0f446
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
# Don't generate debug packages because we are compiling without CGO, | ||
# and the `gc` compiler doesn't append the the ".note.gnu.build-id" section | ||
# https://fedoraproject.org/wiki/PackagingDrafts/Go#Build_ID | ||
%global debug_package %{nil} | ||
|
||
%global goproject github.com/aws | ||
%global gorepo amazon-ssm-agent | ||
%global goimport %{goproject}/%{gorepo} | ||
|
@@ -17,10 +12,29 @@ Source0: %{gorepo}-%{version}.tar.gz | |
Source1000: clarify.toml | ||
|
||
BuildRequires: %{_cross_os}glibc-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) | ||
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each binary package provides the It requires the top-level package (so that Finally, it conflicts with the opposite image feature or the other binary package. The conflict helps the package manager eliminate the "wrong" package from consideration, and also prevents |
||
|
||
%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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this part prevent?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's meant to prevent the bin and fips-bin packages from both being installed, since only one set of binaries would end up in use. It's a bit redundant but hypothetically nothing stops someone from adding |
||
|
||
%description fips-bin | ||
%{summary}. | ||
|
||
%prep | ||
%setup -n %{gorepo}-%{version} | ||
|
||
|
@@ -30,25 +44,44 @@ BuildRequires: %{_cross_os}glibc-devel | |
go build -ldflags "${GOLDFLAGS}" -o amazon-ssm-agent \ | ||
./core/agent.go ./core/agent_unix.go ./core/agent_parser.go | ||
|
||
gofips build -ldflags "${GOLDFLAGS}" -o fips/amazon-ssm-agent \ | ||
./core/agent.go ./core/agent_unix.go ./core/agent_parser.go | ||
|
||
go build -ldflags "${GOLDFLAGS}" -o ssm-agent-worker \ | ||
./agent/agent.go ./agent/agent_unix.go ./agent/agent_parser.go | ||
|
||
gofips build -ldflags "${GOLDFLAGS}" -o fips/ssm-agent-worker \ | ||
./agent/agent.go ./agent/agent_unix.go ./agent/agent_parser.go | ||
|
||
go build -ldflags "${GOLDFLAGS}" -o ssm-session-worker \ | ||
./agent/framework/processor/executer/outofproc/sessionworker/main.go | ||
|
||
gofips build -ldflags "${GOLDFLAGS}" -o fips/ssm-session-worker \ | ||
./agent/framework/processor/executer/outofproc/sessionworker/main.go | ||
|
||
%install | ||
# Install the SSM agent under 'libexecdir', since it is meant to be used by other programs | ||
install -d %{buildroot}%{_cross_libexecdir}/amazon-ssm-agent/bin/%{version} | ||
install -d %{buildroot}{%{_cross_libexecdir},%{_cross_fips_libexecdir}}/amazon-ssm-agent/bin/%{version} | ||
for b in amazon-ssm-agent ssm-agent-worker ssm-session-worker; do | ||
install -D -p -m 0755 ${b} %{buildroot}%{_cross_libexecdir}/amazon-ssm-agent/bin/%{version} | ||
install -p -m 0755 ${b} %{buildroot}%{_cross_libexecdir}/amazon-ssm-agent/bin/%{version} | ||
install -p -m 0755 fips/${b} %{buildroot}%{_cross_fips_libexecdir}/amazon-ssm-agent/bin/%{version} | ||
done | ||
|
||
|
||
%cross_scan_attribution --clarify %{S:1000} go-vendor vendor | ||
|
||
%files | ||
%license LICENSE | ||
%{_cross_attribution_file} | ||
%{_cross_attribution_vendor_dir} | ||
|
||
%files bin | ||
%dir %{_cross_libexecdir}/amazon-ssm-agent | ||
%{_cross_libexecdir}/amazon-ssm-agent | ||
%{_cross_libexecdir}/amazon-ssm-agent/bin/%{version}/amazon-ssm-agent | ||
%{_cross_libexecdir}/amazon-ssm-agent/bin/%{version}/ssm-agent-worker | ||
%{_cross_libexecdir}/amazon-ssm-agent/bin/%{version}/ssm-session-worker | ||
|
||
%files fips-bin | ||
%dir %{_cross_fips_libexecdir}/amazon-ssm-agent | ||
%{_cross_fips_libexecdir}/amazon-ssm-agent/bin/%{version}/amazon-ssm-agent | ||
%{_cross_fips_libexecdir}/amazon-ssm-agent/bin/%{version}/ssm-agent-worker | ||
%{_cross_fips_libexecdir}/amazon-ssm-agent/bin/%{version}/ssm-session-worker |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ Requires: %{_cross_os}iptables | |
%build | ||
%set_cross_go_flags | ||
|
||
go build -buildmode=pie -ldflags="${GOLDFLAGS}" -o "bin/cnitool" %{goimport}/cnitool | ||
go build -ldflags="${GOLDFLAGS}" -o "bin/cnitool" %{goimport}/cnitool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No fips version for this package? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It doesn't import |
||
|
||
%install | ||
install -d %{buildroot}%{_cross_libexecdir}/cni/bin | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each top-level package now depends on a capability like this to ensure that its binaries are installed - since the package wouldn't be very useful without those!