copr-be: conditionally redirect backend URLs to Pulp #2437

Merged
ryanlerch merged 1 commit from pulp-redirect into main 2025-01-30 13:54:30 +00:00
Contributor
See https://github.com/fedora-copr/copr/issues/3504
First-time contributor

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2437,236dd5c8588e7639849595226e82c7413e0688c2

Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. Warning: Error merging pagure.io/fedora-infra/ansible for 2437,236dd5c8588e7639849595226e82c7413e0688c2
Author
Contributor

@praiskup PTAL

@praiskup PTAL
Author
Contributor

rebased onto a0720a8029

rebased onto a0720a802945f4fa6d6850e9221bd83cbd4bb1a8
First-time contributor

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging pagure.io/fedora-infra/ansible for 2437,1715dce35dc0deeb1b24392943f7b792a88b9f4c

Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. Warning: Error merging pagure.io/fedora-infra/ansible for 2437,1715dce35dc0deeb1b24392943f7b792a88b9f4c
Contributor

rebased onto 9495fde3f4

rebased onto 9495fde3f44c2f31ff643241367c95f1266297d8
Contributor

rebased onto 9495fde3f4

rebased onto 9495fde3f44c2f31ff643241367c95f1266297d8
First-time contributor

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/22dbb9540d094a13844f188a46faa653

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci https://fedora.softwarefactory-project.io/zuul/buildset/22dbb9540d094a13844f188a46faa653 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/7177fa5f56ed4b9ab479a8afd3479c2a) : FAILURE in 3m 00s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/ce38e244f8b44e1cb41e94b81612bc15) : SUCCESS in 2m 16s
Owner

Hmpf, is this redirecting even if the file doesn't physically exist?

Hmpf, is this redirecting even if the file doesn't _physically_ exist?
Owner

Just two nits:

  • ansible docs say ad mode: "Adding a leading zero (for example, 0755) works sometimes, but can fail in loops and some other circumstances."
  • people in fedora infra seem to prefer templates to end with .j2, see 5bdfe4b1e5
Just two nits: - ansible docs say ad mode: "Adding a leading zero (for example, 0755) works sometimes, but can fail in loops and some other circumstances." - people in fedora infra seem to prefer templates to end with `.j2`, see 5bdfe4b1e5e4185d66a901496712941116b5488f
Owner

I'd wish to have this hardcoded somewhere in vars, and de-hardcode PULP_CONTENT_URL too.

I'd wish to have this hardcoded somewhere in vars, and de-hardcode PULP_CONTENT_URL too.
Owner

