File cri-tools.spec of Package cri-tools
%define realname cri-tools
%define srcext tar.bz2
# Common info
Name: %{realname}
Version: 0
Release: wiz%{?extraver:0.}1%{?dist}
License: Apache-2.0
Group: System/Management
URL: https://github.com/kubernetes-sigs/cri-tools
Summary: CLI and validation tools for Kubelet Container Runtime Interface (CRI)
# Build-time parameters
BuildRequires: go
BuildRoot: %{_tmppath}/%{name}-root
Source0: %{realname}-%{version}.%{srcext}
%description
cri-tools aims to provide a series of debugging and validation tools for Kubelet
CRI, which includes:
* crictl: CLI for kubelet CRI.
* critest: validation test suites for kubelet CRI.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
# Build step (compile/build binaries, documentation, etc)
%build
export GOCACHE=$(pwd -P)/.gocache
export GOTRACEBACK=crash
export CGO_ENABLED=0
# Build binary
go build \
-v \
-mod=vendor \
-tags=selinux \
-buildmode=pie \
-gcflags=all='-dwarf=false' \
-ldflags=all='-s -w' \
-o crictl \
./cmd/crictl
# Install built stuff
%install
%{__install} -D -m0755 crictl %{buildroot}%{_bindir}/crictl
# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
# Files list
%files
%defattr(-,root,root)
%doc CHANGELOG.md CONTRIBUTING.md LICENSE README.md docs/
%{_bindir}/crictl
%changelog