From e54cc45bb85b635129ea912932c1650803f1bfdc Mon Sep 17 00:00:00 2001 From: Xinliang Liu Date: Tue, 6 Apr 2021 03:21:19 +0000 Subject: [PATCH] Enable openEuler mirroring Mirror latest LTS release openEuler-20.03-LTS-SP2. Change-Id: I134b0c8b119d4662fc56f139a7ff4b0c7d6a4980 --- .../files/openeuler-mirror-update | 64 +++++++++++++++++++ .../roles/mirror-update/tasks/rsync.yaml | 1 + playbooks/roles/mirror/tasks/main.yaml | 1 + .../mirror-update01.opendev.org.yaml.j2 | 3 + testinfra/test_mirror-update.py | 2 + 5 files changed, 71 insertions(+) create mode 100755 playbooks/roles/mirror-update/files/openeuler-mirror-update diff --git a/playbooks/roles/mirror-update/files/openeuler-mirror-update b/playbooks/roles/mirror-update/files/openeuler-mirror-update new file mode 100755 index 0000000000..b08f7ba84d --- /dev/null +++ b/playbooks/roles/mirror-update/files/openeuler-mirror-update @@ -0,0 +1,64 @@ +#!/bin/bash -xe +# Copyright 2021 Linaro Limited. +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# This references CentOS 7 mirroring part of centos-mirror-update. + +source /usr/share/mirror-update/functions.sh + +MIRROR_VOLUME=$1 + +if [[ ${NO_TIMEOUT:-0} -eq 1 ]]; then + echo_ts "Running interactively" + TIMEOUT="" +else + TIMEOUT="timeout -k 2m 30m" +fi + +BASE="/afs/.openstack.org/mirror/openeuler" +K5START="k5start -t -f /etc/openeuler.keytab service/openeuler-mirror -- $TIMEOUT" + +# Using a foreign mirror to rsync quickly. +# For a whole mirror list see https://openeuler.org/en/mirror/list/. +MIRROR="rsync://ru-repo.openeuler.org:30873/openeuler" +REPOS="openEuler-20.03-LTS-SP2" + +for REPO in $REPOS; do + if ! [ -f $BASE/$REPO ]; then + $K5START mkdir -p $BASE/$REPO + fi + + date --iso-8601=ns + echo_ts "Running $REPO rsync..." + $K5START rsync -rltvz \ + --delete \ + --delete-excluded \ + --exclude="ISO/" \ + --exclude="debuginfo/" \ + --exclude="docker_img/" \ + --exclude="raspi_img" \ + --exclude="source/" \ + --exclude="stratovirt_img/" \ + --exclude="virtual_machine_img/" \ + $MIRROR/$REPO/ $BASE/$REPO/ + echo_ts "$REPO rsync done." +done + +date --iso-8601=ns | $K5START tee $BASE/timestamp.txt +echo_ts "rsync completed successfully, running vos release." +vos_release $MIRROR_VOLUME + +date --iso-8601=ns +echo_ts "Done." diff --git a/playbooks/roles/mirror-update/tasks/rsync.yaml b/playbooks/roles/mirror-update/tasks/rsync.yaml index 7db8f5a3da..9949105070 100644 --- a/playbooks/roles/mirror-update/tasks/rsync.yaml +++ b/playbooks/roles/mirror-update/tasks/rsync.yaml @@ -14,6 +14,7 @@ - centos - epel - fedora + - openeuler - opensuse - yum-puppetlabs diff --git a/playbooks/roles/mirror/tasks/main.yaml b/playbooks/roles/mirror/tasks/main.yaml index 66ec110c4d..68eaf033f1 100644 --- a/playbooks/roles/mirror/tasks/main.yaml +++ b/playbooks/roles/mirror/tasks/main.yaml @@ -88,6 +88,7 @@ - epel - fedora - logs + - openeuler - opensuse - ubuntu - ubuntu-ports diff --git a/playbooks/zuul/templates/host_vars/mirror-update01.opendev.org.yaml.j2 b/playbooks/zuul/templates/host_vars/mirror-update01.opendev.org.yaml.j2 index 773ccab9f5..30bc82b1eb 100644 --- a/playbooks/zuul/templates/host_vars/mirror-update01.opendev.org.yaml.j2 +++ b/playbooks/zuul/templates/host_vars/mirror-update01.opendev.org.yaml.j2 @@ -13,6 +13,9 @@ mirror_update_keytab_epel: |- mirror_update_keytab_fedora: |- aEkRPhZllm2F2y71Zgf3X9NjyHT7/sS8bd/vXt9oG1PKkUmpeBXprFnrxzMuKiupHwwTa09w5LuB blLvBOC8W5Miz1u6TkRe+/jLQurLpzYHwk3bJCJ6s3WwPKDej54TDVgrVQ== +mirror_update_keytab_openeuler: |- + aEkRPhZllm2F2y71Zgf3X9NjyHT7/sS8bd/vXt9oG1PKkUmpeBXprFnrxzMuKiupHwwTa09w5LuB + blLvBOC8W5Miz1u6TkRe+/jLQurLpzYHwk3bJCJ6s3WwPKDej54TDVgrVQ== mirror_update_keytab_opensuse: |- aEkRPhZllm2F2y71Zgf3X9NjyHT7/sS8bd/vXt9oG1PKkUmpeBXprFnrxzMuKiupHwwTa09w5LuB blLvBOC8W5Miz1u6TkRe+/jLQurLpzYHwk3bJCJ6s3WwPKDej54TDVgrVQ== diff --git a/testinfra/test_mirror-update.py b/testinfra/test_mirror-update.py index 893ac16973..91d070014c 100644 --- a/testinfra/test_mirror-update.py +++ b/testinfra/test_mirror-update.py @@ -30,6 +30,7 @@ def test_rsync_scripts(host): for script in ['centos', 'epel', 'fedora', + 'openeuler', 'opensuse', 'yum-puppetlabs']: f = host.file('/usr/local/bin/%s-mirror-update' % script) @@ -45,6 +46,7 @@ def test_keytabs(host): '/etc/centos.keytab', '/etc/epel.keytab', '/etc/fedora.keytab', + '/etc/openeuler.keytab', '/etc/opensuse.keytab', '/etc/yum-puppetlabs.keytab', '/etc/reprepro.keytab']: