-
Notifications
You must be signed in to change notification settings - Fork 521
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
Allow to run a satis build for one repo/package #125
Allow to run a satis build for one repo/package #125
Conversation
…e. This helps to speed up the satis run if you have a lot of repos.
@@ -50,6 +50,7 @@ protected function configure() | |||
->setDefinition(array( | |||
new InputArgument('file', InputArgument::OPTIONAL, 'Json file to use', './satis.json'), | |||
new InputArgument('output-dir', InputArgument::OPTIONAL, 'Location where to output built files', null), | |||
new InputArgument('filter-package', InputArgument::OPTIONAL, 'Run the build just for the given package', null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be an array argument to allow specifying several packages, like for composer update
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid point. In our case I only needed one package but obviously this could be extended to allow multiple packages as filters.
your filtered package seems to be missing the exclusion of AliasPackage and stability |
@stof thanks for pointing out. Will add that as well. |
…ndling of packages.
…n now pass a list of packages that satis should built the repos for.
When can I expect the PR to be merged in? Or is some more work needed on my side? |
👍 +1 on this. We only really want Satis to update the individual projects that have passed the tests on our CI server. |
This would be a much welcomed feature. Anything in the way of merging this? |
👍 +2 on this. |
👍 this would be fantastic |
+1! |
Big 👍! |
I actually deal with more than 200 repositories and this will be helpfull. But I see that the most time past during the build is for building packages.json (if no newer package are found) Did the pull request fix that ? |
@Kmelia That is a good question. Honestly I do not know. We only deal with 10ish repos. Would you mind testing it in your setup? |
I patch my file vendor/composer/satis/src/Composer/Satis/Command/BuildCommand.php and I have run with just one package : but my packages.json did not keep the others packages. Is that normal ? |
Indeed just looking at the code of this it would generate a packages.json only for the filtered packages, not update an existing one with the filtered package info? |
@shochdoerfer I added a PR to your fork/branch that should solve this, and some other issues. |
…satis is run for a single package.
…y on the includes functionality introduced by #132.
Unfortunately I recently merged a change to use includes in packages.json so I think this doesn't quite work correctly with that. Can you rebase onto latest master and adapt this branch? |
@naderman I merged in the changes from master this morning and changed the code to make it work with it. |
Oh sorry, I missed that :) |
Allow to run a satis build for one repo/package
I've been playing with this and was hoping that a such a single-package build would only fetch and re-scan the vcs repository for the given package. In fact, the console output shows that satis iterates over all repositories again. Am I missing anything or did I get this feature wrong? |
BuildCommand::selectPackages() will as a first step do
... which will pull and re-scan all defined VcsRepositories even before the filter is applied. |
Well no, you didnt get it wrong. But it kinda only solved half the problem - the actual package fetching. TMK you can't select a repo based on package. The information just isn't available. You can only ask if the repo contains a specific package, wich potentially scans all repos to find one specific package. I guess you could store which repo the package came from (in packages.json or somewhere else), and read from that. But in theory a package can change repo (and maybe even be split across multiple repos in different versions?). So a full scan is the only way to be sure you get all versions of the package. Of course it could fall back to a full scan, if it can no longer find the package in the last repo it got it from. That would be fairly safe, and very rarely result in a full scan. But it would possibly create some edge cases where new versions wouldn't be found, for instance if the package moved repo, but didnt get removed from the old one. |
Ok, trying to get this straight... This PR allows to update selectively by providing a package name. It will then re-scan all configured repositories, figure out which versions of the package(s) are available in all of them and then dumpDownload() only versions of this package. In contrary, PR #110 together with jkufner#1 takes a repo URL as parameter and only re-scans this given repo for available packages. It then merges that information with the full set of packages which is kept serialized in a cache. What I am aiming for are quick updates by mean of a webhook, as in #40. The URL-based "scan only one repo"-approach seems more fit here. |
Looking at the code more closely:
So - wouldn't it be easier to apply the filtering in dumpDownloads only? That would make a much simpler implementation of the same behaviour IMO. |
@shochdoerfer could you please try to explain how this filter is supposed to work together with the Thanks! |
Added an additional flag to generate the satis build for a single package. This helps to speed up the satis run if you have to deal with a lot of repos. In our case Jenkins will trigger the satis build after a new release was created. Since we have a lot packages (with a lot of versions) in our local satis repo, I was looking for a way to speed up the satis run.