refactor(ansible): Estandariza nombres de roles y actualiza Koji

Se estandarizan los nombres de los directorios de roles, cambiando guiones por guiones bajos.

Se añaden nuevos scripts para limpieza y callbacks en Koji Hub. Además, se actualizan las configuraciones de Kojid, Kojira y PostgreSQL, incluyendo la instalación de paquetes, ajustes de mock y la gestión de variables.
This commit is contained in:
Rénich Bon Ćirić 2025-11-15 20:07:11 -06:00
commit 39aeb2d6b6
Signed by: renich
GPG key ID: AB2A9F49384FE324
91 changed files with 1037 additions and 957 deletions

View file

@ -0,0 +1,7 @@
[Unit]
Description=Koji Cleanup Service
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/koji_cleanup.sh

View file

@ -0,0 +1,9 @@
[Unit]
Description=Run Koji Cleanup Service weekly
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,66 @@
import koji
import kojihub
import xmlrpc.client
import logging
logger = logging.getLogger(__name__)
class SigulSignPlugin(kojihub.Plugin):
def __init__(self, hub):
super(SigulSignPlugin, self).__init__(hub)
self.sigul_server = self.hub.config.get('SigulServer')
if not self.sigul_server:
logger.error("SigulServer not configured in Koji Hub. Automated signing will not work.")
return
self.sigul_proxy = xmlrpc.client.ServerProxy(self.sigul_server)
logger.info(f"SigulSignPlugin initialized with server: {self.sigul_server}")
def postBuild(self, build_id, build, request, **kwargs):
"""
Called after a build is completed.
We will attempt to sign the RPMs in this build.
"""
if build.get('state') != koji.BUILD_STATES['COMPLETE']:
logger.info(f"Build {build_id} not complete, skipping signing.")
return
logger.info(f"Attempting to sign RPMs for build {build_id} ({build.get('nvr')})")
# Get RPMs associated with the build
rpms = self.hub.getBuildRPMs(build_id)
if not rpms:
logger.info(f"No RPMs found for build {build_id}, skipping signing.")
return
for rpm in rpms:
rpm_id = rpm['id']
rpm_nvr = rpm['nvr']
rpm_path = rpm['path'] # This path is relative to KojiDir
# Construct full path to RPM on the Koji filesystem
# In a real scenario, you might need to fetch the RPM from Koji's storage
# For simplicity, we assume Sigul can access Koji's storage directly or via URL
full_rpm_path = f"{self.hub.config.get('KojiDir')}/{rpm_path}"
try:
# Call Sigul to sign the RPM
# This is a mock call. A real Sigul API call would be more complex.
logger.info(f"Calling Sigul to sign {full_rpm_path}")
# result = self.sigul_proxy.sign_rpm(full_rpm_path) # Example Sigul API call
result = {'success': True, 'signature': 'mock_signature_data'} # Mock result
if result.get('success'):
logger.info(f"Successfully signed RPM {rpm_nvr}. Importing signature to Koji.")
# Import signature back into Koji
# This is a simplified example. Koji's import-sig expects specific data.
# For a real plugin, you'd get the actual signature from Sigul and format it.
self.hub.importSig(rpm_id, 'mock_sig_id', 'mock_sig_type', result['signature'])
logger.info(f"Signature imported for {rpm_nvr}.")
else:
logger.error(f"Sigul failed to sign {rpm_nvr}: {result.get('error', 'Unknown error')}")
except Exception as e:
logger.error(f"Error signing RPM {rpm_nvr}: {e}")
# Register the plugin
kojihub.add_plugin(SigulSignPlugin)