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

kernelci/build.py: Add apply_patch_mbox method #2041

Closed
wants to merge 1 commit into from

Conversation

yurinnick
Copy link
Contributor

@yurinnick yurinnick commented Aug 1, 2023

Fixes kernelci/kernelci-api#307

Implement apply_patch_mbox method that downloads patch from mbox url into a temporary file and apply in to kernel tree

Test run logs:

kernelci-pipeline-notifier            | 07/31/2023 11:33:19 PM UTC [INFO] 2023-07-31 23:33:19.800845  HEAD          64c844bfe8ad32503e18af61  Running    -         checkout
kernelci-pipeline-tarball             | 07/31/2023 11:33:19 PM UTC [INFO] Updating repo for mainline
kernelci-pipeline-tarball             | From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
kernelci-pipeline-tarball             |  * branch                      HEAD       -> FETCH_HEAD
kernelci-pipeline-tarball             | From git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
kernelci-pipeline-tarball             |  * branch                      HEAD       -> FETCH_HEAD
kernelci-pipeline-tarball             | HEAD is now at 5d0c230f1de8 Linux 6.5-rc4
kernelci-pipeline-tarball             | 07/31/2023 11:33:27 PM UTC [INFO] Repo updated
kernelci-pipeline-tarball             | 07/31/2023 11:33:27 PM UTC [INFO] Applying patch to the repo, patch mbox url: https://patchwork.kernel.org/project/linux-hardening/patch/20230726231139.never.601-kees@kernel
.org/mbox/
kernelci-pipeline-tarball             | 07/31/2023 11:33:28 PM UTC [INFO] Making tarball linux-mainline-master-v6.5-rc4-1-g66f6b7deab6b.tar.gz
kernelci-pipeline-tarball             | 07/31/2023 11:33:28 PM UTC [INFO] set -e
kernelci-pipeline-tarball             | cd /home/kernelci/data/src/linux
kernelci-pipeline-tarball             | git archive --format=tar --prefix=linux-mainline-master-v6.5-rc4-1-g66f6b7deab6b/ HEAD | gzip > ../../output/linux-mainline-master-v6.5-rc4-1-g66f6b7deab6b.tar.gz
kernelci-pipeline-tarball             |
kernelci-pipeline-tarball             |
kernelci-pipeline-tarball             | 07/31/2023 11:33:55 PM UTC [INFO] Tarball created

@gctucker
Copy link
Contributor

gctucker commented Aug 1, 2023

The issue right now is that kernelci.build is not used by the new API & Pipeline. I think this is going a bit too fast, see my question on the issue kernelci/kernelci-api#307 as the first part is still missing - namely, how to connect Patchwork with the API.

Sorry, got that wrong. I see it's just applying patch files on top of a source tree. Still it's missing the initial step as far as I can tell, which is about the logic that will be receiving the data from Patchwork to get a pipeline running with it.

Copy link
Contributor

@gctucker gctucker left a comment

Choose a reason for hiding this comment

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

I think we should be able to merge this one, just added some comments about a few minor things to tweak. It's not used in the code base yet but it makes sense to have it as a utility method for the rest, and the way kernel builds are done will need to be reworked anyway for the new pipeline so this will all get consolidated again in the near future.

kernelci/build.py Show resolved Hide resolved
kernelci/build.py Outdated Show resolved Hide resolved
kernelci/build.py Outdated Show resolved Hide resolved
Signed-off-by: Nikolay Yurin <yurinnick@meta.com>
Comment on lines +345 to +346
git config user.name "{git_username}"
git config user.email "{git_email}"
Copy link
Contributor

Choose a reason for hiding this comment

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

No I mean, I think we should actually remove these lines. Say, if you're doing this over your working kernel source tree and you don't specify command line arguments with your current user name and email then it will replace it. And then next time you make a commit in the kernel source tree it'll be with the kernelci-tsc@groups.io email.

So it should be left to the user to manage this outside of kci_build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean it should be part of KernelCI config files or something? Sorry, I am not quite following what do you mean. Git won't allow to apply patches without name and email being set though.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be part of the user's Git config, yes. Or we could maybe have a separate command to set the user name and email explicitly if some CI systems need to do that, as a handy wrapper.

Git won't allow to apply patches without name and email being set though.

Yes and that's fine. If there's no user name and email configured then git will fail and the issue will be on the user to solve it. Just like running any other invalid command (say, if kdir is not a Git repo etc.).

@pawiecz
Copy link
Contributor

pawiecz commented Jan 12, 2024

@yurinnick Please correct me if I'm wrong: this PR is a dependency to kernelci/kernelci-pipeline#295 which has been closed.

Can this one be closed as well or is it still intended to be used somewhere? If it is being repurposed, could you point me where it's used (I wasn't able to locate any)?

@yurinnick
Copy link
Contributor Author

@pawiecz there was some back-n-forth on a best way to apply patches, I think it's safe to close for now and re-open if you'll need to get back to it.

@yurinnick yurinnick closed this Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Patch building and Webhooks API
3 participants