Skip to contentSkip to conversation

mirrors: enhance and add tons of mirrors

PATCH In review Luis Chamberlain 2 participants 22 messages Mar 30, 2024 – Apr 3, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

cover mirrors: enhance and add tons of mirrors

If you are stuck in a world where you don't have much data for your downloads you have only one option: mirror everything. So the motivation for this is the exand the existing mirror support on kdevops to mirror more things other than just the kernel and qemu. We now can mirror *everything* we clone including kdevops itself.

We also enhance this all so that we can *use* the mirrors by *default* if you have them and you are using local virtualization. We differentiate between vagrant and guestfs.

Towards the end this just simplifies the process by adding a yaml file for the mirrors so that we can ingest them and process that with a few python scripts. The last commits demonstrate how easy it is now to add new mirrors.

There's only few mirrors left to add but we can do that next week.

Luis Chamberlain (18):
linux-mirror: add kdevops mirroring support Makefile.min_deps: add netcat as a min binary dependency
provision: generalize bridge-ip further
mirrors: add guestfs mirror options without 9p
mirrors: enable kdevops mirror
mirrors: add fstests to mirrors
fstests: use local primary fstests mirror if present
mirrors: add kdevops git alternative for fstests
mirrors: use kdevops fstests mirror when available
mirrors: add blktests mirror
mirrors: use blktests mirror when its available
mirrors: increase scope of mirroring in output
mirrors: move status check
mirrors: move mirror editing into one file
mirrors: add new mirrors.yaml and add xfsprogs
mirrors: add xfsdump mirror and use it
mirrors: add dbench git
mirrors: add blktrace mirror and use it

 .gitignore                                    |   5 +
 Kconfig                                       |   1 +
 Makefile                                      |   2 -
 Makefile.linux-mirror                         |  55 ++-----
 Makefile.min_deps                             |   1 +
 kconfigs/Kconfig.ansible_provisioning         |   4 +-
 kconfigs/Kconfig.defaults                     |  18 +++
 kconfigs/Kconfig.guestfs                      |   6 -
 kconfigs/Kconfig.mirror                       | 115 +++++++++++++-
 kconfigs/workflows/Kconfig.shared             |  11 +-
 playbooks/linux-mirror.yml                    |   4 +
 playbooks/roles/blktests/defaults/main.yml    |   1 +
 playbooks/roles/blktests/tasks/main.yml       |   2 +-
 playbooks/roles/fstests/defaults/main.yml     |   2 +
 .../tasks/install-deps/debian/main.yml        |   2 +-
 playbooks/roles/linux-mirror/README.md        |   9 ++
 .../roles/linux-mirror/defaults/main.yml      |   8 +
 .../linux-mirror-systemd/Makefile             |  62 +++++++-
 .../blktests-mirror.service                   |  13 ++
 .../blktests-mirror.timer                     |  11 ++
 .../fstests-mirror.service                    |  13 ++
 .../linux-mirror-systemd/fstests-mirror.timer |  11 ++
 .../kdevops-fstests-mirror.service            |  13 ++
 .../kdevops-fstests-mirror.timer              |  11 ++
 .../kdevops-mirror.service                    |  13 ++
 .../linux-mirror-systemd/kdevops-mirror.timer |  10 ++
 .../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    |  13 ++
 scripts/append-makefile-vars.sh               |  10 ++
 scripts/check_mirror_present.sh               |  11 ++
 scripts/get-distro-default-bridge.sh          |  15 ++
 scripts/get-distro-prefix.sh                  |  18 +++
 scripts/provision.Makefile                    |  12 ++
 workflows/blktests/Kconfig                    |  29 +++-
 workflows/blktests/Makefile                   |   1 +
 workflows/fstests/Kconfig                     |  20 ++-
 workflows/fstests/Makefile.xfs                |   2 +
 workflows/fstests/xfs/Kconfig                 |  20 ++-
 workflows/linux/Kconfig.linus                 |   3 +-
 workflows/linux/Kconfig.mcgrof                |   2 +
 workflows/linux/Kconfig.next                  |   3 +-
 workflows/linux/Kconfig.stable                |   3 +-
 44 files changed, 852 insertions(+), 63 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 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/blktests-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/blktests-mirror.timer
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/fstests-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/fstests-mirror.timer
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-fstests-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-fstests-mirror.timer
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-mirror.timer
 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
 create mode 100755 scripts/append-makefile-vars.sh
 create mode 100755 scripts/check_mirror_present.sh
 create mode 100755 scripts/get-distro-default-bridge.sh
 create mode 100755 scripts/get-distro-prefix.sh
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/18 linux-mirror: add kdevops mirroring support

We use kdevops git trees even on each guest, instead of cloning on github.com use the local mirror once and keep the mirror up to date every 5 minutes.

---
 Makefile.linux-mirror                         |  5 +--
 kconfigs/Kconfig.mirror                       | 32 +++++++++++++++++++
 .../linux-mirror-systemd/Makefile             | 10 ++++++
 .../kdevops-mirror.service                    | 13 ++++++++
 .../linux-mirror-systemd/kdevops-mirror.timer | 10 ++++++
 5 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-mirror.timer
Makefile.linux-mirror +3 -2
index 245aa34cb4ca..762e53562493 100644
@@ -46,8 +46,8 @@ LOCALHOST_SETUP_WORK += mirror
 
 mirror-help-menu:
 	@echo "Mirror options:"
-	@echo "mirror		- sets up systemd mirrors (Linux & QEMU)"
-	@echo "mirror-status	- checks systemd mirrors status (Linux & QEMU)"
+	@echo "mirror		- sets up systemd mirrors"
+	@echo "mirror-status	- checks systemd mirrors status"
 	@echo ""
 
 HELP_TARGETS += mirror-help-menu
