From 08a3454a430cd534a8fe3296b5d477ae666af754 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 22 Jan 2020 15:44:17 -0500 Subject: [PATCH] regindexer: create two sets of indexes Flatpak-1.6 expects metadata to be stored in Docker-compatible labels rather than OCI annotations. We build Flatpaks for Fedora with both labels and annotations for compatibility with older and newer Flatpaks, but we also need to have two sets of indexes: - One that is served in response to a query for labels, and skips including Flatpak annotations in the response (to reduce size) - One that is served in response to a query for annotation, and skips including Flatpak labels in the response. This commit requires regindexer-1.6. See: https://pagure.io/fedora-infrastructure/issue/8579 Signed-off-by: Owen W. Taylor --- .../reversepassproxy.registry-generic.conf | 16 ++++++++ roles/regindexer/build/templates/config.yaml | 38 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/roles/httpd/reverseproxy/templates/reversepassproxy.registry-generic.conf b/roles/httpd/reverseproxy/templates/reversepassproxy.registry-generic.conf index 3030b1d738..e2878a8d78 100644 --- a/roles/httpd/reverseproxy/templates/reversepassproxy.registry-generic.conf +++ b/roles/httpd/reverseproxy/templates/reversepassproxy.registry-generic.conf @@ -25,17 +25,33 @@ RewriteCond "&%{QUERY_STRING}" &tag=testing RewriteCond "&%{QUERY_STRING}" &architecture=([^&]+) RewriteRule "^/index/static$" /index/flatpak-testing-%1.json [L,PT] +RewriteCond "&%{QUERY_STRING}" &label(%3A|:)org.flatpak.ref(%3A|:)exists=1 +RewriteCond "&%{QUERY_STRING}" &tag=testing +RewriteCond "&%{QUERY_STRING}" &architecture=([^&]+) +RewriteRule "^/index/static$" /index/flatpak-testing-%1-labels.json [L,PT] + RewriteCond "&%{QUERY_STRING}" &annotation(%3A|:)org.flatpak.ref(%3A|:)exists=1 RewriteCond "&%{QUERY_STRING}" &architecture=([^&]+) RewriteRule "^/index/static$" /index/flatpak-%1.json [L,PT] +RewriteCond "&%{QUERY_STRING}" &label(%3A|:)org.flatpak.ref(%3A|:)exists=1 +RewriteCond "&%{QUERY_STRING}" &architecture=([^&]+) +RewriteRule "^/index/static$" /index/flatpak-%1-labels.json [L,PT] + RewriteCond "&%{QUERY_STRING}" &annotation(%3A|:)org.flatpak.ref(%3A|:)exists=1 RewriteCond "&%{QUERY_STRING}" &tag=testing RewriteRule "^/index/static$" /index/flatpak-testing.json [L,PT] +RewriteCond "&%{QUERY_STRING}" &label(%3A|:)org.flatpak.ref(%3A|:)exists=1 +RewriteCond "&%{QUERY_STRING}" &tag=testing +RewriteRule "^/index/static$" /index/flatpak-testing-labels.json [L,PT] + RewriteCond "&%{QUERY_STRING}" &annotation(%3A|:)org.flatpak.ref(%3A|:)exists=1 RewriteRule "^/index/static$" /index/flatpak.json [L,PT] +RewriteCond "&%{QUERY_STRING}" &label(%3A|:)org.flatpak.ref(%3A|:)exists=1 +RewriteRule "^/index/static$" /index/flatpak-labels.json [L,PT] + DocumentRoot /srv/web/registry-index/ diff --git a/roles/regindexer/build/templates/config.yaml b/roles/regindexer/build/templates/config.yaml index 569dc9466f..7b30290f83 100644 --- a/roles/regindexer/build/templates/config.yaml +++ b/roles/regindexer/build/templates/config.yaml @@ -7,6 +7,15 @@ indexes: registry_public: / tags: ['latest'] required_annotations: ['org.flatpak.ref'] + skip_flatpak_labels: True + extract_icons: True + flatpak_labels: + output: /var/lib/regindexer/index/flatpak-labels.json + registry: https://registry{{ env_suffix }}.fedoraproject.org + registry_public: / + tags: ['latest'] + required_labels: ['org.flatpak.ref'] + skip_flatpak_annotations: True extract_icons: True flatpak_testing: output: /var/lib/regindexer/index/flatpak-testing.json @@ -14,6 +23,15 @@ indexes: registry_public: / tags: ['testing'] required_annotations: ['org.flatpak.ref'] + skip_flatpak_labels: True + extract_icons: True + flatpak_testing_labels: + output: /var/lib/regindexer/index/flatpak-testing-labels.json + registry: https://registry{{ env_suffix }}.fedoraproject.org + registry_public: / + tags: ['testing'] + required_labels: ['org.flatpak.ref'] + skip_flatpak_annotations: True extract_icons: True flatpak_amd64: output: /var/lib/regindexer/index/flatpak-amd64.json @@ -22,6 +40,16 @@ indexes: tags: ['latest'] required_annotations: ['org.flatpak.ref'] architectures: ['amd64'] + skip_flatpak_labels: True + extract_icons: True + flatpak_amd64_labels: + output: /var/lib/regindexer/index/flatpak-amd64-labels.json + registry: https://registry{{ env_suffix }}.fedoraproject.org + registry_public: / + tags: ['latest'] + required_labels: ['org.flatpak.ref'] + architectures: ['amd64'] + skip_flatpak_annotations: True extract_icons: True flatpak_testing_amd64: output: /var/lib/regindexer/index/flatpak-testing-amd64.json @@ -30,6 +58,16 @@ indexes: tags: ['testing'] required_annotations: ['org.flatpak.ref'] architectures: ['amd64'] + skip_flatpak_labels: True + extract_icons: True + flatpak_testing_amd64_labels: + output: /var/lib/regindexer/index/flatpak-testing-amd64-labels.json + registry: https://registry{{ env_suffix }}.fedoraproject.org + registry_public: / + tags: ['testing'] + required_labels: ['org.flatpak.ref'] + architectures: ['amd64'] + skip_flatpak_annotations: True extract_icons: True daemon: topic_prefix: org.fedoraproject