Skip to content

Commit b791b4d

Browse files
committed
update: repos and scripts upon frontend refactor
Due to the frontend refactor in frontend PR #763, there was a need to import also hardcoded repositories in the script that is used for local playwright tests. The script repos-minimal imports the previous EPEL and SMALL repo, plus 2 hardcoded repos. A new script which counts the duration how long it takes to import and snapshot or introspect the required repos for testing has been added.
1 parent b422e82 commit b791b4d

4 files changed

Lines changed: 55 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ If you want less Red Hat repos:
7070
OPTIONS_REPOSITORY_IMPORT_FILTER=small make repos-import
7171
```
7272

73-
This will import and snapshot repos needed for the minimal viable environment. Useful for running Playwright tests.
73+
This will import and snapshot repos needed for the initial viable environment required before running Playwright tests.
7474

7575
```sh
7676
make repos-minimal

mk/repos.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ repos-import-rhel10: ## Import only rhel 10 repos
2020
OPTIONS_REPOSITORY_IMPORT_FILTER=rhel10 go run ./cmd/external-repos/main.go import
2121

2222
.PHONY: repos-minimal
23-
repos-minimal: ## Import and snapshot repos needed for a minimal setup, usefull for Playwright testing, currently: SMALL + EPEL10
23+
repos-minimal: ## Import and snapshot or introspect repos needed before running Playwright tests, the repos used: HARDCODED (2) + SMALL + EPEL10
24+
OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import
25+
go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/appstream/os/ --force
26+
go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/baseos/os/ --force
2427
OPTIONS_REPOSITORY_IMPORT_FILTER=small go run ./cmd/external-repos/main.go import
2528
go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel9/9/aarch64/codeready-builder/os/ --force
2629
OPTIONS_REPOSITORY_IMPORT_FILTER=epel10 go run ./cmd/external-repos/main.go import

pkg/external_repos/snapshotted_repos/rhel10-aarch64.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"url": "https://cdn.redhat.com/content/dist/rhel10/10/aarch64/baseos/os",
66
"distribution_arch": "aarch64",
77
"distribution_version": "10",
8-
"selector": "rhel10",
8+
"selector": "rhel10,hardcoded",
99
"feature_name": "RHEL-OS-x86_64",
1010
"origin": "red_hat"
1111
},
@@ -15,7 +15,7 @@
1515
"url": "https://cdn.redhat.com/content/dist/rhel10/10/aarch64/appstream/os",
1616
"distribution_arch": "aarch64",
1717
"distribution_version": "10",
18-
"selector": "rhel10",
18+
"selector": "rhel10,hardcoded",
1919
"feature_name": "RHEL-OS-x86_64",
2020
"origin": "red_hat"
2121
},
@@ -31,7 +31,7 @@
3131
},
3232
{
3333
"name": "Red Hat Enterprise Linux 10 for ARM 64 - Extensions (RPMs)",
34-
"content_label" :"rhel-10-for-aarch64-extensions-rpms",
34+
"content_label": "rhel-10-for-aarch64-extensions-rpms",
3535
"url": "https://cdn.redhat.com/content/dist/rhel10/10/aarch64/extensions/os",
3636
"distribution_arch": "aarch64",
3737
"distribution_version": "10",

scripts/time_valid_repos.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# Measure how long it takes to import, and snapshot or introspect particular repositories and wait until they become valid
4+
# Run the backend locally
5+
6+
echo "------------------------------------------"
7+
echo "Importing repos and forcing a snapshot..."
8+
echo "------------------------------------------"
9+
10+
# # original - epel10 and small
11+
# OPTIONS_REPOSITORY_IMPORT_FILTER=small go run ./cmd/external-repos/main.go import
12+
# go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel9/9/aarch64/codeready-builder/os/ --force
13+
14+
# OPTIONS_REPOSITORY_IMPORT_FILTER=epel10 go run ./cmd/external-repos/main.go import
15+
# go run cmd/external-repos/main.go snapshot --url https://dl.fedoraproject.org/pub/epel/10/Everything/x86_64/ --force
16+
# # --
17+
18+
SECONDS=0
19+
20+
# update - hardcoded rhel 10, aarch: baseos and appstream
21+
OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import
22+
go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/appstream/os/ --force
23+
24+
OPTIONS_REPOSITORY_IMPORT_FILTER=hardcoded go run ./cmd/external-repos/main.go import
25+
go run cmd/external-repos/main.go snapshot --url https://cdn.redhat.com/content/dist/rhel10/10/aarch64/baseos/os/ --force
26+
27+
OPTIONS_REPOSITORY_IMPORT_FILTER=epel10 go run ./cmd/external-repos/main.go import
28+
go run cmd/external-repos/main.go introspect --url https://dl.fedoraproject.org/pub/epel/10/Everything/x86_64/ --force
29+
30+
echo "------------------------------------------"
31+
echo "Repos imported."
32+
echo "------------------------------------------"
33+
echo "Checking snapshot status of all repos..."
34+
echo "------------------------------------------"
35+
36+
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
37+
echo "[$(date +%H:%M:%S)] Waiting... (${SECONDS}s elapsed)"
38+
sleep 5
39+
done
40+
41+
duration=$SECONDS
42+
43+
echo "------------------------------------------"
44+
echo "Success! All snapshots are Valid."
45+
printf "%d min %d s\n" $((duration/60)) $((duration%60))
46+
echo "${duration}s"
47+
echo "------------------------------------------"

0 commit comments

Comments
 (0)