[WIP] Composer service
This merge request is cross-posted as per @DouweM request from https://github.com/gitlabhq/gitlabhq/pull/9301
Composer Project Service
This commit adds the per-project option to expose a project as a composer package. It generates and maintains a packages.json file along with a project specific /p/project-{id}.json file (conforming to https://getcomposer.org/doc/05-repositories.md#includes) in the public/ folder, allowing the GitLab install to be used as a Composer repository.
It extends on the original idea providing extended service configuration options that allow to work with packages that do not include a composer.json file.
Operational Modes
It has three operational modes allowing for:
- Default: Searches for a composer.json file in the source code root folder and if found exports the package.
- Project: Parse project attributes to create a virtual composer.json to use for exporting the package.
- Advanced: Parse a custom json string supplied in the service configuration to export the package.
Branch and Tag Filters
It also has branch / tag filters that allows fine-grained filtering of specific branches/tags to be exposed as composer packages.
References
This is and updated merge request for:
- https://github.com/gitlabhq/gitlabhq/pull/9301
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/106
- https://github.com/gitlabhq/gitlabhq/pull/8768
Please see feature thread http://feedback.gitlab.com/forums/176466-general/suggestions/5953067-provide-composer-package-repository-support
When a project that has activated the composer service receives a branch/ tag push, the public /packages.json file and project specific json file will be refreshed to include version definitions for the branches and tags as specified in the service configuration in the project's repository.
Note
There is a known issue integrating with the GitLab-Omnibus, namely that the public folder is owned by 'root' and GitLab is run as 'git'. The GitLab-Omnibus chef script needs to be updated to allow access to both packages.json and the /p/ folder in the public/ folder!