Skip to content

Commit

Permalink
(#198) added support for el9 packages to be built using a template of…
Browse files Browse the repository at this point in the history
… el8. Also added support for building el9 packages to the nightly build in the github workflow
  • Loading branch information
gerrity95 committed Mar 5, 2024
1 parent 866071c commit 968a85d
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ jobs:
packager_tag: el8-go1.19
version: ${{ env.build_version }}

el9_64:
runs-on: ubuntu-latest
steps:
- name: Build
uses: choria-io/actions/packager@main
with:
build_package: el9_64
packager_tag: el9-go1.19
version: ${{ env.build_version }}

docker:
needs:
- upload
Expand All @@ -47,6 +57,7 @@ jobs:
needs:
- el7_64
- el8_64
- el9_64

runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 6 additions & 0 deletions packager/buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ foss:
template: el/el8
target_arch: x86_64
binary: 64bit_linux

el9_64:
dist: el9
template: el/el9
target_arch: x86_64
binary: 64bit_linux
13 changes: 13 additions & 0 deletions packager/templates/el/el9/choria-provisioner.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Choria Server Provisioner
After=network.target

[Service]
StandardOutput=syslog
StandardError=syslog
User=root
Group=root
ExecStart={{cpkg_bindir}}/{{cpkg_name}} run --choria-config {{cpkg_etcdir}}/choria.cfg --config={{cpkg_etcdir}}/{{cpkg_name}}.yaml

[Install]
WantedBy=multi-user.target
73 changes: 73 additions & 0 deletions packager/templates/el/el9/choria-provisioner.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
%define debug_package %{nil}
%define pkgname {{cpkg_name}}
%define version {{cpkg_version}}
%define bindir {{cpkg_bindir}}
%define etcdir {{cpkg_etcdir}}
%define release {{cpkg_release}}
%define dist {{cpkg_dist}}
%define manage_conf {{cpkg_manage_conf}}
%define binary {{cpkg_binary}}
%define tarball {{cpkg_tarball}}

Name: %{pkgname}
Version: %{version}
Release: %{release}.%{dist}
Summary: Choria Server Provisioner
License: Apache-2.0
URL: https://choria.io
Group: System Tools
Packager: R.I.Pienaar <[email protected]>
Source0: %{tarball}
BuildRoot: %{_tmppath}/%{pkgname}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
Automatically provisions Choria Servers

%prep
%setup -q

%build

%install
rm -rf %{buildroot}
%{__install} -d -m0755 %{buildroot}/usr/lib/systemd/system
%{__install} -d -m0755 %{buildroot}/etc/logrotate.d
%{__install} -d -m0755 %{buildroot}%{bindir}
%{__install} -d -m0755 %{buildroot}%{etcdir}
%{__install} -d -m0755 %{buildroot}/var/log
%{__install} -d -m0756 %{buildroot}/var/lib/%{pkgname}
%{__install} -m0644 dist/choria-provisioner.service %{buildroot}/usr/lib/systemd/system/%{pkgname}.service
%{__install} -m0644 dist/choria-provisioner-logrotate %{buildroot}/etc/logrotate.d/%{pkgname}
%{__install} -m0640 dist/config.yaml %{buildroot}%{etcdir}/%{pkgname}.yaml
%{__install} -m0755 %{binary} %{buildroot}%{bindir}/%{pkgname}
touch %{buildroot}/var/log/%{pkgname}.log

%clean
rm -rf %{buildroot}

%post
if [ $1 -eq 1 ] ; then
systemctl --no-reload preset %{pkgname} >/dev/null 2>&1 || :
fi

/bin/systemctl --system daemon-reload >/dev/null 2>&1 || :

if [ $1 -ge 1 ]; then
/bin/systemctl try-restart %{pkgname} >/dev/null 2>&1 || :;
fi

%preun
if [ $1 -eq 0 ] ; then
systemctl --no-reload disable --now %{pkgname} >/dev/null 2>&1 || :
fi

%files
%attr(640, root, root) %config(noreplace)%{etcdir}/%{pkgname}.yaml
%{bindir}/%{pkgname}
/etc/logrotate.d/%{pkgname}
/usr/lib/systemd/system/%{pkgname}.service
%attr(644, root, root)/var/log/%{pkgname}.log

%changelog
* Tue Aug 07 2018 R.I.Pienaar <[email protected]>
- Initial Release
11 changes: 11 additions & 0 deletions packager/templates/el/el9/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
required_properties:
- name
- bindir
- etcdir
- release
- manage_conf
- dist

artifacts:
- /usr/src/redhat/**/*.rpm
- /root/rpmbuild/**/*.rpm

0 comments on commit 968a85d

Please sign in to comment.