summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-03-12 12:21:32 +0000
committerCoprDistGit <infra@openeuler.org>2025-03-12 12:21:32 +0000
commitbc74010389808007d7543e6a2ed4ce5b1469b48e (patch)
treee407edfb25a2f012fda1c0dbbd517d1defb34a26
parent63a1ab5283de55aa78d7b3cf52be3f3a22a6dd0f (diff)
automatic import of resalloc
-rw-r--r--.gitignore1
-rw-r--r--resalloc-agent-spawner.service15
-rw-r--r--resalloc.spec87
-rw-r--r--sources2
4 files changed, 92 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 7a34d37..57ad093 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/resalloc-4.9.tar.gz
+/resalloc-5.9.tar.gz
diff --git a/resalloc-agent-spawner.service b/resalloc-agent-spawner.service
new file mode 100644
index 0000000..b4bb2c6
--- /dev/null
+++ b/resalloc-agent-spawner.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Start self-stending agent-like resources using Resalloc
+After=syslog.target network.target auditd.service
+
+[Service]
+Type=simple
+User=resalloc
+Group=resalloc
+ExecStart=/usr/bin/resalloc-agent-spawner
+# we don't want to kill background action processors (daemoncontext)
+KillMode=process
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/resalloc.spec b/resalloc.spec
index 936171e..162d852 100644
--- a/resalloc.spec
+++ b/resalloc.spec
@@ -5,6 +5,17 @@
%global _logdir %_var/log/%{name}server
%global _homedir %_sharedstatedir/%{name}server
+%global agent_user resalloc-agent-spawner
+%global agent_group %agent_user
+
+%global create_user_group() \
+getent group "%1" >/dev/null || groupadd -r "%1" \
+getent passwd "%1" >/dev/null || \\\
+useradd -r -g "%2" -G "%2" -s "%3" \\\
+ -c "%1 service user" "%1" \\\
+ -d "%4"
+
+
%global sum Resource allocator for expensive resources
%global desc \
The resalloc project aims to help with taking care of dynamically \
@@ -14,8 +25,8 @@ the purposes of CI/CD tasks.
Name: %srcname
Summary: %sum - client tooling
-Version: 4.9
-Release: 1
+Version: 5.9
+Release: 1
License: GPL-2.0-or-later
URL: https://github.com/praiskup/resalloc
BuildArch: noarch
@@ -42,6 +53,7 @@ Source1: resalloc.service
Source2: logrotate
Source3: merge-hook-logs
Source4: cron.hourly
+Source5: resalloc-agent-spawner.service
%description
%desc
@@ -55,10 +67,11 @@ Summary: %sum - server part
Requires: crontabs
Requires: logrotate
Requires: python3-%srcname = %version-%release
+Requires: %srcname-helpers = %version-%release
Requires: python3-alembic
Requires: python3-six
Requires: python3-sqlalchemy
-Requires: python3-yaml
+Requires: python3-pyyaml
Requires(pre): /usr/sbin/useradd
%description server
@@ -67,6 +80,16 @@ Requires(pre): /usr/sbin/useradd
The %name-server package provides the resalloc server, and
some tooling for resalloc administrators.
+
+%package helpers
+Summary: %sum - helper/library scripts
+
+%description helpers
+%desc
+
+Helper and library-like scripts for external Resalloc plugins like resalloc-aws,
+resalloc-openstack, etc.
+
%package webui
Summary: %sum - webui part
@@ -81,6 +104,27 @@ Recommends: %name-selinux
The %name-webui package provides the resalloc webui,
it shows page with information about resalloc resources.
+%package agent-spawner
+Summary: %sum - daemon starting agent-like resources
+
+Requires(pre): /usr/sbin/useradd
+Requires: python3-copr-common >= 0.23
+Requires: python3-daemon
+Requires: python3-redis
+Requires: python3-resalloc
+Requires: python3-setproctitle
+
+%description agent-spawner
+%desc
+
+Agent Spawner maintains sets resources (agents) of certain kind and in certain
+number, according to given configuration. Typical Resalloc resource is
+completely dummy, fully controlled from the outside. With agent-like resources
+this is different — such resources are self-standing, they take care of
+themselves, perhaps interacting/competing with each other. The only thing that
+agent-spawner needs to do is to control the ideal number of them.
+
+
%package -n python3-%srcname
Summary: %sum - Python 3 client library
%{?python_provide:%python_provide python3-%srcname}
@@ -113,6 +157,7 @@ restorecon -R %_var/www/cgi-%{name} || :
%build
%py3_build
+sed "1c#! $python" %SOURCE6 > %{name}-wait-for-ssh
%install
@@ -135,11 +180,12 @@ install -d -m 755 %buildroot/%_libexecdir
install -p -m 755 %SOURCE3 %buildroot/%_libexecdir/%name-merge-hook-logs
install -d %buildroot%_sysconfdir/cron.hourly
install -p -m 755 %SOURCE4 %buildroot%_sysconfdir/cron.hourly/resalloc
+install -p -m 755 %name-wait-for-ssh %buildroot%_bindir/%name-wait-for-ssh
# for now EUR call mock by root user, just skip check
# need re-enable check when builder run as non-root user
#%check
-#make check TEST_PYTHONS="python3"
+make check TEST_PYTHONS="python3"
# Simplify "alembic upgrade head" actions.
@@ -147,14 +193,7 @@ ln -s "%{python3_sitelib}/%{name}server" %buildroot%_homedir/project
%pre server
-user=%sysuser
-group=%sysgroup
-getent group "$user" >/dev/null || groupadd -r "$group"
-getent passwd "$user" >/dev/null || \
-useradd -r -g "$group" -G "$group" -s /bin/bash \
- -c "resalloc server's user" "$user" \
- -d "%_homedir"
-
+%create_user_group %sysuser %sysgroup /bin/bash %_homedir
%post server
%systemd_post resalloc.service
@@ -162,6 +201,14 @@ useradd -r -g "$group" -G "$group" -s /bin/bash \
%postun server
%systemd_postun_with_restart resalloc.service
+%pre agent-spawner
+%create_user_group %agent_user %agent_group /bin/false /
+
+%post agent-spawner
+%systemd_post resalloc-agent-spawner.service
+
+%postun agent-spawner
+%systemd_postun_with_restart resalloc-agent-spawner.service
%global doc_files NEWS README
@@ -197,6 +244,19 @@ useradd -r -g "$group" -G "$group" -s /bin/bash \
%_libexecdir/resalloc-merge-hook-logs
%config %attr(0755, root, root) %{_sysconfdir}/cron.hourly/resalloc
+
+%files helpers
+%doc %doc_files
+%license COPYING
+%{_bindir}/%{name}-check-vm-ip
+%{_bindir}/%{name}-wait-for-ssh
+
+%files agent-spawner
+%_bindir/resalloc-agent*
+%{default_sitelib}/%{name}_agent_spawner
+%_unitdir/resalloc-agent-spawner.service
+%config(noreplace) %_sysconfdir/resalloc-agent-spawner
+
%files webui
%doc %doc_files
%license COPYING
@@ -208,5 +268,8 @@ useradd -r -g "$group" -G "$group" -s /bin/bash \
%changelog
+* Wed Mar 12 2025 lichaoran <pkwarcraft@hotmail.comm> - 5.9-1
+- upgrade to 5.9
+
* Tue Mar 21 2023 lichaoran <pkwarcraft@hotmail.comm> - 4.91
- init package
diff --git a/sources b/sources
index b43d7ac..f498348 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-085994083ea5845f40e8ebfdd975c60b resalloc-4.9.tar.gz
+f5025740a0eddef977aaede2e956b00c resalloc-5.9.tar.gz