File helmfile.spec of Package helmfile

%define realname helmfile
%define srcext   tar.xz

# Common info
Name:          %{realname}
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Management
URL:           https://github.com/roboll/helmfile
Summary:       Deploy Kubernetes Helm Charts

# Install-time dependencies
Requires:      helm

# Build-time parameters
BuildRequires: go
BuildRoot:     %{_tmppath}/%{name}-root
Source0:       %{realname}-%{version}.%{srcext}
# cd helmfile; go mod vendor -v && tar -Jcvf ../vendor.tar.xz vendor && rm -rf vendor
Source1:       vendor.tar.xz

%description
Helmfile is a declarative spec for deploying helm charts. It lets you...

  * Keep a directory of chart value files and maintain changes
    in version control.
  * Apply CI/CD to configuration changes.
  * Periodically sync to avoid skew in environments.

To avoid upgrades for each iteration of helm, the helmfile executable delegates
to helm - as a result, helm must be installed.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver} -a1

# Build step (compile/build binaries, documentation, etc)
%build
go build -v -a -mod=vendor -buildmode=pie \
    -gcflags=all=-dwarf=false \
    -ldflags='all=-s -w -X github.com/roboll/helmfile/pkg/app/version.Version=%{version}' \
    -o bin/helmfile

# Install built stuff
%install
%{__install} -D -m0755 bin/helmfile %{buildroot}%{_bindir}/helmfile

# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

# Files
%files
%defattr(-,root,root)
%license LICENSE
%doc PATHS.md README.md docs/*.md examples/
%{_bindir}/helmfile

%changelog
openSUSE Build Service is sponsored by