diff --git a/README.md b/README.md index 28c267110..9dc01eb19 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ If you want less Red Hat repos: OPTIONS_REPOSITORY_IMPORT_FILTER=small make repos-import ``` -This will import and snapshot repos needed for the minimal viable environment. Useful for running Playwright tests. +This will import and snapshot repos needed for the initial viable environment required before running Playwright tests. ```sh make repos-minimal diff --git a/mk/repos.mk b/mk/repos.mk index 2557a8343..916bbf2f0 100644 --- a/mk/repos.mk +++ b/mk/repos.mk @@ -20,7 +20,11 @@ repos-import-rhel10: ## Import only rhel 10 repos OPTIONS_REPOSITORY_IMPORT_FILTER=rhel10 go run ./cmd/external-repos/main.go import .PHONY: repos-minimal -repos-minimal: ## Import and snapshot repos needed for a minimal setup, usefull for Playwright testing, currently: SMALL + EPEL10 +repos-minimal: ## Import and snapshot or introspect repos needed before running Playwright tests, the repos used: HARDCODED (2) + SMALL + EPEL10 + OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import + go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/appstream/os/ --force + OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import + go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/baseos/os/ --force OPTIONS_REPOSITORY_IMPORT_FILTER=small go run ./cmd/external-repos/main.go import go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel9/9/aarch64/codeready-builder/os/ --force OPTIONS_REPOSITORY_IMPORT_FILTER=epel10 go run ./cmd/external-repos/main.go import diff --git a/pkg/external_repos/snapshotted_repos/rhel10-aarch64.json b/pkg/external_repos/snapshotted_repos/rhel10-aarch64.json index af5155944..2beebf852 100644 --- a/pkg/external_repos/snapshotted_repos/rhel10-aarch64.json +++ b/pkg/external_repos/snapshotted_repos/rhel10-aarch64.json @@ -5,7 +5,7 @@ "url": "https://cdn.redhat.com/content/dist/rhel10/10/aarch64/baseos/os", "distribution_arch": "aarch64", "distribution_version": "10", - "selector": "rhel10", + "selector": "rhel10,hardcoded", "feature_name": "RHEL-OS-x86_64", "origin": "red_hat" }, @@ -15,7 +15,7 @@ "url": "https://cdn.redhat.com/content/dist/rhel10/10/aarch64/appstream/os", "distribution_arch": "aarch64", "distribution_version": "10", - "selector": "rhel10", + "selector": "rhel10,hardcoded", "feature_name": "RHEL-OS-x86_64", "origin": "red_hat" }, @@ -31,7 +31,7 @@ }, { "name": "Red Hat Enterprise Linux 10 for ARM 64 - Extensions (RPMs)", - "content_label" :"rhel-10-for-aarch64-extensions-rpms", + "content_label": "rhel-10-for-aarch64-extensions-rpms", "url": "https://cdn.redhat.com/content/dist/rhel10/10/aarch64/extensions/os", "distribution_arch": "aarch64", "distribution_version": "10", diff --git a/scripts/time_valid_repos.sh b/scripts/time_valid_repos.sh new file mode 100755 index 000000000..7f178314f --- /dev/null +++ b/scripts/time_valid_repos.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Measure how long it takes to import, and snapshot or introspect particular repositories and wait until they become valid +# Run the backend locally + +echo "------------------------------------------" +echo "Importing repos and forcing a snapshot..." +echo "------------------------------------------" + +# # original - epel10 and small +# OPTIONS_REPOSITORY_IMPORT_FILTER=small go run ./cmd/external-repos/main.go import +# go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel9/9/aarch64/codeready-builder/os/ --force + +# OPTIONS_REPOSITORY_IMPORT_FILTER=epel10 go run ./cmd/external-repos/main.go import +# go run cmd/external-repos/main.go snapshot --url https://dl.fedoraproject.org/pub/epel/10/Everything/x86_64/ --force +# # -- + +SECONDS=0 + +# update - hardcoded rhel 10, aarch: baseos and appstream +OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import +go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/appstream/os/ --force + +OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import +go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/baseos/os/ --force + +OPTIONS_REPOSITORY_IMPORT_FILTER=epel10 go run ./cmd/external-repos/main.go import +go run cmd/external-repos/main.go introspect --url https://dl.fedoraproject.org/pub/epel/10/Everything/x86_64/ --force + +echo "------------------------------------------" +echo "Repos imported." +echo "------------------------------------------" +echo "Checking snapshot status of all repos..." +echo "------------------------------------------" + +while [[ "$(curl -s http://localhost:8000/api/content-sources/v1.0/repositories/ -H "$( ./scripts/header.sh 12675780 1111)" | jq '.data | all(.status == "Valid")')" == "false" ]]; do + echo "[$(date +%H:%M:%S)] Waiting... (${SECONDS}s elapsed)" + sleep 5 +done + +duration=$SECONDS + +echo "------------------------------------------" +echo "Success! All snapshots are Valid." +printf "%d min %d s\n" $((duration/60)) $((duration%60)) +echo "${duration}s" +echo "------------------------------------------" \ No newline at end of file