feat: Configurar Dist-Git como Lookaside Cache y corregir bootstrap
- Configurar rol dist_git como Lookaside Cache únicamente (sin git-daemon). - Actualizar estructura de caché a 'rpms/pkg/file/algo/hash/file' compatible con upstream. - Añadir scripts bin/sync-sources.bash y bin/sync-all-sources.bash para sincronizar fuentes desde CentOS Stream. - Eliminar bin/import-srpm.bash obsoleto. - Actualizar script mxos-get-sources.bash en kojid para usar la nueva estructura de URL. - Corregir lógica de 'add-host' en koji_bootstrap para manejar reintentos limpiamente. - Actualizar documentación (README.rst, docs/instalación.rst) reflejando los cambios. - Correcciones menores en rutas de configuración y nombres de grupos en deploy.yaml.
This commit is contained in:
parent
3aec0d2e01
commit
fa97cba322
13 changed files with 282 additions and 216 deletions
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
- name: Install Git and HTTPD
|
||||
- name: Install HTTPD and Utils
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- git
|
||||
- git-daemon
|
||||
- httpd
|
||||
- mod_ssl
|
||||
- policycoreutils-python-utils
|
||||
|
|
@ -11,6 +9,7 @@
|
|||
- rpm-build
|
||||
- rpmdevtools
|
||||
- wget
|
||||
- git # Kept for utility, though not serving repos
|
||||
state: present
|
||||
|
||||
- name: Create dist-git group
|
||||
|
|
@ -40,10 +39,6 @@
|
|||
- "{{ dist_git_repos_dir }}/RPMs"
|
||||
- "{{ dist_git_cache_dir }}"
|
||||
|
||||
- name: Configure git safe.directory system-wide
|
||||
ansible.builtin.command: git config --system --add safe.directory "*"
|
||||
changed_when: false
|
||||
|
||||
- name: Set SELinux boolean for HTTPD CGI support
|
||||
ansible.builtin.command: setsebool -P httpd_enable_cgi 1
|
||||
changed_when: false
|
||||
|
|
@ -104,22 +99,3 @@
|
|||
name: httpd
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Deploy custom git-daemon systemd service
|
||||
ansible.builtin.template:
|
||||
src: git-daemon.service.j2
|
||||
dest: /etc/systemd/system/git-daemon.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify: Reload systemd daemon
|
||||
|
||||
- name: Reload systemd daemon to recognize new git-daemon service file
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Ensure git-daemon.service is enabled and started
|
||||
ansible.builtin.systemd_service:
|
||||
name: git-daemon.service
|
||||
state: started
|
||||
enabled: true
|
||||
|
|
|
|||
|
|
@ -16,25 +16,9 @@
|
|||
SSLCertificateFile /etc/pki/dist-git/dist-git.crt
|
||||
SSLCertificateKeyFile /etc/pki/dist-git/dist-git.key
|
||||
|
||||
# Git Smart HTTP for RPMs
|
||||
# Maps /RPMs/pkg.git to {{ dist_git_repos_dir }}/RPMs/pkg.git
|
||||
SetEnvIf Request_URI "^/RPMs/" GIT_PROJECT_ROOT={{ dist_git_repos_dir }}/RPMs
|
||||
SetEnv GIT_HTTP_EXPORT_ALL
|
||||
ScriptAlias /RPMs/ /usr/libexec/git-core/git-http-backend/
|
||||
|
||||
<Directory "/usr/libexec/git-core">
|
||||
Options +ExecCGI
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<Directory "{{ dist_git_repos_dir }}">
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
# Lookaside Cache
|
||||
Alias /sources {{ dist_git_cache_dir }}
|
||||
<Directory "{{ dist_git_cache_dir }}">
|
||||
Options +Indexes
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
|
|
|
|||
|
|
@ -10,11 +10,38 @@
|
|||
changed_when: "'Host added' in koji_add_host_result.stdout"
|
||||
failed_when: "'is already in the database' not in koji_add_host_result.stderr and koji_add_host_result.rc != 0"
|
||||
rescue:
|
||||
- name: Convert user to host in DB if it exists as user
|
||||
- name: Get user ID of the non-host user
|
||||
ansible.builtin.command: >
|
||||
sudo -u postgres psql {{ koji_db_name }} -tAc
|
||||
"SELECT id FROM users WHERE name = '{{ item }}' AND usertype = 0;"
|
||||
register: non_host_user_id
|
||||
delegate_to: "{{ koji_db_host }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Delete sessions for non-host user
|
||||
ansible.builtin.command: >
|
||||
sudo -u postgres psql {{ koji_db_name }} -c
|
||||
"UPDATE users SET usertype = 1 WHERE name = '{{ item }}' AND usertype = 0;"
|
||||
"DELETE FROM sessions WHERE user_id = {{ non_host_user_id.stdout | trim }};"
|
||||
when:
|
||||
- non_host_user_id.stdout | trim | length > 0
|
||||
- "'already exists and it is not a host' in koji_add_host_result.stderr"
|
||||
delegate_to: "{{ koji_db_host }}"
|
||||
changed_when: true
|
||||
|
||||
- name: Delete non-host user
|
||||
ansible.builtin.command: >
|
||||
sudo -u postgres psql {{ koji_db_name }} -c
|
||||
"DELETE FROM users WHERE id = {{ non_host_user_id.stdout | trim }};"
|
||||
when:
|
||||
- non_host_user_id.stdout | trim | length > 0
|
||||
- "'already exists and it is not a host' in koji_add_host_result.stderr"
|
||||
delegate_to: "{{ koji_db_host }}"
|
||||
changed_when: true
|
||||
|
||||
- name: Retry adding Koji builder host
|
||||
ansible.builtin.command: >
|
||||
sudo -u {{ koji_admin_user }} koji
|
||||
--config={{ koji_hub_admin_user_koji_dir }}/config
|
||||
add-host {{ item }} x86_64
|
||||
when:
|
||||
- "'already exists and it is not a host' in koji_add_host_result.stderr"
|
||||
changed_when: true
|
||||
delegate_to: "{{ koji_db_host }}"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
koji_hub_plugin_dir: /usr/lib/koji_hub/plugins
|
||||
koji_hub_config_dir: /etc/koji_hub/hub.conf.d
|
||||
koji_hub_koji_web_config_dir: /etc/kojiweb/
|
||||
koji_hub_plugin_dir: /usr/lib/koji-hub-plugins
|
||||
koji_hub_config_dir: /etc/koji-hub/hub.conf.d
|
||||
koji_hub_koji_web_config_dir: /etc/kojiweb
|
||||
koji_hub_httpd_ssl_config_file: /etc/httpd/conf.d/ssl.conf
|
||||
koji_hub_httpd_config_file: /etc/httpd/conf.d/kojihub.conf
|
||||
koji_hub_koji_client_config_file: /etc/koji.conf.d/main.conf
|
||||
|
|
|
|||
|
|
@ -30,7 +30,11 @@ while read -r alg filename_part eq hash; do
|
|||
# Check if there's a trailing slash in SURL, remove it if so.
|
||||
SURL=${SURL%/}
|
||||
|
||||
url="$SURL/$PKGNAME/$filename/$hash/$filename"
|
||||
# Algo to lowercase
|
||||
alg_lower=$(echo "$alg" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# URL: SURL/rpms/PKGNAME/FILENAME/ALGO/HASH/FILENAME
|
||||
url="$SURL/rpms/$PKGNAME/$filename/$alg_lower/$hash/$filename"
|
||||
|
||||
echo "Downloading $filename from $url"
|
||||
curl -L --fail --retry 5 -o "$filename" "$url"
|
||||
|
|
|
|||
Loading…
Reference in a new issue