Difference between revisions of "CBI/aggregator/manual"
(updated download site information)
(Creating a Maven-conformant p2 repo -- provided current example)
|Line 147:||Line 147:|
sample [://git.eclipse.org/c//.git//org.eclipse.cbi.p2repo.aggregatorsamples/.aggr .aggr]of to a Maven.
Revision as of 23:05, 26 January 2017
- 1 Introduction
- 2 Functional Overview
- 3 Installation
- 4 Getting started with standard examples
- 5 Headless support
- 6 Aggregation model components and specific actions
- 6.1 Global actions
- 6.2 Aggregation
- 6.2.1 Configuration
- 6.2.2 Validation Set
- 6.2.3 Contribution
- 6.2.4 Contact
- 6.2.5 Custom Category
- 6.2.6 Validation Repository
- 6.2.7 Maven Mapping
- 7 Legacy format support
- 8 What else should be documented
Historically, the CBI Aggregator is based on the "b3 Aggregator" from the now defunct "Eclipse b3 Project".
The purpose of the CBI Aggregator is to aggregate or combine several p2 repositories. The aggregator does a number of things above and beyond simply "p2 mirroring" the different repositories: first and foremost, it makes sure that all the bundles could be "installed together" (that is, all the constraints are met and none are contradictory); it also ensures any "pack.gz" files are valid (i.e. can be unpacked into valid jars); and it also offers custom categories since the aggregated repository in most cases would not want to use the same categories as each individual repository uses. More details on its functionality follows.
The Aggregator combines repositories from various sources into a new aggregated p2 repository. It can also be configured to produce a hybrid p2/Maven2 repository. (This feature is currently labeled "experimental" in the CBI aggregator, since it is not yet production quality).
There are many situations where using aggregated repositories is a good solution. The reasons vary from licensing issues to organizational requirements:
- Owners of a p2 repo for a given project may not be in position to host all required or recommended components due to licensing issues - SVN support one example: as it requires components available through the main Eclipse p2 repo as well as third-party components. Hence users would normally have to visit several repos for a complete install, but by using the aggregator an institution could create a custom repository that has everything needed.
- Projects want to provide convenient access to their products - Installation instructions requiring the user to visit several repos for a complete install are not uncommon. An aggregated repo for all those locations provides a convenient one-stop strategy. The aggregation may support mirroring all consumed p2 repos or simply providing an indirection via a composite repo.
- Organizations or teams want control over internally used components - It may be necessary to have gated access to relevant p2 repos and do an organizational "healthcheck" of those before internal distribution. Furthermore, internally used aggregated repos can provide a common basis for all organizational users.
- Increase repository availability - by aggregating and mirroring what is used from multiple update sites into an internally controlled server (or several).
- Distributed Development Support - an overall product repository is produced by aggregating contributions from multiple teams.
The Aggregator tool is focused on supporting these specific requirements. The Aggregator is used in scenarios outside of the traditional "build domain" and this has been reflected in the user interface which does not delve into the details of "building" and should therefore be easy to use by non build experts.
Furthermore, it is worth noting that:
- the Aggregator is based on EMF models
- headless execution of aggregation definitions (once they have been created) is possible using a command line packaging of the Aggregator
The CBI Aggregator performs aggregation and validation of repositories. The input to the aggregator engine (that tells it what to do) is a aggr EMF model. Such a model is most conveniently created by using the CBI Aggregator editor. This editor provides both editing and interactive execution of aggregation commands. The editor is based on a standard EMF "tree and properties view" style editor where nodes are added and removed to from a tree, and the details of nodes are edited in a separate properties view. Once a aggr model has been created it is possible to use the command line / headless aggregator to perform aggregation (and other related commands). (Note that since the aggr is "just an EMF model", it can be produced via EMF APIs, transformation tools, etc., and thus support advanced use cases).
The model mainly consists of Contributions - specifications of what to include from different repositories, and Validation Repositories - repositories that are used when validating, but which are not included in the produced aggregation (i.e., they are not copied). Contributions and Validation Repositories are grouped into Validation Sets. Everything in a Validation Set will be validated as one unit, i.e. it must be possible to install everything in a Validation Set together. The model also contains specification of various processing rules (exclusions, transformation of names, etc.), and specification of Contacts - individuals/mailing-lists to inform when processing fails.
Here are some of the important features supported by the CBI Aggregator:
- p2 and maven2 support — the aggregator can aggregate from and to both p2 and maven2 repositories.
- Maven2 name mapping support — names in the p2 domain are automatically mapped to maven2 names using built-in rules. Custom rules are also supported.
- Mirroring — artifacts from repositories are mirrored/downloaded/copied to a single location.
- Selective mirroring — an aggregation can produce an aggregate consisting of a mix of references to repositories and mirrored repositories.
- Cherry picking — it is possible to pick individual items when the entire content of a repository is not wanted. Detailed picking is supported as well as picking transitive closures like a product, or a category to get everything it contains/requires.
- Pruning — it is possible to specify mirroring based on version ranges. This can be used to reduce the size of the produced result when historical versions are not needed in the aggregated result.
- Categorization — categorization of installable units is important to the consumers of the aggregated repository. Categories are often choosen by repository publishers in a fashion that makes sense when looking at a particular repository in isolation, but when they are combined with others it can be very difficult for the user to understand what they relate to. An important task for the constructor of an aggregation is to be able to organize the aggregated material in an easily consumable fashion. The CBI Aggregator has support for category prefixing, category renaming, addition of custom categories, as well as adding and removing features in categories.
- Validation — the CBI Aggregator validates the aggregated Validation Sets to ensure that everything in them is installable at the same time.
- Blame Email — when issues are found during validation, the aggregator supports sending emails describing the issue. This is very useful when aggregating the result of many different projects. Advanced features include specifying contacts for parts of the aggregation, which is useful in large multi-layer project structures where issues may be related to the combination of a group of projects rather than one individual project - someone responsible for the aggregation itself should be informed about these cross-project issues. The aggregator supports detailed control over email generation, including handling of mock emails when testing aggregation scripts.
It is best to start by downloading a fresh release of the Eclipse SDK. The latest version of the aggregator, from its own software repository, typically goes with the most recently released version of the Eclipse SDK or the Eclipse Platform. The aggregator builds do not typically keep up with Milestones. It might work, but "user beware".
The CBI aggregator can either be integrated with your Eclipse SDK or it can be installed as a standalone headless product (i.e. pure command line, without any graphical UI).
The instructions below show the URLs at the time this section was written (that is, not necessarily the current URLs).
Always check the for the latest aggregator software repository on the CBI download page.
Eclipse SDK installation
Installation of the headless version of the Aggregator is similar to any typical headless installation using the p2Director. The following steps focus on the installation of the headless Aggregator feature.
- Install CBI Aggregator with the following command:
<p2_DIRECTOR> -r <HEADLESS_REPO> -d <INSTALL_DIR> -p CBIProfile -i org.eclipse.cbi.p2repo.cli.product
- <p2_DIRECTOR> is whatever method you use to invoke the p2Director application.
- -r <HEADLESS_REPO> is the headless p2 update site: Current stable version is: http://download.eclipse.org/cbi/updates/aggregator/headless/4.6/
- -d <INSTALL_DIR> is the chosen install location of the headless aggregator
- -p CBIProfile is the name of the p2 profile
- -i org.eclipse.cbi.p2repo.cli.product is the name of the headless CBI Aggregator
Getting started with standard examples
In the following sections we provide two simple examples that are easy to replicate and should highlight the most important features of the Aggregator. The first example deals with the creation of two variations of a p2 repo. The second shows the Aggregator's Maven support.
The *.aggr model files shown be below can be created via File > New > CBI Aggregator > Repository Aggregation.
Aggregating a p2 repo
The first sample aggregation is build around Buckminster and its support for Subversive. The objective of this aggregated repo is to:
- provide a "one-stop shop" experience
- conveniently pull in third-party components that are not hosted at Eclipse
- provide this repo as an indirection mechanism if required
[NOTE: this section is out of date and has yet to be updated for the CBI aggregator]
(This example aggregation can be downloaded via the CBI project Git and opened in an appropriately set up workbench: ).
The background is that Buckminster provides support for Subclipse. In addition to all components hosted at Eclipse, a complete installation will also require Subclipse components from Tigris.org (http://subclipse.tigris.org/update_1.6.x). We want to create a repo that combines these components and makes them accessible from one location. We want to make several platform configurations available.
This example already includes some of the more advanced aggregation features. Stepping through the model view from the top node the following components can be identified:
- The top node Aggregation groups all model definitions regarding ValidationSets and Contributions. Looking at the properties section at the bottom we see that:
- the top node has been provided with a mandatory Label with the value "Indigo + Buckminster for Subclipse"; this is also the label that is shown to users when accessing the aggregated repo via the p2 update manager
- the Build Root identifies the location to which the artifacts of the aggregated repo will be deployed
- The aggregation is defined for three configurations (i.e. os=win32, ws=win32, arch=x86; etc)
- any number of configurations can be defined
- during the aggregation process all dependencies of the contributed components will be verified for all provided configurations, unless exceptions are defined (see below)
- We have one ValidationSet labeled "main". A ValidationSet constitutes everything that will be validated as one unit by the p2 planner.
- The main ValidationSet contains three different contributions.
- The first Contribution to the aggregation is labeled "Indigo". This contribution includes binary configuration-specific artifacts which are only available for linux. If a simple contribution would be defined the aggregation would fail for all non-linux configurations, and hence the aggregation would fail as a whole.
- this requires a definition of Valid Configurations Rules that state exceptions
- the rules defined for the the three components in question essentially state that the verification process for those components should only be performed for linux-based configurations
- one Mapped Repository is defined for this contribution (it can have multiple); all that is needed is a user-defined label and the URL of the repository that should be included
- the result of this definition is that all categories, products, and features from Indigo p2 repo will be included in the aggregated repo.
- The second Contribution is labeled "Subclipse" and deals with the inclusion of bundles provided from the Subclipse project. #*this contribution represents the simplest example of a contribution
- The third Contribution is labeled "Buckminster (latest)". It shows another advanced feature - an Exclusion Rule.
- remember that the objective of the sample repo is to provide convenient setup of Buckminster with Subclipse support, and since Buckminster's Subclipse and Subversive support are mutually exclusive, we want to exclude the features for Subversive from the aggregated repo to make it easier for the user.
- this is done using an Exclusion Rule defined for each Installable Unit that should be excluded
- A list of all included repos is displayed at the bottom of the model editor view
- this list allows browsing the contents of all repos
- this part of the model is not editable
The aggregation can be run by right-clicking any node in the model and selecting Build Aggregation. This example was setup to use a mirroring approach for all contributed repos. Hence, the complete contents of all included can be found in the aggregated repos target location specified under Build Root.
Check the next section for a slightly different approach.
Providing a repo indirection
Mirroring all repo artifacts of your aggregated contributions is a very valuable and important feature when performing aggregation, but there are also many cases where this is not necessary. It is possible to turn off artifact mirroring/copying by changing one property for a defined contribution.
Each Mapped Repository has a boolean property called Mirror Artifacts which can be set to
The following buckminster_indigo_redirect.aggr is a variation of the first example with the Mirror Artifacts property set to
Creating a Maven-conformant p2 repo