Update to 2023-08-17 16:00

This commit is contained in:
Daniel Berteaud
2023-08-17 16:00:21 +02:00
parent 846c668216
commit cc7c11ba8a
20 changed files with 611 additions and 35 deletions

View File

@@ -22,6 +22,18 @@ rpm_gpg_email: rpms@{{ ansible_domain }}
# - '--partial'
# - '--delete-after'
# - '--exclude=archives'
# # You can also set a custom command to handle the sync
# - dest: mirror-1
# sync_cmd: >
# rclone
# sync
# --sftp-host=10.99.9.10
# --sftp-port=3022
# --sftp-user=repo
# --sftp-key-file=~/.ssh/id_rsa
# --sftp-md5sum-command=md5sum
# --sftp-sha1sum-command=sha1sum
# /opt/rpm-build/repo/ :sftp:/repo/
# A list of rsync options which will be used to sync repo to mirrors
# This is a fallback if rsync_opts is not defined for a mirror

View File

@@ -217,21 +217,26 @@ sub handle_submit {
if (defined $conf->{mirror} and defined $conf->{mirror}->{push}){
foreach my $mirror (@{$conf->{mirror}->{push}}){
log_info("[$job_id] syncing repo to $mirror->{dest}");
my $rsync_cmd = 'rsync ';
if (defined $mirror->{rsync_opts}){
$rsync_cmd .= join(' ', @{$mirror->{rsync_opts}});
my $sync_cmd;
if (defined $mirror->{sync_cmd}){
$sync_cmd = $mirror->{sync_cmd};
} else {
$rsync_cmd .= join(' ', @{$conf->{mirror}->{rsync_opts}});
$sync_cmd = 'rsync ';
if (defined $mirror->{rsync_opts}){
$sync_cmd .= join(' ', @{$mirror->{rsync_opts}});
} else {
$sync_cmd .= join(' ', @{$conf->{mirror}->{rsync_opts}});
}
$sync_cmd .= ' ' . $conf->{paths}->{repo} . '/ ' . $mirror->{dest} . '/';
}
$rsync_cmd .= ' ' . $conf->{paths}->{repo} . '/ ' . $mirror->{dest} . '/';
log_verbose("[$job_id] Running command $rsync_cmd");
foreach my $out (qx($rsync_cmd 2>&1)){
log_verbose("[$job_id] Running command $sync_cmd");
foreach my $out (qx($sync_cmd 2>&1)){
chomp $out;
log_verbose("[$job_id] $out");
}
if ($? != 0) {
log_info("[$job_id] Syncing to $mirror->{dest} failed");
handle_error($job_id, 'Mirror update error', "Command $rsync_cmd failed", $email);
handle_error($job_id, 'Mirror update error', "Command $sync_cmd failed", $email);
return;
}
}

View File

@@ -22,12 +22,16 @@ mirror:
push:
{% for mirror in rpm_mirrors %}
- dest: {{ mirror.dest }}
{% if mirror.sync_cmd is defined %}
sync_cmd: {{ mirror.sync_cmd | quote }}
{% else %}
{% if mirror.rsync_opts is defined %}
rsync_opts:
{% for opt in mirror.rsync_opts %}
- '{{ opt }}'
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
rsync_opts:
{% for opt in rpm_mirror_rsync_opts %}

View File

@@ -6,6 +6,7 @@ rpm_packages:
- inotify-tools
- zstd
- rsync
- rclone
- yum-utils
- rpm-sign
- perl-Linux-Inotify2