Uh, this might only be truth for repeated reads of the same blobs (which we don't, we read just once), right? Seems to me that initially, sqlite needs to read the blobs just the way we do anyway...

Uh, this might only be truth for repeated reads of the same blobs (which we don't, we read just once), right? Seems to me that initially, sqlite needs to read the blobs just the way we do anyway...
Owner

Should we strop :.* from dirnames, too? To make the redirect work, e.g., for https://copr-be.cloud.fedoraproject.org/results/@copr/copr-pull-requests:pr:3527/?

Can you please test that both of these work:

https://copr-be.cloud.fedoraproject.org/results/@copr/copr-pull-requests:pr:3527/
https://copr-be.cloud.fedoraproject.org/results/%40copr/copr-pull-requests:pr:3527/
Should we strop `:.*` from dirnames, too? To make the redirect work, e.g., for `https://copr-be.cloud.fedoraproject.org/results/@copr/copr-pull-requests:pr:3527/`? Can you please test that both of these work: ``` https://copr-be.cloud.fedoraproject.org/results/@copr/copr-pull-requests:pr:3527/ https://copr-be.cloud.fedoraproject.org/results/%40copr/copr-pull-requests:pr:3527/
Owner

Of course, Pagure :-( https://pagure.io/pagure/issue/4468 , replace the whitespace with colon - "pr" - colon.

Of course, Pagure :-( https://pagure.io/pagure/issue/4468 , replace the whitespace with colon - "pr" - colon.
Owner

Super pedantic: the txt variable name is annoying, perhaps filename_redirect_projects?

Super pedantic: the `txt` variable name is annoying, perhaps filename_redirect_projects?
Author
Contributor

I think so, yes.

$ curl -I https://copr-be-dev.cloud.fedoraproject.org/results/frostyx/test-pulp/fedora-40-x86_64/repodata/foo.xml
HTTP/2 301
location: https://pulp.stage.devshift.net/api/pulp-content/copr/frostyx/test-pulp/fedora-40-x86_64/repodata/foo.xml
I think so, yes. ``` $ curl -I https://copr-be-dev.cloud.fedoraproject.org/results/frostyx/test-pulp/fedora-40-x86_64/repodata/foo.xml HTTP/2 301 location: https://pulp.stage.devshift.net/api/pulp-content/copr/frostyx/test-pulp/fedora-40-x86_64/repodata/foo.xml ```
Author
Contributor

Honestly, I don't know. We can do some experiment in python to find out.

Honestly, I don't know. We can do some experiment in python to find out.
Author
Contributor

There is currently some problem with building into CoprDirs so I cannot properly test the redirect but I think it doesn't work

curl -I https://copr-be-dev.cloud.fedoraproject.org/results/@copr/pulp-test:custom:foo/fedora-41-x86_64/repodata/repomd.xml
HTTP/2 404

The "@" in the URL doesn't cause any issues

[jkadlcik@hive doc]$ curl -I https://copr-be-dev.cloud.fedoraproject.org/results/@copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml
HTTP/2 301
location: https://pulp.stage.devshift.net/api/pulp-content/copr/@copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml

[jkadlcik@hive doc]$ curl -I https://copr-be-dev.cloud.fedoraproject.org/results/%40copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml
HTTP/2 301
location: https://pulp.stage.devshift.net/api/pulp-content/copr/@copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml

I was surprised by this, because I don't handle this in the script. Turns out, lighthttpd does that for us, and gives us lighty.env["uri.path"] with %40 already converted to @.

There is currently some problem with building into CoprDirs so I cannot properly test the redirect but I think it doesn't work ``` curl -I https://copr-be-dev.cloud.fedoraproject.org/results/@copr/pulp-test:custom:foo/fedora-41-x86_64/repodata/repomd.xml HTTP/2 404 ``` The "@" in the URL doesn't cause any issues ``` [jkadlcik@hive doc]$ curl -I https://copr-be-dev.cloud.fedoraproject.org/results/@copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml HTTP/2 301 location: https://pulp.stage.devshift.net/api/pulp-content/copr/@copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml [jkadlcik@hive doc]$ curl -I https://copr-be-dev.cloud.fedoraproject.org/results/%40copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml HTTP/2 301 location: https://pulp.stage.devshift.net/api/pulp-content/copr/@copr/pulp-test/fedora-41-x86_64/repodata/repomd.xml ``` I was surprised by this, because I don't handle this in the script. Turns out, lighthttpd does that for us, and gives us `lighty.env["uri.path"]` with `%40` already converted to `@`.
Author
Contributor

rebased onto ce4a415eb0

rebased onto ce4a415eb0a652d69f02ac4d0948bc4220947749
Author
Contributor

I fixed the CoprDirs redirects

I fixed the CoprDirs redirects
Author
Contributor

Thank you for the review @praiskup. All feedback addressed, PTAL.

Thank you for the review @praiskup. All feedback addressed, PTAL.
First-time contributor

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/3e8794b97c9143babe945670d92f97c3

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci https://fedora.softwarefactory-project.io/zuul/buildset/3e8794b97c9143babe945670d92f97c3 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/e34a33c964cd4a66a1f10ea4edbfe246) : FAILURE in 2m 23s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/af58d588ff944837889f4eaa1a336a95) : SUCCESS in 2m 00s
Author
Contributor

But I think we have to do the redirect only for .rpm files which are not .src.rpm.

But I think we have to do the redirect only for `.rpm` files which are not `.src.rpm`.
Owner

I don't think we have to, why? From lighttpd perspective, src.rpm is just RPM as any other..?

I don't think we have to, why? From lighttpd perspective, src.rpm is just RPM as any other..?
Owner

LGTM

LGTM
Owner

LGTM

LGTM
Owner

rebased onto fb06fb5d5c

rebased onto fb06fb5d5c20c70327a06a463c4f00e2516fa86c
Owner

rebased onto fb06fb5d5c

rebased onto fb06fb5d5c20c70327a06a463c4f00e2516fa86c
Owner

Pull-Request has been merged by praiskup

Pull-Request has been merged by praiskup
First-time contributor

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/fd14441007b94f37aacd64cdc42a06d2

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci https://fedora.softwarefactory-project.io/zuul/buildset/fd14441007b94f37aacd64cdc42a06d2 - [fi-ansible-lint-diff ](https://fedora.softwarefactory-project.io/zuul/build/be2ecea616be442c85baf5bbb3bd4e10) : FAILURE in 2m 21s - [fi-yamllint-diff ](https://fedora.softwarefactory-project.io/zuul/build/21b531ee4b1c40e48a89b0652b761daf) : SUCCESS in 2m 07s
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Infrastructure/ansible#2437
No description provided.