@@ -60,3 +60,4 @@ export MCGROF		:= $(subst ",,$(CONFIG_MIRROR_MCGROF_URL))
 export MCGROF_LINUS	:= $(subst ",,$(CONFIG_MIRROR_MCGROF_LINUS_URL))
 export QEMU		:= $(subst ",,$(CONFIG_MIRROR_QEMU_URL))
 export QEMU_JIC23	:= $(subst ",,$(CONFIG_MIRROR_QEMU_JIC23_URL))
+export KDEVOPS		:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_URL))
kconfigs/Kconfig.mirror +32 -0
index 3f0b15859319..0cdce1566a8b 100644
@@ -34,6 +34,7 @@ config INSTALL_LOCAL_LINUX_MIRROR
 	  to keep these properly updated. The repositories will be placed
 	  into /mirror/ directory:
 
+	  Kernel development trees:
 	    /mirror/linux.git
 	    /mirror/linux-stable.git
 	    /mirror/linux-next.git
@@ -41,6 +42,9 @@ config INSTALL_LOCAL_LINUX_MIRROR
 	    /mirror/mcgrof-next.git
 	    /mirror/mcgrof-linus.git
 
+	  kdevops specific trees and kdevops git alternatives:
+	    /mirror/kdevops.git
+
 	  Enabling this even if you already have the repositories does nothing
 	  so it is safe to keep this enabled even after your first linux-mirror
 	  setup. You can however safely also disable this option after your
@@ -51,6 +55,34 @@ config MIRROR_GIT_WORKS
 	bool
 	default $(shell, ./scripts/test_git_firewall.sh)
 
+choice
+	prompt "kdevops mirror source"
+	default MIRROR_KDEVOPS_HTTPS_GITHUB
+	depends on INSTALL_LOCAL_LINUX_MIRROR
+
+config MIRROR_KDEVOPS_HTTPS_GITHUB
+	bool "HTTPS (github)"
+	help
+	  If you enable this option then Github HTTPS will be used as the
+	  source of the mirror. The URL is:
+
+	  https://github.com/linux-kdevops/kdevops.git
+
+config MIRROR_KDEVOPS_HTTPS_GITLAB
+	bool "HTTPS (GitLab)"
+	help
+	  If you enable this option then GitLab HTTPS will be used as the
+	  source of the mirror. The URL is:
+
+	  https://gitlab.com/linux-kdevops/kdevops.git
+
+endchoice
+
+config MIRROR_KDEVOPS_URL
+	string
+	default "https://github.com/linux-kdevops/kdevops.git" if MIRROR_KDEVOPS_HTTPS_GITHUB
+	default "https://gitlab.com/linux-kdevops/kdevops.git" if MIRROR_KDEVOPS_HTTPS_GITLAB
+
 choice
 	prompt "Linux mirror protocol"
 	default MIRROR_TORVALDS_GIT if MIRROR_GIT_WORKS
playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +10 -0
index 2bccada39cfc..5568d870c6bc 100644
@@ -15,6 +15,9 @@ LINUX_TIMERS += kdevops-linus-mirror.timer
 LINUX_TIMERS += mcgrof-next-mirror.timer
 LINUX_TIMERS += mcgrof-linus-mirror.timer
 
+KDEVOPS_SERVICES  := kdevops-mirror.service
+KDEVOPS_TIMERS := kdevops-mirror.timer
+
 QEMU_SERVICES  := qemu-mirror.service
 QEMU_SERVICES  += qemu-jic23-mirror.service
 QEMU_TIMERS    := qemu-mirror.timer
@@ -32,12 +35,15 @@ MCGROF_TARGET_LINUS	:= $(MIRROR_PATH)/mcgrof-linus.git
 MCGROF_TARGET		:= $(MIRROR_PATH)/mcgrof-next.git
 QEMU_TARGET     	:= $(MIRROR_PATH)/qemu.git
 QEMU_JIC23_TARGET	:= $(MIRROR_PATH)/qemu-jic23.git
+KDEVOPS_TARGET		:= $(MIRROR_PATH)/kdevops.git
 
 MIRROR_SERVICES := $(LINUX_SERVICES)
 MIRROR_SERVICES += $(QEMU_SERVICES)
+MIRROR_SERVICES += $(KDEVOPS_SERVICES)
 
 MIRROR_TIMERS   := $(LINUX_TIMERS)
 MIRROR_TIMERS   += $(QEMU_TIMERS)
+MIRROR_TIMERS   += $(KDEVOPS_TIMERS)
 
 ifeq ($(V),1)
 export Q=
@@ -96,6 +102,10 @@ mirror:
 	  echo "          CLONE qemu-project/jic23-qemu" ;\
 	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(QEMU_JIC23) --reference /mirror/qemu.git $(QEMU_JIC23_TARGET) ;\
 	fi
+	$(Q)if [ ! -d $(KDEVOPS_TARGET) ]; then \
+	  echo "          CLONE linux-kdevops/kdevops" ;\
+	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(KDEVOPS) $(KDEVOPS_TARGET) ;\
+	fi
 
 install:
 	$(Q)mkdir -p $(USER_SYSTEM)
playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-mirror.service new file +13 -0
new file mode 100644
index 000000000000..9cc1efdc892b
@@ -0,0 +1,13 @@
+[Unit]
+Description=kdevops mirror [qemu.git]
+Documentation=man:git(1)
+ConditionPathExists=/mirror/kdevops.git
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/bin/git -C /mirror/kdevops.git remote update --prune
+ExecStart=/usr/bin/git -C /mirror/kdevops.git fetch --tags --prune
+ExecStartPost=/usr/bin/git -C /mirror/kdevops.git fetch origin +refs/heads/*:refs/heads/*
+
+[Install]
+WantedBy=multi-user.target
playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-mirror.timer new file +10 -0
new file mode 100644
index 000000000000..9138bc7494bc
@@ -0,0 +1,10 @@
+[Unit]
+Description=kdevops mirror query timer [kdevops.git]
+ConditionPathExists=/mirror/qemu.git
+
+[Timer]
+OnBootSec=5m
+OnUnitInactiveSec=10m
+
+[Install]
+WantedBy=default.target
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/18 Makefile.min_deps: add netcat as a min binary dependency

In reply to Luis Chamberlain

we use nc to check if your firewall allows git access on the script ./scripts/test_git_firewall.sh for MIRROR_GIT_WORKS if you enable ENABLE_LOCAL_LINUX_MIRROR.

---
 Makefile.min_deps | 1 +
 1 file changed, 1 insertion(+)
Makefile.min_deps +1 -0
index 93d4af6b91e6..9d8f205799c4 100644
@@ -8,6 +8,7 @@
 BINARY_DEPS :=
 BINARY_DEPS += sudo
 BINARY_DEPS += make
+BINARY_DEPS += nc
 BINARY_DEPS += ansible-playbook
 
 BINARY_DEPS_VCHECKS := $(subst $(TOPDIR)/,,$(wildcard $(TOPDIR)/scripts/version_check/*))
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/18 provision: generalize bridge-ip further

In reply to Luis Chamberlain

We only provide the bridge IP on Kconfig if we're using vagrant or guestfs, and we wrap some kconfig logic around this. We want to expand on this and use the default bridge IP for mirroring as well, so that we don't phone home to the internet when we have a git tree for local trees. Today we only use git trees for the large trees for the Linux kernel and qemu but we want to expand on that, and add all of the mirrors a node fetches to a locall mirror.

To enable more wide spread use of the bridge IP we need to just make it available on Makefiles, so we can take advantage of the fact that although kconfig does not let us append variables for example we can't use "default $(foo)/$(bar)" we *can* as the shell to append scripts for us, we just need to promote the variables we need to shell.

We provide a simple scripts/append-makefile-vars.sh to make emphasis that you need these variables on Makefiles so you can use them on Kconfig.

With the bridge IP for all worlds defined we can now grow its use later for allowing us to extend how we use bridging using the git protocol on the local network. We'll address this next.

This makes no functional changes, it just let's us later use the bridge IP variables on shell Kconfig magic.

---
 kconfigs/Kconfig.ansible_provisioning |  4 ++--
 kconfigs/Kconfig.guestfs              |  6 ------
 scripts/append-makefile-vars.sh       | 10 ++++++++++
 scripts/get-distro-default-bridge.sh  | 15 +++++++++++++++
 scripts/get-distro-prefix.sh          | 18 ++++++++++++++++++
 scripts/provision.Makefile            | 12 ++++++++++++
 6 files changed, 57 insertions(+), 8 deletions(-)
 create mode 100755 scripts/append-makefile-vars.sh
 create mode 100755 scripts/get-distro-default-bridge.sh
 create mode 100755 scripts/get-distro-prefix.sh
kconfigs/Kconfig.ansible_provisioning +2 -2
index e56f869c16cd..82a6f822c3f5 100644
@@ -194,8 +194,8 @@ config DEVCONFIG_SYSTEMD_JOURNAL_USE_HTTP
 
 config DEVCONFIG_SYSTEMD_JOURNAL_REMOTE_URL
 	string "systemd-remote URL"
-	default "http://192.168.124.1" if VAGRANT
-	default GUESTFS_DEFAULT_BRIDGE_IP if GUESTFS
+	default $(shell, scripts/append-makefile-vars.sh http:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT)) if VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh http:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS)) if GUESTFS
 	help
           This is used for the client /etc/systemd/journal-upload.conf URL line.
           By default we won't use SSL for now. If you should make sure the
kconfigs/Kconfig.guestfs +0 -6
index 377f3434a892..03e0fb865a66 100644
@@ -1,11 +1,5 @@
 if GUESTFS
 
-config GUESTFS_DEFAULT_BRIDGE_IP
-       string
-       default "http://192.168.122.1" if DISTRO_FEDORA || DISTRO_REDHAT
-       default "http://192.168.122.1" if DISTRO_OPENSUSE || DISTRO_SUSE
-       default "http://192.168.122.1" if DISTRO_DEBIAN || DISTRO_UBUNTU
-
 choice
 	prompt "Guestfs Linux distribution to use"
 	default GUESTFS_FEDORA if DISTRO_FEDORA || DISTRO_REDHAT
scripts/append-makefile-vars.sh new file +10 -0
new file mode 100755
index 000000000000..2148399ae31f
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+STR=""
+
+while [[ ${#1} -gt 0 ]]; do
+	STR="${STR}${1}"
+	shift
+done
+
+echo $STR
scripts/get-distro-default-bridge.sh new file +15 -0
new file mode 100755
index 000000000000..09d09ff04ee1
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+DISTRO=$1
+VIRT_TYPE=$2
+
+# We currently ignore the distro because as far as we're concerned
+# they all use the default IP, the only thing that differiantes it
+# is if you are using vagrant or guestfs. If your distribution needs
+# a different deafult it should be easy for you to extend it here.
+
+if [[ "$VIRT_TYPE" == "vagrant" ]]; then
+	echo "http://192.168.124.1"
+else
+	echo "192.168.122.1"
+fi
scripts/get-distro-prefix.sh new file +18 -0
new file mode 100755
index 000000000000..519be5a5a97c
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+DEFAULT_DISTRO="debian"
+DISTROS="debian"
+DISTROS="$DISTROS fedora"
+DISTROS="$DISTROS opensuse"
+DISTROS="$DISTROS redhat"
+DISTROS="$DISTROS suse"
+DISTROS="$DISTROS ubuntu"
+
+for i in $DISTROS; do
+	if [[ "./scripts/os-release-check.sh $i" == "y" ]]; then
+		echo $i
+		exit
+	fi
+done
+
+echo $DEFAULT_DISTRO
scripts/provision.Makefile +12 -0
index 7bd4115bdb7a..26657c0974f2 100644
@@ -31,6 +31,18 @@ KDEVOPS_PROVISIONED_DEVCONFIG := .provisioned_once_devconfig
 KDEVOPS_BRING_UP_DEPS :=
 KDEVOPS_DESTROY_DEPS :=
 
+# This is currently used when vitualization is enabled so to allow us to
+# allow guests to use the bridge ip for mirroring git trees but the general idea
+# could be extended to support cloud later. For example perhaps this could be
+# a third guest which we can instantiate later. This would be useful for things
+# like systemd-remote as well.
+#
+# We export this into Makefiles so that we can use them both on Makefiles and
+# on Kconfig files with environment variables such as $(FOO)
+export KDEVOPS_DEFAULT_DISTRO			:= $(shell $(TOPDIR)/scripts/get-distro-prefix.sh)
+export KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT	:= $(shell $(TOPDIR)/scripts/get-distro-default-bridge.sh $(KDEVOPS_DEFAULT_DISTRO) vagrant)
+export KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS	:= $(shell $(TOPDIR)/scripts/get-distro-default-bridge.sh $(KDEVOPS_DEFAULT_DISTRO) guestfs)
+
 # These go last
 KDEVOPS_BRING_UP_LATE_DEPS :=
 
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/18 mirrors: add guestfs mirror options without 9p

In reply to Luis Chamberlain

When 9p is disabled git cloning using mirroring needs to rely on the bridge IP which is different on guestfs than on vagrant. Add the proper bridge IP this case.

Note that most users use 9p, so this just fixes the mirroring option when 9p is disabled.

---
 workflows/linux/Kconfig.linus  | 3 ++-
 workflows/linux/Kconfig.mcgrof | 2 ++
 workflows/linux/Kconfig.next   | 3 ++-
 workflows/linux/Kconfig.stable | 3 ++-
 4 files changed, 8 insertions(+), 3 deletions(-)
workflows/linux/Kconfig.linus +2 -1
index 5c524e5266ae..14d3e0c0f360 100644
@@ -69,7 +69,8 @@ config BOOTLINUX_TREE_LINUS_NAME
 config BOOTLINUX_TREE_LINUS_URL
 	string
 	default "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" if !USE_LOCAL_LINUX_MIRROR
-	default "git://192.168.124.1/mirror/linux.git" if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/linux.git) if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/linux.git) if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && GUESTFS
 	default "/mirror/linux.git" if USE_LIBVIRT_MIRROR && BOOTLINUX_9P
 
 endif # BOOTLINUX_TREE_LINUS
workflows/linux/Kconfig.mcgrof +2 -0
index 4c4be5b72aff..f2d2f898234f 100644
@@ -65,5 +65,7 @@ config BOOTLINUX_MCGROF_TREE_URL
 	default "/mirror/mcgrof-next.git" if BOOTLINUX_TREE_MCGROF_NEXT && USE_LIBVIRT_MIRROR && BOOTLINUX_9P
 	default "https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git" if BOOTLINUX_TREE_MCGROF_LINUS && !USE_LOCAL_LINUX_MIRROR
 	default "/mirror/mcgrof-linus.git" if BOOTLINUX_TREE_MCGROF_LINUS && USE_LIBVIRT_MIRROR && BOOTLINUX_9P
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/mcgrof-linus.git) if BOOTLINUX_TREE_MCGROF_LINUS && USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/mcgrof-next.git) if BOOTLINUX_TREE_MCGROF_NEXT && USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && GUESTFS
 
 endif # BOOTLINUX_TREE_MCGROF_LINUS || BOOTLINUX_TREE_MCGROF_NEXT
workflows/linux/Kconfig.next +2 -1
index 48c86e3dbc08..6fdb53077aa7 100644
@@ -11,7 +11,8 @@ config BOOTLINUX_TREE_NEXT_NAME
 config BOOTLINUX_TREE_NEXT_URL
 	string
 	default "https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git" if !USE_LOCAL_LINUX_MIRROR
-	default "git://192.168.124.1/mirror/linux-next.git" if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/linux-next.git) if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/linux-next.git) if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && GUESTFS
 	default "/mirror/linux-next.git" if USE_LIBVIRT_MIRROR && BOOTLINUX_9P
 
 endif # BOOTLINUX_TREE_NEXT
workflows/linux/Kconfig.stable +2 -1
index 39c1984a0630..a0eaa1bffadf 100644
@@ -85,7 +85,8 @@ config BOOTLINUX_TREE_STABLE_NAME
 config BOOTLINUX_TREE_STABLE_URL
 	string
 	default "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git" if !USE_LOCAL_LINUX_MIRROR
-	default "git://192.168.124.1/mirror/linux-stable.git" if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/linux-stable.git) if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/linux-stable.git) if USE_LIBVIRT_MIRROR && !BOOTLINUX_9P && GUESTFS
 	default "/mirror/linux-stable.git" if USE_LIBVIRT_MIRROR && BOOTLINUX_9P
 
 endif # BOOTLINUX_STABLE
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/18 mirrors: enable kdevops mirror

In reply to Luis Chamberlain

We recently added support for mirroring kdevops but didn't enable it yet as we needed some more work, the work to get the bridge IP in a clean way. Now that previous commits did the work for that enable the mirror to be used, but only if we detect that the local server has a copy of that mirror. The reason we check for the mirror is that prior mirroring attempts may have been made with older versions of kdevops and they would not have set up the kdevops mirror yet. We therefore only enable the kdevops mirror to be used if and only if the localhost has it present.

This is going to save us tons of bandiwdth, as each guest when testing filesystems was git cloning kdevops and kdevops already is about over 200 MiB.

---
 kconfigs/workflows/Kconfig.shared | 11 +++++++++--
 scripts/check_mirror_present.sh   | 11 +++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100755 scripts/check_mirror_present.sh
kconfigs/workflows/Kconfig.shared +9 -2
index c4aab329e7b1..029eaa4383db 100644
@@ -75,11 +75,18 @@ endif # WORKFLOW_KDEVOPS_GIT_CUSTOM
 
 if !WORKFLOW_KDEVOPS_GIT_CUSTOM
 
+config HAVE_MIRROR_KDEVOPS
+	bool
+	depends on USE_LIBVIRT_MIRROR
+	default $(shell, scripts/check_mirror_present.sh /mirror/kdevops.git)
+
 config WORKFLOW_KDEVOPS_GIT
 	string
 	default "https://github.com/linux-kdevops/kdevops.git" if !GIT_ALTERNATIVES && !HAVE_CUSTOM_KDEVOPS_GIT
-	default "https://github.com/linux-kdevops/kdevops.git" if GIT_LINUX_KDEVOPS_GITHUB
-	default "https://gitlab.com/linux-kdevops/kdevops.git" if GIT_LINUX_KDEVOPS_GITLAB
+	default "https://github.com/linux-kdevops/kdevops.git" if GIT_LINUX_KDEVOPS_GITHUB && !HAVE_MIRROR_KDEVOPS
+	default "https://gitlab.com/linux-kdevops/kdevops.git" if GIT_LINUX_KDEVOPS_GITLAB && !HAVE_MIRROR_KDEVOPS
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/kdevops.git) if HAVE_MIRROR_KDEVOPS && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/kdevops.git) if HAVE_MIRROR_KDEVOPS && GUESTFS
 	help
 	  Some workflows want to also clone a version of kdevops on each target.
 	  An example of this is when using the fstests workflow, which carries
scripts/check_mirror_present.sh new file +11 -0
new file mode 100755
index 000000000000..b99c7048c12e
@@ -0,0 +1,11 @@
+#!/bin/bash
+# SPDX-License-Identifier: copyleft-next-0.3.1
+
+MIRROR_PATH="$1"
+
+if [[ -d $MIRROR_PATH ]]; then
+	echo y
+	exit
+fi
+
+echo n
Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/18 mirrors: add fstests to mirrors

In reply to Luis Chamberlain

The fstests workflow relies on fstests, so mirror that as well. This is the first general tool we are mirroring, we will make of use of it next in the subsequent patch. We update this tree every 6 hours.

---
 Makefile.linux-mirror                         |  1 +
 kconfigs/Kconfig.mirror                       | 44 ++++++++++++++++++-
 .../linux-mirror-systemd/Makefile             | 10 +++++
 .../fstests-mirror.service                    | 13 ++++++
 .../linux-mirror-systemd/fstests-mirror.timer | 11 +++++
 5 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/fstests-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/fstests-mirror.timer
Makefile.linux-mirror +1 -0
index 762e53562493..d6b0c848eaeb 100644
@@ -61,3 +61,4 @@ export MCGROF_LINUS	:= $(subst ",,$(CONFIG_MIRROR_MCGROF_LINUS_URL))
 export QEMU		:= $(subst ",,$(CONFIG_MIRROR_QEMU_URL))
 export QEMU_JIC23	:= $(subst ",,$(CONFIG_MIRROR_QEMU_JIC23_URL))
 export KDEVOPS		:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_URL))
+export FSTESTS		:= $(subst ",,$(CONFIG_MIRROR_FSTESTS_URL))
kconfigs/Kconfig.mirror +43 -1

54 lines not on this page · raw message

playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +10 -0
index 5568d870c6bc..7de8cc4e326d 100644
@@ -18,6 +18,9 @@ LINUX_TIMERS += mcgrof-linus-mirror.timer
 KDEVOPS_SERVICES  := kdevops-mirror.service
 KDEVOPS_TIMERS := kdevops-mirror.timer
 
+TOOLS_SERVICES  := fstests-mirror.service
+TOOLS_TIMERS := fstests-mirror.timer
+
 QEMU_SERVICES  := qemu-mirror.service
 QEMU_SERVICES  += qemu-jic23-mirror.service
 QEMU_TIMERS    := qemu-mirror.timer
@@ -36,14 +39,17 @@ MCGROF_TARGET		:= $(MIRROR_PATH)/mcgrof-next.git
 QEMU_TARGET     	:= $(MIRROR_PATH)/qemu.git
 QEMU_JIC23_TARGET	:= $(MIRROR_PATH)/qemu-jic23.git
 KDEVOPS_TARGET		:= $(MIRROR_PATH)/kdevops.git
+FSTESTS_TARGET		:= $(MIRROR_PATH)/fstests.git
 
 MIRROR_SERVICES := $(LINUX_SERVICES)
 MIRROR_SERVICES += $(QEMU_SERVICES)
 MIRROR_SERVICES += $(KDEVOPS_SERVICES)
+MIRROR_SERVICES += $(TOOLS_SERVICES)
 
 MIRROR_TIMERS   := $(LINUX_TIMERS)
 MIRROR_TIMERS   += $(QEMU_TIMERS)
 MIRROR_TIMERS   += $(KDEVOPS_TIMERS)
+MIRROR_TIMERS   += $(TOOLS_TIMERS)
 
 ifeq ($(V),1)
 export Q=
@@ -106,6 +112,10 @@ mirror:
 	  echo "          CLONE linux-kdevops/kdevops" ;\
 	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(KDEVOPS) $(KDEVOPS_TARGET) ;\
 	fi
+	$(Q)if [ ! -d $(FSTESTS_TARGET) ]; then \
+	  echo "          CLONE fstests" ;\
+	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(FSTESTS) $(FSTESTS_TARGET) ;\
+	fi
 
 install:
 	$(Q)mkdir -p $(USER_SYSTEM)
playbooks/roles/linux-mirror/linux-mirror-systemd/fstests-mirror.service new file +13 -0
new file mode 100644
index 000000000000..31ce3e7552e9
@@ -0,0 +1,13 @@
+[Unit]
+Description=fstests mirror [fstests.git]
+Documentation=man:git(1)
+ConditionPathExists=/mirror/fstests.git
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/bin/git -C /mirror/fstests.git remote update --prune
+ExecStart=/usr/bin/git -C /mirror/fstests.git fetch --tags --prune
+ExecStartPost=/usr/bin/git -C /mirror/fstests.git fetch origin +refs/heads/*:refs/heads/*
+
+[Install]
+WantedBy=multi-user.target
playbooks/roles/linux-mirror/linux-mirror-systemd/fstests-mirror.timer new file +11 -0
new file mode 100644
index 000000000000..0a69f2f55897
@@ -0,0 +1,11 @@
+[Unit]
+Description=fstests mirror query timer [fstests.git]
+ConditionPathExists=/mirror/fstests.git
+
+[Timer]
+OnBootSec=10m
+# Every 6 hours
+OnUnitInactiveSec=360m
+
+[Install]
+WantedBy=default.target
Signature · 1 line
2.43.0
#7 lore raw

PATCH 7/18 fstests: use local primary fstests mirror if present

In reply to Luis Chamberlain

There are two ways to use tools:

a) primary upstream
b) alternatives

The b) alternatives were implemented in kdeovps using CONFIG_GIT_ALTERNATIVES so to allow us to enable reproducible build environments, letting you keep forks of the primary source tree.

In practice for fstest that means kdevops has its own fstests git tree under the kdevops organization, in case that is desirable. That is actually the default, so to avoid issues with using the latest upstream fstests tree.

This change is when you use a) the primary upstream tree. So when you disable CONFIG_GIT_ALTERNATIVES, we now end up using the local mirror if you have it present:

grep fstests_git extra_vars.yaml
fstests_git: git://192.168.122.1/mirror/fstests.git

Note that today's default is with CONFIG_GIT_ALTERNATIVES enabled. We'll be addressing this later after we first add mirroring support for kdevops's own fork of fstests.

---
 workflows/fstests/Kconfig | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
workflows/fstests/Kconfig +8 -1
index d65df7f0ecfa..4b22be71c805 100644
@@ -275,9 +275,16 @@ endmenu
 
 endif # FSTESTS_TMPFS
 
+config HAVE_MIRROR_FSTESTS
+	bool
+	depends on USE_LIBVIRT_MIRROR
+	default $(shell, scripts/check_mirror_present.sh /mirror/fstests.git)
+
 config FSTESTS_GIT
 	string "The fstests git tree to clone"
-	default "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git" if !GIT_ALTERNATIVES
+	default "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git" if !GIT_ALTERNATIVES && !HAVE_MIRROR_FSTESTS
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/fstests.git) if !GIT_ALTERNATIVES && HAVE_MIRROR_FSTESTS && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/fstests.git) if !GIT_ALTERNATIVES && HAVE_MIRROR_FSTESTS && GUESTFS
 	default "https://github.com/linux-kdevops/fstests.git" if GIT_LINUX_KDEVOPS_GITHUB
 	default "https://gitlab.com/linux-kdevops/fstests.git" if GIT_LINUX_KDEVOPS_GITLAB
 	default "https://github.com/btrfs/fstests.git" if FSTESTS_BTRFS
Signature · 1 line
2.43.0
#8 lore raw

PATCH 8/18 mirrors: add kdevops git alternative for fstests

In reply to Luis Chamberlain

kdevops supports its own CONFIG_GIT_ALTERNATIVES which allows kdevops to mirror upstream projects on its own organization, so that our own fork can host patches which perhaps have not landed upstream on fstests yet, and also to ensure reproducible workflows. If we follow upstream, the branch may be a moving target and sometimes thigns may work sometimes things will not. For deatils refer to our Kconfig documentation of GIT_ALTERNATIVES.

This now mirrors the fstests kdevops git alternatives. We will place these mirrored alternatives under a directory representing the alternative source, in this case its kdevops, /mirror/kdevops/fstest.git. Note that we have an alternative for fstests for btrfs but this doesn't yet properly pronounce itself as an alternative itself, its was just caked in as another option. We should fix that so that we can also mirror btrfs's fstests and be able to easily use it.

Now with today's defaults you will end up using mirroring for both kdevops and fstests when you enable the fstests workflow if a mirror was found for each one on your system:

grep git extra_vars.yaml | grep git
kdevops_git: git://192.168.122.1/mirror/kdevops.git
kdevops_git_version: HEAD
fstests_git: git://192.168.122.1/mirror/kdevops/fstests.git
fstests_git_version: HEAD

It is important to use --reference here as the kdevops fork and so can share objects on the server with the fstests tree. If you add support for a tree which is a fork, do the same.

---
 Makefile.linux-mirror                         |  1 +
 kconfigs/Kconfig.mirror                       | 30 +++++++++++++++++++
 .../linux-mirror-systemd/Makefile             |  7 +++++
 .../kdevops-fstests-mirror.service            | 13 ++++++++
 .../kdevops-fstests-mirror.timer              | 11 +++++++
 5 files changed, 62 insertions(+)
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-fstests-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-fstests-mirror.timer
Makefile.linux-mirror +1 -0
index d6b0c848eaeb..f6cc1b447eb8 100644
@@ -62,3 +62,4 @@ export QEMU		:= $(subst ",,$(CONFIG_MIRROR_QEMU_URL))
 export QEMU_JIC23	:= $(subst ",,$(CONFIG_MIRROR_QEMU_JIC23_URL))
 export KDEVOPS		:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_URL))
 export FSTESTS		:= $(subst ",,$(CONFIG_MIRROR_FSTESTS_URL))
+export KDEVOPS_FSTESTS	:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_FSTESTS_URL))
kconfigs/Kconfig.mirror +30 -0
index fa5ec8c1333f..076d5d117984 100644
@@ -44,6 +44,7 @@ config INSTALL_LOCAL_LINUX_MIRROR
 
 	  kdevops specific trees and kdevops git alternatives:
 	    /mirror/kdevops.git
+	    /mirror/kdevops/fstests.git
 
 	  Tools:
 	    /mirror/fstests.git
@@ -429,5 +430,34 @@ config MIRROR_FSTESTS_URL
 	default "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git" if MIRROR_FSTESTS_HTTPS
 	default "https://kernel.googlesource.com/pub/scm/fs/xfs/xfstests-dev.git" if MIRROR_FSTESTS_HTTPS_GOOGLE
 
+choice
+	prompt "Tools - kdevops/fstests.git mirror protocol/source"
+	default MIRROR_KDEVOPS_FSTESTS_HTTPS_GITHUB
+	default MIRROR_KDEOVPS_FSTESTS_HTTPS_GITLAB
+	depends on INSTALL_LOCAL_LINUX_MIRROR
+
+config MIRROR_KDEVOPS_FSTESTS_HTTPS_GITHUB
+	bool "HTTPS (GitHub)"
+	help
+	  If you enable this option then GitHub HTTPS will be used as the
+	  source of the mirror. The URL is:
+
+	  https://github.com/linux-kdevops/fstests.git
+
+config MIRROR_KDEVOPS_FSTESTS_HTTPS_GITLAB
+	bool "HTTPS (GitLab)"
+	help
+	  If you enable this option then GitLab HTTPS will be used as the
+	  source of the mirror. The URL is:
+
+	  https://gitlab.com/linux-kdevops/fstests.git
+
+endchoice
+
+config MIRROR_KDEVOPS_FSTESTS_URL
+	string
+	default "https://github.com/linux-kdevops/fstests.git" if MIRROR_KDEVOPS_FSTESTS_HTTPS_GITHUB
+	default "https://gitlab.com/linux-kdevops/fstests.git" if MIRROR_KDEVOPS_FSTESTS_HTTPS_GITLAB
+
 endif # ENABLE_LOCAL_LINUX_MIRROR
 endif # TERRAFORM
playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +7 -0
index 7de8cc4e326d..4a69ee7ca88f 100644
@@ -19,7 +19,9 @@ KDEVOPS_SERVICES  := kdevops-mirror.service
 KDEVOPS_TIMERS := kdevops-mirror.timer
 
 TOOLS_SERVICES  := fstests-mirror.service
+TOOLS_SERVICES  += kdevops-fstests-mirror.service
 TOOLS_TIMERS := fstests-mirror.timer
+TOOLS_TIMERS += kdevops-fstests-mirror.timer
 
 QEMU_SERVICES  := qemu-mirror.service
 QEMU_SERVICES  += qemu-jic23-mirror.service
@@ -40,6 +42,7 @@ QEMU_TARGET     	:= $(MIRROR_PATH)/qemu.git
 QEMU_JIC23_TARGET	:= $(MIRROR_PATH)/qemu-jic23.git
 KDEVOPS_TARGET		:= $(MIRROR_PATH)/kdevops.git
 FSTESTS_TARGET		:= $(MIRROR_PATH)/fstests.git
+KDEVOPS_FSTESTS_TARGET	:= $(MIRROR_PATH)/kdevops/fstests.git
 
 MIRROR_SERVICES := $(LINUX_SERVICES)
 MIRROR_SERVICES += $(QEMU_SERVICES)
@@ -116,6 +119,10 @@ mirror:
 	  echo "          CLONE fstests" ;\
 	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(FSTESTS) $(FSTESTS_TARGET) ;\
 	fi
+	$(Q)if [ ! -d $(KDEVOPS_FSTESTS_TARGET) ]; then \
+	  echo "          CLONE kdevops-fstests" ;\
+	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(KDEVOPS_FSTESTS) --reference $(FSTESTS_TARGET) $(KDEVOPS_FSTESTS_TARGET) ;\
+	fi
 
 install:
 	$(Q)mkdir -p $(USER_SYSTEM)
playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-fstests-mirror.service new file +13 -0
new file mode 100644
index 000000000000..822a62548937
@@ -0,0 +1,13 @@
+[Unit]
+Description=kdevops-fstests mirror [kdevops/fstests.git]
+Documentation=man:git(1)
+ConditionPathExists=/mirror/kdevops/fstests.git
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/bin/git -C /mirror/kdevops/fstests.git remote update --prune
+ExecStart=/usr/bin/git -C /mirror/kdevops/fstests.git fetch --tags --prune
+ExecStartPost=/usr/bin/git -C /mirror/kdevops/fstests.git fetch origin +refs/heads/*:refs/heads/*
+
+[Install]
+WantedBy=multi-user.target
playbooks/roles/linux-mirror/linux-mirror-systemd/kdevops-fstests-mirror.timer new file +11 -0
new file mode 100644
index 000000000000..4ec7a794b488
@@ -0,0 +1,11 @@
+[Unit]
+Description=kdevops fstests mirror query timer [kdevops/fstests.git]
+ConditionPathExists=/mirror/kdevops/fstests.git
+
+[Timer]
+OnBootSec=10m
+# Every 6 hours
+OnUnitInactiveSec=360m
+
+[Install]
+WantedBy=default.target
Signature · 1 line
2.43.0
#9 lore raw

PATCH 9/18 mirrors: use kdevops fstests mirror when available

In reply to Luis Chamberlain

This now extends support to use the kdevops specific mirror of fstests if its present.

Now, with today's defaults you will end up using mirroring for both kdevops and fstests when you enable the fstests workflow if a mirror was found for each one on your system:

grep git extra_vars.yaml | grep git
kdevops_git: git://192.168.122.1/mirror/kdevops.git
kdevops_git_version: HEAD
fstests_git: git://192.168.122.1/mirror/kdevops/fstests.git
fstests_git_version: HEAD

---
 workflows/fstests/Kconfig | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
workflows/fstests/Kconfig +9 -2
index 4b22be71c805..c797b2491d5a 100644
@@ -280,13 +280,20 @@ config HAVE_MIRROR_FSTESTS
 	depends on USE_LIBVIRT_MIRROR
 	default $(shell, scripts/check_mirror_present.sh /mirror/fstests.git)
 
+config HAVE_MIRROR_KDEVOPS_FSTESTS
+	bool
+	depends on USE_LIBVIRT_MIRROR
+	default $(shell, scripts/check_mirror_present.sh /mirror/kdevops/fstests.git)
+
 config FSTESTS_GIT
 	string "The fstests git tree to clone"
 	default "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git" if !GIT_ALTERNATIVES && !HAVE_MIRROR_FSTESTS
 	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/fstests.git) if !GIT_ALTERNATIVES && HAVE_MIRROR_FSTESTS && VAGRANT
 	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/fstests.git) if !GIT_ALTERNATIVES && HAVE_MIRROR_FSTESTS && GUESTFS
-	default "https://github.com/linux-kdevops/fstests.git" if GIT_LINUX_KDEVOPS_GITHUB
-	default "https://gitlab.com/linux-kdevops/fstests.git" if GIT_LINUX_KDEVOPS_GITLAB
+	default "https://github.com/linux-kdevops/fstests.git" if GIT_LINUX_KDEVOPS_GITHUB && !HAVE_MIRROR_KDEVOPS_FSTESTS
+	default "https://gitlab.com/linux-kdevops/fstests.git" if GIT_LINUX_KDEVOPS_GITLAB && !HAVE_MIRROR_KDEVOPS_FSTESTS
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/kdevops/fstests.git) if GIT_ALTERNATIVES && HAVE_MIRROR_FSTESTS && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/kdevops/fstests.git) if GIT_ALTERNATIVES && HAVE_MIRROR_FSTESTS && GUESTFS
 	default "https://github.com/btrfs/fstests.git" if FSTESTS_BTRFS
 	help
 	  The fstests git tree to clone.
Signature · 1 line
2.43.0
#10 lore raw

PATCH 10/18 mirrors: add blktests mirror

In reply to Luis Chamberlain

This adds mirroring for blktests. Only Omar's tree exists, which means a new mirror is desirable in the future.

---
 Makefile.linux-mirror                               |  1 +
 kconfigs/Kconfig.mirror                             |  5 +++++
 .../linux-mirror/linux-mirror-systemd/Makefile      |  7 +++++++
 .../linux-mirror-systemd/blktests-mirror.service    | 13 +++++++++++++
 .../linux-mirror-systemd/blktests-mirror.timer      | 11 +++++++++++
 5 files changed, 37 insertions(+)
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/blktests-mirror.service
 create mode 100644 playbooks/roles/linux-mirror/linux-mirror-systemd/blktests-mirror.timer
Makefile.linux-mirror +1 -0
index f6cc1b447eb8..ebaf505a7627 100644
@@ -63,3 +63,4 @@ export QEMU_JIC23	:= $(subst ",,$(CONFIG_MIRROR_QEMU_JIC23_URL))
 export KDEVOPS		:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_URL))
 export FSTESTS		:= $(subst ",,$(CONFIG_MIRROR_FSTESTS_URL))
 export KDEVOPS_FSTESTS	:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_FSTESTS_URL))
+export BLKTESTS		:= $(subst ",,$(CONFIG_MIRROR_BLKTESTS_URL))
kconfigs/Kconfig.mirror +5 -0
index 076d5d117984..7e17d59a605c 100644
@@ -48,6 +48,7 @@ config INSTALL_LOCAL_LINUX_MIRROR
 
 	  Tools:
 	    /mirror/fstests.git
+	    /mirror/blktests.git
 
 	  Enabling this even if you already have the repositories does nothing
 	  so it is safe to keep this enabled even after your first linux-mirror
@@ -459,5 +460,9 @@ config MIRROR_KDEVOPS_FSTESTS_URL
 	default "https://github.com/linux-kdevops/fstests.git" if MIRROR_KDEVOPS_FSTESTS_HTTPS_GITHUB
 	default "https://gitlab.com/linux-kdevops/fstests.git" if MIRROR_KDEVOPS_FSTESTS_HTTPS_GITLAB
 
+config MIRROR_BLKTESTS_URL
+	string
+	default "https://github.com/osandov/blktests.git"
+
 endif # ENABLE_LOCAL_LINUX_MIRROR
 endif # TERRAFORM
playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +7 -0
index 4a69ee7ca88f..9e03ebd04c97 100644
@@ -20,8 +20,10 @@ KDEVOPS_TIMERS := kdevops-mirror.timer
 
 TOOLS_SERVICES  := fstests-mirror.service
 TOOLS_SERVICES  += kdevops-fstests-mirror.service
+TOOLS_SERVICES  += blktests-mirror.service
 TOOLS_TIMERS := fstests-mirror.timer
 TOOLS_TIMERS += kdevops-fstests-mirror.timer
+TOOLS_TIMERS += blktests-mirror.timer
 
 QEMU_SERVICES  := qemu-mirror.service
 QEMU_SERVICES  += qemu-jic23-mirror.service
@@ -43,6 +45,7 @@ QEMU_JIC23_TARGET	:= $(MIRROR_PATH)/qemu-jic23.git
 KDEVOPS_TARGET		:= $(MIRROR_PATH)/kdevops.git
 FSTESTS_TARGET		:= $(MIRROR_PATH)/fstests.git
 KDEVOPS_FSTESTS_TARGET	:= $(MIRROR_PATH)/kdevops/fstests.git
+BLKTESTS_TARGET		:= $(MIRROR_PATH)/blktests.git
 
 MIRROR_SERVICES := $(LINUX_SERVICES)
 MIRROR_SERVICES += $(QEMU_SERVICES)
@@ -123,6 +126,10 @@ mirror:
 	  echo "          CLONE kdevops-fstests" ;\
 	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(KDEVOPS_FSTESTS) --reference $(FSTESTS_TARGET) $(KDEVOPS_FSTESTS_TARGET) ;\
 	fi
+	$(Q)if [ ! -d $(BLKTESTS_TARGET) ]; then \
+	  echo "          CLONE blktests" ;\
+	  git -C $(MIRROR_PATH) clone $(GIT_VERBOSE) --progress --mirror $(BLKTESTS) $(BLKTESTS_TARGET) ;\
+	fi
 
 install:
 	$(Q)mkdir -p $(USER_SYSTEM)
playbooks/roles/linux-mirror/linux-mirror-systemd/blktests-mirror.service new file +13 -0
new file mode 100644
index 000000000000..9e1f82ed32db
@@ -0,0 +1,13 @@
+[Unit]
+Description=blktests mirror [blktest.git]
+Documentation=man:git(1)
+ConditionPathExists=/mirror/blktests.git
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/bin/git -C /mirror/blktests.git remote update --prune
+ExecStart=/usr/bin/git -C /mirror/blktests.git fetch --tags --prune
+ExecStartPost=/usr/bin/git -C /mirror/blktests.git fetch origin +refs/heads/*:refs/heads/*
+
+[Install]
+WantedBy=multi-user.target
playbooks/roles/linux-mirror/linux-mirror-systemd/blktests-mirror.timer new file +11 -0
new file mode 100644
index 000000000000..ef2bfb1ecdba
@@ -0,0 +1,11 @@
+[Unit]
+Description=blktests mirror query timer blktests.git]
+ConditionPathExists=/mirror/blktests.git
+
+[Timer]
+OnBootSec=10m
+# Every 6 hours
+OnUnitInactiveSec=360m
+
+[Install]
+WantedBy=default.target
Signature · 1 line
2.43.0
#11 lore raw

PATCH 11/18 mirrors: use blktests mirror when its available

In reply to Luis Chamberlain

There isn't any blktests mirror out there yet, and we also don't even have a form of it on kdevops since it is a rather slow moving target compared to fstests and does not break as often. So mirroring for it is pretty straight forward, and the only difference is the IP address betwen the bridge for vagrant and guestfs. Enable the mirror if the localhost is detected to use mirroring.

After enabling the blktests workflow and running make we end up with:

grep blktests_git extra_vars.yaml
blktests_git: git://192.168.122.1/mirror/blktests.git

---
 workflows/blktests/Kconfig | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
workflows/blktests/Kconfig +8 -1
index ed0057378ba7..2be13de90a76 100644
@@ -127,9 +127,16 @@ config BLKTESTS_WATCHDOG_RESET_HUNG_SYSTEMS
 
 endif # BLKTESTS_WATCHDOG
 
+config HAVE_MIRROR_BLKTESTS
+	bool
+	depends on USE_LIBVIRT_MIRROR
+	default $(shell, scripts/check_mirror_present.sh /mirror/blktests.git)
+
 config BLKTESTS_GIT
 	string "The blktests git tree to clone"
-	default "https://github.com/osandov/blktests.git"
+	default "https://github.com/osandov/blktests.git" if !HAVE_MIRROR_BLKTESTS
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/blktests.git) if HAVE_MIRROR_BLKTESTS && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/blktests.git) if HAVE_MIRROR_BLKTESTS && GUESTFS
 	help
 	  The blktests git tree to clone.
 
Signature · 1 line
2.43.0
#12 lore raw

PATCH 12/18 mirrors: increase scope of mirroring in output

In reply to Luis Chamberlain

Clarify that we are mirroring more than just Linux and qemu now.

---
 Makefile.linux-mirror                                      | 2 +-
 playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile.linux-mirror +1 -1
index ebaf505a7627..3968acecb98e 100644
@@ -19,7 +19,7 @@ MIRROR_CODE      := $(TOPDIR)/playbooks/roles/linux-mirror/linux-mirror-systemd/
 
 # Since we don't support varabiliity yet, for now we keep it very simple:
 mirror: $(KDEVOPS_EXTRA_VARS)
-	$(NQ) Setting up Linux and QEMU systemd mirrors on localhost
+	$(Q)echo Setting up all mirrors on localhost
 	$(Q)make -C $(MIRROR_CODE) mirror
 	$(Q)make -C $(MIRROR_CODE) install
 
playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +1 -1
index 9e03ebd04c97..b773c0a2e70a 100644
@@ -72,7 +72,7 @@ endif
 all: help
 
 help:
-	$(NQ) "mirror:     git clone all mirrors about Linux and QEMU"
+	$(NQ) "mirror:     git clone all mirrors"
 	$(NQ) "install:    install system timers and git-daemon socket activation"
 
 mirror:
Signature · 1 line
2.43.0
#13 lore raw

PATCH 13/18 mirrors: move status check

In reply to Luis Chamberlain

Move most of the 'make mirror-status' work onto the makefile which already has most of the timer and services already so we can just use the variables there.

---
 Makefile.linux-mirror                               | 13 +------------
 .../linux-mirror/linux-mirror-systemd/Makefile      |  8 ++++++++
 2 files changed, 9 insertions(+), 12 deletions(-)
Makefile.linux-mirror +1 -12
index 3968acecb98e..40532eb0e477 100644
@@ -26,18 +26,7 @@ mirror: $(KDEVOPS_EXTRA_VARS)
 PHONY += mirror
 
 mirror-status: $(KDEVOPS_EXTRA_VARS)
-	$(NQ) systemd timer units list
-	$(Q)systemctl --user list-timers
-	$(NQ) systemd timer status
-	$(Q)systemctl status --user linux-mirror.timer linux-stable-mirror.timer \
-		linux-next-mirror.timer mcgrof-next-mirror.timer \
-		kdevops-linus-mirror.timer \
-		qemu-mirror.timer jic23-qemu-mirror.timer
-	$(NQ) systemd service units status
-	$(Q)systemctl status --user linux-mirror.service linux-stable-mirror.service \
-		kdevops-linus-mirror.service \
-		linux-next-mirror.service mcgrof-next-mirror.service \
-		qemu-mirror.service jic23-qemu-mirror.timer
+	$(Q)make -C $(MIRROR_CODE) status
 
 PHONY += mirror-status
 
playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +8 -0
index b773c0a2e70a..367ffdc526df 100644
@@ -149,3 +149,11 @@ install:
 	$(Q)sudo cp $(GIT_DAEMON_FILES) $(LOCAL_SYSTEMD)
 	$(Q)sudo systemctl enable git-daemon.socket
 	$(Q)sudo systemctl start git-daemon.socket
+
+status:
+	$(NQ) systemd timer units list
+	$(Q)systemctl --user list-timers
+	$(NQ) systemd timer status
+	$(Q)systemctl status --user $(MIRROR_TIMERS)
+	$(NQ) systemd service units status
+	$(Q)systemctl status --user $(MIRROR_SERVICES)
Signature · 1 line
2.43.0
#14 lore raw

PATCH 14/18 mirrors: move mirror editing into one file

In reply to Luis Chamberlain

When we add a mirror we edit two Makefiles, reduce this to just one. To do this we must ensure we can include .config on it, use the full path to make that work.

---
 Makefile.linux-mirror                          | 13 -------------
 .../linux-mirror/linux-mirror-systemd/Makefile | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 13 deletions(-)
Makefile.linux-mirror +0 -13
index 40532eb0e477..c355c4a0ea98 100644
@@ -40,16 +40,3 @@ mirror-help-menu:
 	@echo ""
 
 HELP_TARGETS += mirror-help-menu
-
-export TORVALDS		:= $(subst ",,$(CONFIG_MIRROR_TORVALDS_URL))
-export STABLE		:= $(subst ",,$(CONFIG_MIRROR_STABLE_URL))
-export NEXT		:= $(subst ",,$(CONFIG_MIRROR_NEXT_URL))
-export KDEVOPS_LINUS	:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_LINUS_URL))
-export MCGROF		:= $(subst ",,$(CONFIG_MIRROR_MCGROF_URL))
-export MCGROF_LINUS	:= $(subst ",,$(CONFIG_MIRROR_MCGROF_LINUS_URL))
-export QEMU		:= $(subst ",,$(CONFIG_MIRROR_QEMU_URL))
-export QEMU_JIC23	:= $(subst ",,$(CONFIG_MIRROR_QEMU_JIC23_URL))
-export KDEVOPS		:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_URL))
-export FSTESTS		:= $(subst ",,$(CONFIG_MIRROR_FSTESTS_URL))
-export KDEVOPS_FSTESTS	:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_FSTESTS_URL))
-export BLKTESTS		:= $(subst ",,$(CONFIG_MIRROR_BLKTESTS_URL))
playbooks/roles/linux-mirror/linux-mirror-systemd/Makefile +18 -0
index 367ffdc526df..61b0c5195bc9 100644
@@ -1,6 +1,24 @@
 USER_SYSTEM := ~/.config/systemd/user/
 MIRROR_PATH := /mirror
 
+ifeq (,$(wildcard $(TOPDIR_PATH)/.config))
+else
+include $(TOPDIR_PATH)/.config
+endif
+
+export TORVALDS		:= $(subst ",,$(CONFIG_MIRROR_TORVALDS_URL))
+export STABLE		:= $(subst ",,$(CONFIG_MIRROR_STABLE_URL))
+export NEXT		:= $(subst ",,$(CONFIG_MIRROR_NEXT_URL))
+export KDEVOPS_LINUS	:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_LINUS_URL))
+export MCGROF		:= $(subst ",,$(CONFIG_MIRROR_MCGROF_URL))
+export MCGROF_LINUS	:= $(subst ",,$(CONFIG_MIRROR_MCGROF_LINUS_URL))
+export QEMU		:= $(subst ",,$(CONFIG_MIRROR_QEMU_URL))
+export QEMU_JIC23	:= $(subst ",,$(CONFIG_MIRROR_QEMU_JIC23_URL))
+export KDEVOPS		:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_URL))
+export FSTESTS		:= $(subst ",,$(CONFIG_MIRROR_FSTESTS_URL))
+export KDEVOPS_FSTESTS	:= $(subst ",,$(CONFIG_MIRROR_KDEVOPS_FSTESTS_URL))
+export BLKTESTS		:= $(subst ",,$(CONFIG_MIRROR_BLKTESTS_URL))
+
 LINUX_SERVICES := linux-mirror.service
 LINUX_SERVICES += linux-stable-mirror.service
 LINUX_SERVICES += linux-next-mirror.service
Signature · 1 line
2.43.0
#15 lore raw

PATCH 15/18 mirrors: add new mirrors.yaml and add xfsprogs

In reply to 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.

---
 .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
.gitignore +5 -0
index ef5d5983ed13..af7d08a66d28 100644
@@ -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
Kconfig +1 -0
index 292f66e7e1a6..dab26fcc351a 100644
@@ -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"
Makefile +0 -2
index 5b8e1a22d872..cd4e639a4b01 100644
@@ -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
Makefile.linux-mirror +12 -14
index c355c4a0ea98..d9515353f77b 100644
@@ -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
kconfigs/Kconfig.defaults new file +3 -0
new file mode 100644
index 000000000000..ba5d6a3a78d6
@@ -0,0 +1,3 @@
+config DEFAULT_XFSPROGS_URL
+	string
+	default "https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git"
kconfigs/Kconfig.mirror +4 -0
index 7e17d59a605c..66f75cdd2c89 100644
@@ -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
playbooks/linux-mirror.yml new file +4 -0
new file mode 100644
index 000000000000..0808ebc1df80
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+  roles:
+    - role: linux-mirror
playbooks/roles/linux-mirror/README.md new file +9 -0
new file mode 100644
index 000000000000..64df3566b48f
@@ -0,0 +1,9 @@
+linux_mirror
+============
+
+This lets us get us install git mirrors for our nodes.
+
+License
+-------
+
+copyleft-next
playbooks/roles/linux-mirror/defaults/main.yml new file +5 -0
new file mode 100644
index 000000000000..19ae271e4edc
@@ -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"
playbooks/roles/linux-mirror/python/gen-mirror-files.py new file +149 -0

149 lines not on this page · raw message

playbooks/roles/linux-mirror/python/start-mirroring.py new file +110 -0

110 lines not on this page · raw message

playbooks/roles/linux-mirror/tasks/main.yml new file +91 -0

91 lines not on this page · raw message

playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 new file +4 -0
new file mode 100644
index 000000000000..7151873783d0
@@ -0,0 +1,4 @@
+mirrors:
+  - short_name: "xfsprogs"
+    url: "{{ defaults_xfsprogs_git }}"
+    target: "xfsprogs-dev.git"
workflows/fstests/xfs/Kconfig +8 -1
index 28fe44eb98f9..b638d1097656 100644
@@ -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
Signature · 1 line
2.43.0
#16 lore raw

PATCH 16/18 mirrors: add xfsdump mirror and use it

In reply to Luis Chamberlain

Now that we have an easy way to support mirrors, let's just add xfsdump in one shot and enable it too.

Note: only debian uses this git tree.

We check that we get the right URL when XFS is enabled and the mirror has been cloned:

grep dump extra_vars.yaml
fstests_xsfsdump_git: git://192.168.122.1/mirror/xfsdump-dev.git

---
 Makefile.linux-mirror                                 |  1 +
 kconfigs/Kconfig.defaults                             |  7 +++++++
 playbooks/roles/fstests/defaults/main.yml             |  2 ++
 .../roles/fstests/tasks/install-deps/debian/main.yml  |  2 +-
 playbooks/roles/linux-mirror/defaults/main.yml        |  1 +
 .../roles/linux-mirror/templates/mirrors.yaml.j2      |  3 +++
 workflows/fstests/Makefile.xfs                        |  2 ++
 workflows/fstests/xfs/Kconfig                         | 11 +++++++++++
 8 files changed, 28 insertions(+), 1 deletion(-)
Makefile.linux-mirror +1 -0
index d9515353f77b..67bb463da53e 100644
@@ -4,6 +4,7 @@ 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))'
+LINUX_MIRROR_ARGS += defaults_xfsdump_git='$(subst ",,$(CONFIG_DEFAULT_XFSDUMP_URL))'
 
 MIRROR_CODE      := $(TOPDIR)/playbooks/roles/linux-mirror/linux-mirror-systemd/
 
kconfigs/Kconfig.defaults +7 -0
index ba5d6a3a78d6..e559f28f964d 100644
@@ -1,3 +1,10 @@
+# Please keep in alphabetical order
+
+config DEFAULT_XFSDUMP_URL
+	string
+	default "https://github.com/linux-kdevops/xfsdump-dev.git"
+
 config DEFAULT_XFSPROGS_URL
 	string
 	default "https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git"
+
playbooks/roles/fstests/defaults/main.yml +2 -0
index a46a4672dfa5..c3df0da2718a 100644
@@ -184,3 +184,5 @@ fstests_tmpfs_section_huge_within_size: False
 fstests_tmpfs_section_huge_advise: False
 
 devconfig_enable_systemd_journal_remote: False
+
+fstests_xsfsdump_git: "https://github.com/linux-kdevops/xfsdump-dev.git"
playbooks/roles/fstests/tasks/install-deps/debian/main.yml +1 -1
index 1b00b88cb5fd..d806cd678818 100644
@@ -94,7 +94,7 @@
 # in Debian Testing repository
 - name: git clone xfsdump
   git:
-    repo: "https://github.com/linux-kdevops/xfsdump-dev.git"
+    repo: "{{ fstests_xsfsdump_git }}"
     dest: "{{ data_path }}/xfsdump"
     update: yes
     version: v3.1.10-fixed
playbooks/roles/linux-mirror/defaults/main.yml +1 -0
index 19ae271e4edc..461f47cfedf9 100644
@@ -3,3 +3,4 @@
 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"
+defaults_xfsdump_git: "https://github.com/linux-kdevops/xfsdump-dev.git"
playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 +3 -0
index 7151873783d0..2f0267c27c7b 100644
@@ -2,3 +2,6 @@ mirrors:
   - short_name: "xfsprogs"
     url: "{{ defaults_xfsprogs_git }}"
     target: "xfsprogs-dev.git"
+  - short_name: "xfsdump"
+    url: "{{ defaults_xfsdump_git }}"
+    target: "xfsdump-dev.git"
workflows/fstests/Makefile.xfs +2 -0
index 54194f243876..542946e12f9c 100644
@@ -6,6 +6,8 @@ FSTESTS_ARGS += fstests_xfs_xfsprogs_data='$(CONFIG_FSTESTS_XFS_XFSPROGS_DATA)'
 FSTESTS_ARGS += fstests_xfs_xfsprogs_install_path='$(CONFIG_FSTESTS_XFS_XFSPROGS_INSTALL_PATH)'
 endif
 
+FSTESTS_ARGS += fstests_xsfsdump_git='$(subst ",,$(CONFIG_FSTESTS_XFSDUMP_GIT_URL))'
+
 ifeq (y,$(CONFIG_FSTESTS_XFS_QUOTA_ENABLED))
 FSTESTS_ARGS += fstests_xfs_mount_quota_opts='$(CONFIG_FSTESTS_XFS_MOUNT_QUOTA_OPTS)'
 endif
workflows/fstests/xfs/Kconfig +11 -0
index b638d1097656..9bc787f28896 100644
@@ -68,6 +68,17 @@ config FSTESTS_XFS_XFSPROGS_INSTALL_PATH
 	help
 	  Destination path to install Xfsprogs binaries
 
+config HAVE_MIRROR_XFSDUMP
+       bool
+       depends on USE_LIBVIRT_MIRROR
+       default $(shell, scripts/check_mirror_present.sh /mirror/xfsdump-dev.git)
+
+config FSTESTS_XFSDUMP_GIT_URL
+	string
+	default DEFAULT_XFSDUMP_URL if !HAVE_MIRROR_XFSDUMP
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/xfsdump-dev.git) if HAVE_MIRROR_XFSDUMP && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/xfsdump-dev.git) if HAVE_MIRROR_XFSDUMP && GUESTFS
+
 config FSTESTS_XFS_QUOTA_ENABLED
 	bool "Enable XFS quota"
 	default n
Signature · 1 line
2.43.0
#17 lore raw

PATCH 17/18 mirrors: add dbench git

In reply to Luis Chamberlain

We're actually the main source of the latest dbench so just use that.

---
 kconfigs/Kconfig.defaults                             |  4 ++++
 playbooks/roles/blktests/defaults/main.yml            |  1 +
 playbooks/roles/blktests/tasks/main.yml               |  2 +-
 playbooks/roles/linux-mirror/defaults/main.yml        |  1 +
 .../roles/linux-mirror/templates/mirrors.yaml.j2      |  3 +++
 workflows/blktests/Kconfig                            | 11 +++++++++++
 workflows/blktests/Makefile                           |  1 +
 7 files changed, 22 insertions(+), 1 deletion(-)
kconfigs/Kconfig.defaults +4 -0
index e559f28f964d..d552735bdb3b 100644
@@ -1,5 +1,9 @@
 # Please keep in alphabetical order
 
+config DEFAULT_DBENCH_URL
+	string
+	default "https://github.com/linux-kdevops/dbench.git"
+
 config DEFAULT_XFSDUMP_URL
 	string
 	default "https://github.com/linux-kdevops/xfsdump-dev.git"
playbooks/roles/blktests/defaults/main.yml +1 -0
index dd009f58b3a3..8c50bf6d8e63 100644
@@ -22,3 +22,4 @@ nbd_version: "nbd-3.21"
 nbd_data: "{{data_path}}/nbd"
 
 compile_dbench: False
+blktests_dbench_git: "https://github.com/linux-kdevops/dbench.git"
playbooks/roles/blktests/tasks/main.yml +1 -1
index fd4943b36088..590f981af0b8 100644
@@ -42,7 +42,7 @@
     name: compile_dbench
   vars:
     dbench_data: "{{ data_path }}/dbench"
-    dbench_git: "https://github.com/linux-kdevops/dbench.git"
+    dbench_git: "{{ blktests_dbench_git }}"
   tags: [ 'oscheck', 'git', 'dbench']
 
 - name: Remove any old blktrace as we always clone a fresh tree
playbooks/roles/linux-mirror/defaults/main.yml +1 -0
index 461f47cfedf9..e0788bb43c94 100644
@@ -4,3 +4,4 @@ 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"
 defaults_xfsdump_git: "https://github.com/linux-kdevops/xfsdump-dev.git"
+defaults_dbench_git: "https://github.com/linux-kdevops/dbench.git"
playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 +3 -0
index 2f0267c27c7b..0389f3d76396 100644
@@ -5,3 +5,6 @@ mirrors:
   - short_name: "xfsdump"
     url: "{{ defaults_xfsdump_git }}"
     target: "xfsdump-dev.git"
+  - short_name: "dbench"
+    url: "{{ defaults_dbench_git }}"
+    target: "dbench.git"
workflows/blktests/Kconfig +11 -0
index 2be13de90a76..05e16bcf79cd 100644
@@ -12,6 +12,17 @@ config HAVE_DISTRO_PREFERS_BLKTESTS_WATCHDOG_RESET
 	bool
 	default n
 
+config HAVE_MIRROR_DBENCH
+	bool
+	depends on USE_LIBVIRT_MIRROR
+	default $(shell, scripts/check_mirror_present.sh /mirror/dbench.git)
+
+config BLKTESTS_DBENCH_GIT_URL
+	string
+	default DEFAULT_DBENCH_URL if !HAVE_MIRROR_DBENCH
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/dbench.git) if HAVE_MIRROR_XFSDUMP && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/dbench.git) if HAVE_MIRROR_XFSDUMP && GUESTFS
+
 config BLKTESTS_WATCHDOG
 	bool "Enable kdevops blktests watchdog"
 	default y if HAVE_DISTRO_PREFERS_BLKTESTS_WATCHDOG
workflows/blktests/Makefile +1 -0
index 829694af8bd3..ac4e8c2d1831 100644
@@ -27,6 +27,7 @@ NBD_DATA:=$(subst ",,$(CONFIG_NBD_DATA))
 
 BLKTESTS_DATA_TARGET:=$(subst ",,$(CONFIG_BLKTESTS_DATA_TARGET))
 
+BLKTESTS_ARGS += blktests_dbench_git='$(subst ",,$(CONFIG_BLKTESTS_DBENCH_GIT_URL))'
 BLKTESTS_ARGS += blktests_git='$(BLKTESTS_GIT)'
 BLKTESTS_ARGS += blktests_data=\"$(BLKTESTS_DATA)\"
 
Signature · 1 line
2.43.0
#18 lore raw

PATCH 18/18 mirrors: add blktrace mirror and use it

In reply to Luis Chamberlain

Now that adding mirrors is rather easier than before add the mirror for blktrace.

---
 kconfigs/Kconfig.defaults                              | 4 ++++
 playbooks/roles/linux-mirror/defaults/main.yml         | 1 +
 playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 | 3 +++
 workflows/blktests/Kconfig                             | 9 ++++++++-
 4 files changed, 16 insertions(+), 1 deletion(-)
kconfigs/Kconfig.defaults +4 -0
index d552735bdb3b..b52ec86127d0 100644
@@ -1,5 +1,9 @@
 # Please keep in alphabetical order
 
+config DEFAULT_BLKTRACE_URL
+	string
+	default "https://git.kernel.dk/blktrace"
+
 config DEFAULT_DBENCH_URL
 	string
 	default "https://github.com/linux-kdevops/dbench.git"
playbooks/roles/linux-mirror/defaults/main.yml +1 -0
index e0788bb43c94..7c0d7bf623f2 100644
@@ -5,3 +5,4 @@ install_linux_mirror:  False
 defaults_xfsprogs_git: "https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git"
 defaults_xfsdump_git: "https://github.com/linux-kdevops/xfsdump-dev.git"
 defaults_dbench_git: "https://github.com/linux-kdevops/dbench.git"
+defaults_blktrace_git: "https://git.kernel.dk/blktrace"
playbooks/roles/linux-mirror/templates/mirrors.yaml.j2 +3 -0
index 0389f3d76396..c85700738a14 100644
@@ -8,3 +8,6 @@ mirrors:
   - short_name: "dbench"
     url: "{{ defaults_dbench_git }}"
     target: "dbench.git"
+  - short_name: "blktrace"
+    url: "{{ defaults_blktrace_git }}"
+    target: "blktrace.git"
workflows/blktests/Kconfig +8 -1
index 05e16bcf79cd..998939d137f9 100644
@@ -159,9 +159,16 @@ config BLKTESTS_DATA
 	  Note that {{data_path}} corresponds to the location set by the
 	  configuration option CONFIG_WORKFLOW_DATA_PATH.
 
+config HAVE_MIRROR_BLKTRACE
+	bool
+	depends on USE_LIBVIRT_MIRROR
+	default $(shell, scripts/check_mirror_present.sh /mirror/blktrace.git)
+
 config BLKTRACE_GIT
 	string "The blktrace git tree to clone"
-	default "https://git.kernel.dk/blktrace"
+	default DEFAULT_BLKTRACE_URL if !HAVE_MIRROR_BLKTRACE
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_VAGRANT) /mirror/blktrace.git) if HAVE_MIRROR_BLKTRACE && VAGRANT
+	default $(shell, scripts/append-makefile-vars.sh git:// $(KDEVOPS_DEFAULT_BRIDGE_IP_GUESTFS) /mirror/blktrace.git) if HAVE_MIRROR_BLKTRACE && GUESTFS
 	help
 	  The blktrace git tree to clone.
 
Signature · 1 line
2.43.0
#19 lore raw
In reply to Luis Chamberlain
Quoted 14 lines · Luis Chamberlain

If you are stuck in a world where you don't have much data for your downloads you have only one option: mirror everything. So the motivation for this is the exand the existing mirror support on kdevops to mirror more things other than just the kernel and qemu. We now can mirror *everything* we clone including kdevops itself.

We also enhance this all so that we can *use* the mirrors by *default* if you have them and you are using local virtualization. We differentiate between vagrant and guestfs.

Quoted 6 lines

Towards the end this just simplifies the process by adding a yaml file for the mirrors so that we can ingest them and process that with a few python scripts. The last commits demonstrate how easy it is now to add new mirrors.

There's only few mirrors left to add but we can do that next week.

I've just begun to browse these. Seems like a good plan to be a better netizen.

This comment falls into the category of beard-scratching, but I wonder if there's a packaged git mirror we can use instead of building our own? Just a random thought. Obviously some of these changes are good to have anyway (like the bridge IP improvements).

--
Chuck Lever

#20 lore raw
Quoted 19 lines · Chuck Lever III
Quoted 19 lines · Luis Chamberlain

If you are stuck in a world where you don't have much data for your downloads you have only one option: mirror everything. So the motivation for this is the exand the existing mirror support on kdevops to mirror more things other than just the kernel and qemu. We now can mirror *everything* we clone including kdevops itself.

We also enhance this all so that we can *use* the mirrors by *default* if you have them and you are using local virtualization. We differentiate between vagrant and guestfs.

Towards the end this just simplifies the process by adding a yaml file for the mirrors so that we can ingest them and process that with a few python scripts. The last commits demonstrate how easy it is now to add new mirrors.

Quoted 4 lines
Quoted 1 line

There's only few mirrors left to add but we can do that next week.

I've just begun to browse these. Seems like a good plan to be a better netizen.

OK merged :)

Quoted 4 lines

This comment falls into the category of beard-scratching, but I wonder if there's a packaged git mirror we can use instead of building our own? Just a random thought. Obviously some of these changes are good to have anyway (like the bridge IP improvements).

We'd have to agree on some random distro package for it. The implemention for mirroring wasn't complex, a couple of python scripts to read a yaml file, and which generate systemd unit service and timer files. The big integration is with our Kconfig logic and so I think its as slim as can be really. But if you find something we can opt-in it as an alternative via Kconfig too.

Luis

#21 lore raw
Quoted 36 lines · Luis Chamberlain
Quoted 19 lines · Chuck Lever III
Quoted 19 lines · Luis Chamberlain

If you are stuck in a world where you don't have much data for your downloads you have only one option: mirror everything. So the motivation for this is the exand the existing mirror support on kdevops to mirror more things other than just the kernel and qemu. We now can mirror *everything* we clone including kdevops itself.

We also enhance this all so that we can *use* the mirrors by *default* if you have them and you are using local virtualization. We differentiate between vagrant and guestfs.

Towards the end this just simplifies the process by adding a yaml file for the mirrors so that we can ingest them and process that with a few python scripts. The last commits demonstrate how easy it is now to add new mirrors.

Quoted 4 lines
Quoted 1 line

There's only few mirrors left to add but we can do that next week.

I've just begun to browse these. Seems like a good plan to be a better netizen.

OK merged :)

Quoted 4 lines

This comment falls into the category of beard-scratching, but I wonder if there's a packaged git mirror we can use instead of building our own? Just a random thought. Obviously some of these changes are good to have anyway (like the bridge IP improvements).

Quoted 6 lines

We'd have to agree on some random distro package for it. The implemention for mirroring wasn't complex, a couple of python scripts to read a yaml file, and which generate systemd unit service and timer files. The big integration is with our Kconfig logic and so I think its as slim as can be really. But if you find something we can opt-in it as an alternative via Kconfig too.

I don't have anything specific in mind other than not re-inventing the wheel if that would make our lives harder. But sounds like it's a small thing and not worth pulling in a packaged mirroring system.

--
Chuck Lever