Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make coprdirs have their repo available in the buildroot #3369

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FrostyX
Copy link
Member

@FrostyX FrostyX commented Aug 11, 2024

This is useful in general but especially for pull requests that build multiple packages which depend on each other (e.g. python-copr and copr-cli). Up until now, it had to be workarounded by building the dependency into the main copr repository.

@praiskup
Copy link
Member

This would bring security issue into the src.fedoraproject.org integration (the pagure events handler).... a single Copr project may integrate multiple packages from s.f.o. being developed by multiple packagers from s.f.o, and all such integrated packages can build from the corresponding "pull-request 1" (separate PRs, heading the same CoprDir!) and then, the package builds are done against each other.

We need to solve the s.f.o integration first, somehow.

Copy link

Pull Request validation

Failed

🔴 Review - Missing review from a member (2 required)

Success

🟢 CI - All checks have passed

@FrostyX FrostyX force-pushed the coprdir-buildroot-repo branch from ff65588 to df12563 Compare February 20, 2025 12:29
@FrostyX FrostyX removed the blocked label Feb 20, 2025
@FrostyX FrostyX force-pushed the coprdir-buildroot-repo branch from df12563 to 764cf2d Compare February 20, 2025 12:32
Alternatively, we could separate then through `event_info.user` which would
produce CoprDir names like `foocopr:pr:jdoe-1`. This wouldn't separate the
different packages but it would be good enough to fix the security issue. And it
would produce shorter names than the project URL paths.
This is useful in general but especially for pull requests that build
multiple packages which depend on each other (e.g. `python-copr` and
`copr-cli`). Up until now, it had to be workarounded by building the
dependency into the main copr repository.
@FrostyX FrostyX force-pushed the coprdir-buildroot-repo branch from 764cf2d to a14af3f Compare February 20, 2025 12:41
@FrostyX
Copy link
Member Author

FrostyX commented Feb 20, 2025

Took me only half a year but updated, PTAL.

# And this is the package that builds on top of it (e.g. copr-cli)
rlRun "curl https://src.fedoraproject.org/rpms/hello/raw/rawhide/f/hello.spec > $tmp/hello-2.spec"
rlRun "sed -i '1s/^/BuildRequires: hello >= 6:\n/' $tmp/hello-2.spec"
rlRun "copr-cli build $PROJECT:custom:foo $tmp/hello-2.spec"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs update; you can use --after-build-id to order properly, and then we need to wait for the build result

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this test a long time ago, so I don't remember my thought process. But there is no --nowait for the first build, so the second one should be submitted only after the first one is finished. Using build batches should make no difference, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting is necessary IMVHO, otherwise we are not testing anything :-/
And then, batches allow you to wait for just one of them (because the second one doesn't start untill the first one is finished).

@@ -692,8 +694,7 @@ def validate(cls, copr, dirname):
f"Please use directory format {copr.name}:custom:<SUFFIX_OF_CHOICE> "
f"or {copr.name}:pr:<ID> (for automatically removed directories)"
)

if not all(x.isalnum() for x in dirname.split(":")[1:]):
if not all(x.isalnum() for x in re.split(r"[:-]+", dirname)[1:]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this deserves an in-line note :-) I'm not sure this is correct

We basically only want to allow one more :-separated field, right? I'd wish we had a test-case for the validation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then, I'm a bit scare of creating custom dirnames, because we don't have a method for deleting them.

Then, note #820 -> will that still work & remove PR dirs after certain period of time?

Copy link
Member

@praiskup praiskup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overall like where this PR goes, thank you for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants