From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 822771FA2 for ; Sat, 30 Mar 2024 02:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711765546; cv=none; b=UALBywtCuxKr9xohO3dF28b8eJmGXaW6Sf7VPGXUrWHFJxBygvbRMbx3FUqIHTT28p6ow3hg2TUptTk5uFZyr2JqC8BW64JvvSOalz0vRzdwL40IonjWp3Hd+vkHZJR/x++J8MdC7zATddhgGzvBiMCuu2Twkvu5AuseQPM3x6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711765546; c=relaxed/simple; bh=B/J4DkH0eLt94AssFcYVcKQnsWjLRXNiSTvq7u0qDnM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FuLiJhUq1uXg7B0YCFUUHOkNjPyeNy1xCXk+9qwYXZUsaDAPX0a15GprEuIGlUemP8Z1jme4skxBDQCBMyNPVL+hY0Ko2ixILcKma+epQEqrWBqHvf9oK4Qk2HqOsd6JEnSFQwYqTJXcpwZtOHydB4AyWjx53Bk3Sa3wPWqfplA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Vu5JJEoO; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Vu5JJEoO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=o9tUiJ4cHBNjOs83nAeYZyrDzzPAydQCEMxM5WS/ek4=; b=Vu5JJEoOGDm/1ghZ8/pd3MCQgB vJeooIQCqlQSczSyZkHzUAYgay7DbzDSzjy7liQrKlkIjtPps19Y5C1D+pfgPMZ8vJYjWIqRKNC2R 0Agaj8JJia2MMIdiE/ROi43BLJj0bkDUSRL31B54bePpfWFt/U7A58RuhY2BBUvm0E+n/sHIyyrb0 tgMq9cmywZp+PJfy1KL18vrrNb/nScLj6D+9hdv71LGoyLcdhkRgZi7Xjx9yDFUk1lxgGRjB+wJvb qTXf5FHjw8itD3+2VRGnnDG/J0/x3G7lPHAQDIU3tk+XVCXJ6aoWb3fNDJZX4xvac/26gHwIvw8RH Lmqp8NlQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rqOPe-00000002ZM1-31yL; Sat, 30 Mar 2024 02:25:42 +0000 From: Luis Chamberlain To: kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH 15/18] mirrors: add new mirrors.yaml and add xfsprogs Date: Fri, 29 Mar 2024 19:25:37 -0700 Message-ID: <20240330022540.612487-16-mcgrof@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240330022540.612487-1-mcgrof@kernel.org> References: <20240330022540.612487-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain The process to add mirrors is pretty error prone. A lot of it is because we're doing it the old way of shell scripts to scale and we can do better. Just use kconfig to define preferences, ansible to run tasks, and define a yaml file with the mirror preferences outlined based on the target variability the user has opted into. We no longer have to touch the linux-mirror-systemd/Makefile with clunky stuff, all we need to do to add new mirrors is edit playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 and ensure we have sensible defaults. This also lets us do variability. The entire process to install user units and timers, and also clone the mirrors is now done with python scripts that read the input yaml file. Also make use of this now in one shot. It will be clearer how to add new mirrors in one shot in the next commit where we don't add the infrastructure for it. Signed-off-by: Luis Chamberlain --- .gitignore | 5 + Kconfig | 1 + Makefile | 2 - Makefile.linux-mirror | 26 ++- kconfigs/Kconfig.defaults | 3 + kconfigs/Kconfig.mirror | 4 + playbooks/linux-mirror.yml | 4 + playbooks/roles/linux-mirror/README.md | 9 ++ .../roles/linux-mirror/defaults/main.yml | 5 + .../linux-mirror/python/gen-mirror-files.py | 149 ++++++++++++++++++ .../linux-mirror/python/start-mirroring.py | 110 +++++++++++++ playbooks/roles/linux-mirror/tasks/main.yml | 91 +++++++++++ .../linux-mirror/templates/mirrors.yaml.j2 | 4 + workflows/fstests/xfs/Kconfig | 9 +- 14 files changed, 405 insertions(+), 17 deletions(-) create mode 100644 kconfigs/Kconfig.defaults create mode 100644 playbooks/linux-mirror.yml create mode 100644 playbooks/roles/linux-mirror/README.md create mode 100644 playbooks/roles/linux-mirror/defaults/main.yml create mode 100755 playbooks/roles/linux-mirror/python/gen-mirror-files.py create mode 100755 playbooks/roles/linux-mirror/python/start-mirroring.py create mode 100644 playbooks/roles/linux-mirror/tasks/main.yml create mode 100644 playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 diff --git a/.gitignore b/.gitignore index ef5d5983ed13..af7d08a66d28 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,11 @@ workflows/demos/reboot-limit/results/ workflows/gitr/results/ workflows/ltp/results/ +playbooks/roles/linux-mirror/linux-mirror-systemd/mirrors.yaml +# We should strive to ignore all and port them to the new mirrors.yaml +playbooks/roles/linux-mirror/linux-mirror-systemd/xfsprogs-mirror.service +playbooks/roles/linux-mirror/linux-mirror-systemd/xfsprogs-mirror.timer + # For now we ignore all results as we have work to do: # - copy only data for failed tests # - envision a way so that regressions are clearly visible with a git diff diff --git a/Kconfig b/Kconfig index 292f66e7e1a6..dab26fcc351a 100644 --- a/Kconfig +++ b/Kconfig @@ -23,6 +23,7 @@ config KDEVOPS_FIRST_RUN for a series of entries which will help you with this first run. Enabling these are not required, they do however help. +source "kconfigs/Kconfig.defaults" source "kconfigs/Kconfig.distro" menu "Target architecture" diff --git a/Makefile b/Makefile index 5b8e1a22d872..cd4e639a4b01 100644 --- a/Makefile +++ b/Makefile @@ -148,9 +148,7 @@ ifeq (y,$(CONFIG_HYPERVISOR_TUNING)) include Makefile.hypervisor-tunings endif # CONFIG_HYPERVISOR_TUNING -ifeq (y,$(CONFIG_INSTALL_LOCAL_LINUX_MIRROR)) include Makefile.linux-mirror -endif ifeq (y,$(CONFIG_KDEVOPS_DISTRO_REG_METHOD_TWOLINE)) DEFAULT_DEPS += playbooks/secret.yml diff --git a/Makefile.linux-mirror b/Makefile.linux-mirror index c355c4a0ea98..d9515353f77b 100644 --- a/Makefile.linux-mirror +++ b/Makefile.linux-mirror @@ -1,24 +1,21 @@ # SPDX-License-Identifier: copyleft-next-0.3.1 +ifeq (y,$(CONFIG_INSTALL_LOCAL_LINUX_MIRROR)) LINUX_MIRROR_ARGS := LINUX_MIRROR_ARGS += install_linux_mirror=True +LINUX_MIRROR_ARGS += defaults_xfsprogs_git='$(subst ",,$(CONFIG_DEFAULT_XFSPROGS_URL))' MIRROR_CODE := $(TOPDIR)/playbooks/roles/linux-mirror/linux-mirror-systemd/ -# We don't use jinja2 yet to parse this extra_vars stuff to allow -# customizations as the defaults seem sensible. However once and if -# folks want to start adding variability to the how we deploy the -# linux-mirror Ansible can be used: -#kdevops_linux_mirror: $(KDEVOPS_EXTRA_VARS) -# $(Q)ansible-playbook --connection=local \ -# --inventory localhost, \ -# $(KDEVOPS_PLAYBOOKS_DIR)/linux-mirror.yml \ -# -e 'ansible_python_interpreter=/usr/bin/python3' \ -# --extra-vars=@./extra_vars.yaml -# - -# Since we don't support varabiliity yet, for now we keep it very simple: -mirror: $(KDEVOPS_EXTRA_VARS) +kdevops_linux_mirror: $(KDEVOPS_EXTRA_VARS) + $(Q)ansible-playbook --connection=local \ + --inventory localhost, \ + $(KDEVOPS_PLAYBOOKS_DIR)/linux-mirror.yml \ + -e 'ansible_python_interpreter=/usr/bin/python3' \ + --extra-vars=@./extra_vars.yaml +PHONY += kdevops_linux_mirror + +mirror: $(KDEVOPS_EXTRA_VARS) kdevops_linux_mirror $(Q)echo Setting up all mirrors on localhost $(Q)make -C $(MIRROR_CODE) mirror $(Q)make -C $(MIRROR_CODE) install @@ -40,3 +37,4 @@ mirror-help-menu: @echo "" HELP_TARGETS += mirror-help-menu +endif diff --git a/kconfigs/Kconfig.defaults b/kconfigs/Kconfig.defaults new file mode 100644 index 000000000000..ba5d6a3a78d6 --- /dev/null +++ b/kconfigs/Kconfig.defaults @@ -0,0 +1,3 @@ +config DEFAULT_XFSPROGS_URL + string + default "https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git" diff --git a/kconfigs/Kconfig.mirror b/kconfigs/Kconfig.mirror index 7e17d59a605c..66f75cdd2c89 100644 --- a/kconfigs/Kconfig.mirror +++ b/kconfigs/Kconfig.mirror @@ -464,5 +464,9 @@ config MIRROR_BLKTESTS_URL string default "https://github.com/osandov/blktests.git" +config MIRROR_XFSPROGS_URL + string + default DEFAULT_XFSPROGS_URL + endif # ENABLE_LOCAL_LINUX_MIRROR endif # TERRAFORM diff --git a/playbooks/linux-mirror.yml b/playbooks/linux-mirror.yml new file mode 100644 index 000000000000..0808ebc1df80 --- /dev/null +++ b/playbooks/linux-mirror.yml @@ -0,0 +1,4 @@ +--- +- hosts: localhost + roles: + - role: linux-mirror diff --git a/playbooks/roles/linux-mirror/README.md b/playbooks/roles/linux-mirror/README.md new file mode 100644 index 000000000000..64df3566b48f --- /dev/null +++ b/playbooks/roles/linux-mirror/README.md @@ -0,0 +1,9 @@ +linux_mirror +============ + +This lets us get us install git mirrors for our nodes. + +License +------- + +copyleft-next diff --git a/playbooks/roles/linux-mirror/defaults/main.yml b/playbooks/roles/linux-mirror/defaults/main.yml new file mode 100644 index 000000000000..19ae271e4edc --- /dev/null +++ b/playbooks/roles/linux-mirror/defaults/main.yml @@ -0,0 +1,5 @@ +# SPDX-License-Identifier copyleft-next-0.3.1 +--- +mirror_user_system_dir: "~/.config/systemd/user/" +install_linux_mirror: False +defaults_xfsprogs_git: "https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git" diff --git a/playbooks/roles/linux-mirror/python/gen-mirror-files.py b/playbooks/roles/linux-mirror/python/gen-mirror-files.py new file mode 100755 index 000000000000..d1096994e206 --- /dev/null +++ b/playbooks/roles/linux-mirror/python/gen-mirror-files.py @@ -0,0 +1,149 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: copyleft-next-0.3.1 +# +# Generates mirror systemd service and timer files + +import argparse +import yaml +import json +import sys +import pprint +import subprocess +import time +import os +from pathlib import Path + +topdir = os.environ.get('TOPDIR', '.') +yaml_dir = topdir + "/playbooks/roles/linux-mirror/linux-mirror-systemd/" +default_mirrors_yaml = yaml_dir + 'mirrors.yaml' + +service_template = """[Unit] +Description={short_name} mirror [{target}] +Documentation=man:git(1) +ConditionPathExists=/mirror/{target} + +[Service] +Type=oneshot +ExecStartPre=/usr/bin/git -C /mirror/{target} remote update --prune +ExecStart=/usr/bin/git -C /mirror/{target} fetch --tags --prune +ExecStartPost=/usr/bin/git -C /mirror/{target} fetch origin +refs/heads/*:refs/heads/* + +[Install] +WantedBy=multi-user.target +""" + +timer_template = """[Unit] +Description={short_name} mirror query timer [{target}] +ConditionPathExists=/mirror/{target} + +[Timer] +OnBootSec={refresh_on_boot} +OnUnitInactiveSec={refresh} + +[Install] +WantedBy=default.target +""" + +def main(): + parser = argparse.ArgumentParser(description='gen-mirror-files') + parser.add_argument('--yaml-mirror', metavar='', type=str, + default=default_mirrors_yaml, + help='The yaml mirror input file.') + parser.add_argument('--verbose', const=True, default=False, action="store_const", + help='Be verbose on otput.') + parser.add_argument('--refresh', metavar='', type=str, + default='360m', + help='How often to update the git tree.') + parser.add_argument('--refresh-on-boot', metavar='', type=str, + default='10m', + help='How long to wait on boot to update the git tree.') + args = parser.parse_args() + + if not os.path.isfile(args.yaml_mirror): + sys.stdout.write("%s does not exist\n" % (yaml_mirror)) + sys.exit(1) + + # load the yaml input file + with open(f'{args.yaml_mirror}') as stream: + yaml_vars = yaml.safe_load(stream) + + if yaml_vars.get('mirrors') is None: + raise Exception(f"Missing mirrors descriptions on %s" % + (args.yaml_mirror)) + + if (args.verbose): + sys.stdout.write("Yaml mirror input: %s\n\n" % args.yaml_mirror) + + total = 0 + for mirror in yaml_vars['mirrors']: + total = total + 1 + + if mirror.get('short_name') is None: + raise Exception(f"Missing required short_name on mirror item #%d on file: %s" % (total, args.yaml_mirror)) + if mirror.get('url') is None: + raise Exception(f"Missing required url on mirror item #%d on file: %s" % (total, args.yaml_mirror)) + if mirror.get('target') is None: + raise Exception(f"Missing required target on mirror item #%d on file: %s" % (total, args.yaml_mirror)) + + short_name = mirror['short_name'] + url = mirror['url'] + target = mirror['target'] + + service_file = f"{yaml_dir}" + short_name + "-mirror" + ".service" + timer_file = f"{yaml_dir}" + short_name + "-mirror" + ".timer" + + refresh = args.refresh + if mirror.get('refresh'): + refresh = mirror.get('refresh') + refresh_on_boot = args.refresh_on_boot + if mirror.get('refresh_on_boot'): + refresh = mirror.get('refresh_on_boot') + + if (args.verbose): + sys.stdout.write("Mirror #%d\n" % total) + sys.stdout.write("\tshort_name: %s\n" % (mirror['short_name'])) + sys.stdout.write("\turl: %s\n" % (mirror['short_name'])) + sys.stdout.write("\ttarget: %s\n" % (mirror['short_name'])) + sys.stdout.write("\tservice: %s\n" % (service_file)) + sys.stdout.write("\ttimer: %s\n" % (timer_file)) + sys.stdout.write("\trefresh: %s\n" % (refresh)) + sys.stdout.write("\trefresh_on_boot: %s\n" % (refresh_on_boot)) + + if os.path.exists(service_file): + if (args.verbose): + sys.stdout.write("\toverwrite_service: True\n") + os.remove(service_file) + else: + if (args.verbose): + sys.stdout.write("\toverwrite_service: False\n") + + output_service = open(service_file, 'w') + context = { + "short_name" : short_name, + "url" : url, + "target" : target, + } + output_service.write(service_template.format(**context)) + output_service.close() + + if os.path.exists(timer_file): + if (args.verbose): + sys.stdout.write("\toverwrite_timer: True\n") + os.remove(timer_file) + else: + if (args.verbose): + sys.stdout.write("\toverwrite_timer: False\n") + + output_timer = open(timer_file, 'w') + context = { + "short_name" : short_name, + "url" : url, + "target" : target, + "refresh" : refresh, + "refresh_on_boot" : refresh_on_boot, + } + output_timer.write(timer_template.format(**context)) + output_timer.close() + +if __name__ == "__main__": + main() diff --git a/playbooks/roles/linux-mirror/python/start-mirroring.py b/playbooks/roles/linux-mirror/python/start-mirroring.py new file mode 100755 index 000000000000..d7cb746f5bc0 --- /dev/null +++ b/playbooks/roles/linux-mirror/python/start-mirroring.py @@ -0,0 +1,110 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: copyleft-next-0.3.1 +# +# Start mirroring based on mirrors.yaml file + +import argparse +import yaml +import json +import sys +import pprint +import subprocess +import time +import os +from pathlib import Path +import subprocess + +topdir = os.environ.get('TOPDIR', '.') +yaml_dir = topdir + "/playbooks/roles/linux-mirror/linux-mirror-systemd/" +default_mirrors_yaml = yaml_dir + 'mirrors.yaml' + +mirror_path = '/mirror/' + +def main(): + parser = argparse.ArgumentParser(description='start-mirroring') + parser.add_argument('--yaml-mirror', metavar='', type=str, + default=default_mirrors_yaml, + help='The yaml mirror input file.') + parser.add_argument('--verbose', const=True, default=False, action="store_const", + help='Be verbose on otput.') + args = parser.parse_args() + + if not os.path.isfile(args.yaml_mirror): + sys.stdout.write("%s does not exist\n" % (yaml_mirror)) + sys.exit(1) + + # load the yaml input file + with open(f'{args.yaml_mirror}') as stream: + yaml_vars = yaml.safe_load(stream) + + if yaml_vars.get('mirrors') is None: + raise Exception(f"Missing mirrors descriptions on %s" % + (args.yaml_mirror)) + + if (args.verbose): + sys.stdout.write("Yaml mirror input: %s\n\n" % args.yaml_mirror) + + total = 0 + for mirror in yaml_vars['mirrors']: + total = total + 1 + + if mirror.get('short_name') is None: + raise Exception(f"Missing required short_name on mirror item #%d on file: %s" % (total, args.yaml_mirror)) + if mirror.get('url') is None: + raise Exception(f"Missing required url on mirror item #%d on file: %s" % (total, args.yaml_mirror)) + if mirror.get('target') is None: + raise Exception(f"Missing required target on mirror item #%d on file: %s" % (total, args.yaml_mirror)) + + short_name = mirror['short_name'] + url = mirror['url'] + target = mirror['target'] + reference = None + reference_args = [] + + if mirror.get('reference'): + reference = mirror.get('reference') + reference_args = [ '--reference', reference ] + + if (args.verbose): + sys.stdout.write("Mirror #%d\n" % total) + sys.stdout.write("\tshort_name: %s\n" % (short_name)) + sys.stdout.write("\turl: %s\n" % (url)) + sys.stdout.write("\ttarget: %s\n" % (url)) + if reference is None: + sys.stdout.write("\treference: %s\n" % ("None")) + else: + sys.stdout.write("\treference: %s\n" % (reference)) + cmd = [ + 'git', + '-C', + mirror_path, + 'clone', + '--verbose', + '--progress', + '--mirror', + url, + target ] + cmd = cmd + reference_args + mirror_target = mirror_path + target + if os.path.isdir(mirror_target): + continue + sys.stdout.write("Mirroring: %s onto %s\n" % (short_name, mirror_target)) + if (args.verbose): + sys.stdout.write("%s\n" % (cmd)) + sys.stdout.write("%s\n" % (" ".join(cmd))) + process = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + close_fds=True, + universal_newlines=True) + try: + data = process.communicate(timeout=12000) + except subprocess.TimeoutExpired: + return "Timeout" + else: + process.wait() + if process.returncode != 0: + raise Exception(f"Failed clone with:\n%s" % (" ".join(cmd))) + +if __name__ == "__main__": + main() diff --git a/playbooks/roles/linux-mirror/tasks/main.yml b/playbooks/roles/linux-mirror/tasks/main.yml new file mode 100644 index 000000000000..461e131c93fd --- /dev/null +++ b/playbooks/roles/linux-mirror/tasks/main.yml @@ -0,0 +1,91 @@ +--- +- name: Import optional extra_args file + include_vars: "{{ item }}" + ignore_errors: yes + with_first_found: + - files: + - "../extra_vars.yml" + - "../extra_vars.yaml" + - "../extra_vars.json" + skip: true + tags: vars + +- name: Set up the mirrors.yaml based on preferences configured + tags: [ 'mirror' ] + template: + src: "mirrors.yaml.j2" + dest: "{{ topdir_path }}/playbooks/roles/linux-mirror/linux-mirror-systemd/mirrors.yaml" + force: yes + trim_blocks: True + lstrip_blocks: True + when: + - install_linux_mirror|bool + +- name: Start mirroring + delegate_to: localhost + run_once: true + shell: | + set -o pipefail + {{ role_path }}/python/start-mirroring.py --verbose + args: + executable: /bin/bash + chdir: "{{ topdir_path }}" + when: + - install_linux_mirror|bool + +- name: Generate systemd service and timer unit files + delegate_to: localhost + run_once: true + shell: | + set -o pipefail + {{ role_path }}/python/gen-mirror-files.py --refresh 360m --refresh-on-boot 10m + args: + executable: /bin/bash + chdir: "{{ topdir_path }}" + when: + - install_linux_mirror|bool + +- name: load variables from yaml file + include_vars: + file: "{{ topdir_path }}/playbooks/roles/linux-mirror/linux-mirror-systemd/mirrors.yaml" + name: mirrors + +- name: Copy systemd service file to user systemd dir + copy: + src: "{{ topdir_path }}/playbooks/roles/linux-mirror/linux-mirror-systemd/{{ item.short_name}}-mirror.service" + dest: "{{ mirror_user_system_dir }}/" + with_items: + - "{{ mirrors.get('mirrors') }}" + loop_control: + label: "Installing {{ item.short_name}}-mirror.service user serice unit ..." + +- name: Copy systemd timer file to user systemd dir + copy: + src: "{{ topdir_path }}/playbooks/roles/linux-mirror/linux-mirror-systemd/{{ item.short_name}}-mirror.timer" + dest: "{{ mirror_user_system_dir }}/" + with_items: + - "{{ mirrors.get('mirrors') }}" + loop_control: + label: "Installing {{ item.short_name}}-mirror.service user unit ..." + +- name: Enable systemd unit for mirror services + ansible.builtin.systemd_service: + name: "{{ item.short_name}}-mirror.service" + state: started + enabled: true + scope: user + with_items: + - "{{ mirrors.get('mirrors') }}" + loop_control: + label: "Enabling {{ item.short_name}}-mirror.service unit ..." + +- name: Enable systemd unit for mirror timers + ansible.builtin.systemd_service: + name: "{{ item.short_name }}-mirror.timer" + state: started + enabled: true + scope: user + with_items: + - "{{ mirrors.get('mirrors') }}" + loop_control: + label: "Enabling {{ item.short_name}}-mirror.timer unit ..." diff --git a/playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 b/playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 new file mode 100644 index 000000000000..7151873783d0 --- /dev/null +++ b/playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 @@ -0,0 +1,4 @@ +mirrors: + - short_name: "xfsprogs" + url: "{{ defaults_xfsprogs_git }}" + target: "xfsprogs-dev.git" diff --git a/workflows/fstests/xfs/Kconfig b/workflows/fstests/xfs/Kconfig index 28fe44eb98f9..b638d1097656 100644 --- a/workflows/fstests/xfs/Kconfig +++ b/workflows/fstests/xfs/Kconfig @@ -35,9 +35,16 @@ config FSTESTS_XFS_BUILD_CUSTOM_XFSPROGS help Enable this option to build and install a custom version of Xfsprogs. +config HAVE_MIRROR_XFSPROGS + bool + depends on USE_LIBVIRT_MIRROR + default $(shell, scripts/check_mirror_present.sh /mirror/xfsprogs-dev.git) + config FSTESTS_XFS_XFSPROGS_GIT string "The Xfsprogs git tree to clone" - default "https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git" + default DEFAULT_XFSPROGS_URL if !HAVE_MIRROR_XFSPROGS + default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/xfsprogs-dev.git) if HAVE_MIRROR_XFSPROGS && VAGRANT + default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/xfsprogs-dev.git) if HAVE_MIRROR_XFSPROGS && GUESTFS depends on FSTESTS_XFS_BUILD_CUSTOM_XFSPROGS help The Xfsprogs git tree to clone -- 2.43.0