From 968a85dde13c0128ab35f09d350f7a8ac775ef14 Mon Sep 17 00:00:00 2001 From: Mark Gerrity Date: Tue, 5 Mar 2024 15:35:28 +0000 Subject: [PATCH] (#198) added support for el9 packages to be built using a template of el8. Also added support for building el9 packages to the nightly build in the github workflow --- .github/workflows/nightly.yaml | 11 +++ packager/buildspec.yaml | 6 ++ .../el/el9/choria-provisioner.service | 13 ++++ .../templates/el/el9/choria-provisioner.spec | 73 +++++++++++++++++++ packager/templates/el/el9/config.yaml | 11 +++ 5 files changed, 114 insertions(+) create mode 100644 packager/templates/el/el9/choria-provisioner.service create mode 100644 packager/templates/el/el9/choria-provisioner.spec create mode 100644 packager/templates/el/el9/config.yaml diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 847bfbd..0afdc43 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -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 @@ -47,6 +57,7 @@ jobs: needs: - el7_64 - el8_64 + - el9_64 runs-on: ubuntu-latest steps: diff --git a/packager/buildspec.yaml b/packager/buildspec.yaml index ddabb11..74b7322 100644 --- a/packager/buildspec.yaml +++ b/packager/buildspec.yaml @@ -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 diff --git a/packager/templates/el/el9/choria-provisioner.service b/packager/templates/el/el9/choria-provisioner.service new file mode 100644 index 0000000..7b1be59 --- /dev/null +++ b/packager/templates/el/el9/choria-provisioner.service @@ -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 diff --git a/packager/templates/el/el9/choria-provisioner.spec b/packager/templates/el/el9/choria-provisioner.spec new file mode 100644 index 0000000..d7aeb28 --- /dev/null +++ b/packager/templates/el/el9/choria-provisioner.spec @@ -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 +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 +- Initial Release diff --git a/packager/templates/el/el9/config.yaml b/packager/templates/el/el9/config.yaml new file mode 100644 index 0000000..4400f14 --- /dev/null +++ b/packager/templates/el/el9/config.yaml @@ -0,0 +1,11 @@ +required_properties: + - name + - bindir + - etcdir + - release + - manage_conf + - dist + +artifacts: + - /usr/src/redhat/**/*.rpm + - /root/rpmbuild/**/*.rpm