Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "CBI/aggregator"
(→Creating a Maven-conformant p2 repo: document -SNAPSHOT) |
(→Example: adjust links after https://github.com/eclipse-cbi/p2repo-aggregator/pull/5) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 40: | Line 40: | ||
=Git repository= | =Git repository= | ||
− | Git repository: | + | Git repository: https://github.com/eclipse-cbi/p2repo-aggregator/ |
=Installation= | =Installation= | ||
Line 58: | Line 58: | ||
*Start your Eclipse installation and open the '''''Install New Software wizard'''''. You'll find in under the top menu ''Help'' | *Start your Eclipse installation and open the '''''Install New Software wizard'''''. You'll find in under the top menu ''Help'' | ||
[[Image:B3 Install New Software.png|thumb|center|580x492px|Install New Software wizard]] | [[Image:B3 Install New Software.png|thumb|center|580x492px|Install New Software wizard]] | ||
− | *Click the ''Add...'' button and enter the URL '''''<nowiki>http://download.eclipse.org/cbi/updates/aggregator/ide/4. | + | *Click the ''Add...'' button and enter the URL '''''<nowiki>http://download.eclipse.org/cbi/updates/aggregator/ide/4.13/</nowiki>''''' in the ''Location'' field. |
*Select the '''''Eclipse CBI Aggregator Editor''''' and click ''Next'' twice. | *Select the '''''Eclipse CBI Aggregator Editor''''' and click ''Next'' twice. | ||
[[Image:B3 Install Aggregator.png|thumb|center|580x492px|CBI Aggregator Editor selection]] | [[Image:B3 Install Aggregator.png|thumb|center|580x492px|CBI Aggregator Editor selection]] | ||
Line 73: | Line 73: | ||
where | where | ||
#**'''''<p2_DIRECTOR>''''' is whatever method you use to invoke the [http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html p2Director application]. | #**'''''<p2_DIRECTOR>''''' is whatever method you use to invoke the [http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_director.html p2Director application]. | ||
− | #**'''''-r <HEADLESS_REPO>''''' is the headless p2 update site: Current stable version is: '''''<nowiki>http://download.eclipse.org/cbi/updates/aggregator/headless/4. | + | #**'''''-r <HEADLESS_REPO>''''' is the headless p2 update site: Current stable version is: '''''<nowiki>http://download.eclipse.org/cbi/updates/aggregator/headless/4.13/</nowiki>''''' |
#**'''''-d <INSTALL_DIR>''''' is the chosen install location of the headless aggregator | #**'''''-d <INSTALL_DIR>''''' is the chosen install location of the headless aggregator | ||
#**'''''-p CBIProfile''''' is the name of the p2 profile | #**'''''-p CBIProfile''''' is the name of the p2 profile | ||
Line 155: | Line 155: | ||
* Version Pattern: ([^.]+)\.([^.]+)\.0(?:\..*)? | * Version Pattern: ([^.]+)\.([^.]+)\.0(?:\..*)? | ||
* Version Template: $1.$2 | * Version Template: $1.$2 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ===Maven Snapshots=== | |
+ | Using the final solution from {{fixedBug|406557}} (available since [https://download.eclipse.org/cbi/updates/aggregator/ide/4.13/I20200625-1232/ build I20200625-1232]) it is possible to produce artifacts that maven recognizes as snapshots. The solution consists of several parts: | ||
+ | * Individual [[#Maven Mapping|Maven Mapping]] elements can be marked with <code>snapshot="true"</code>. Aggregator will attempt to transform all matched artifacts to snapshot artifacts. | ||
+ | * The internal version identifying an individual snapshot in maven (smth like "1.2.3-20201253.235900-123") will be constructed from the following: | ||
+ | ** Date and time will be extracted from the qualifier part of the OSGi version | ||
+ | ** A build number needs to be passed as a command line argument to the aggregator like this: <code>--mavenBuildNumber 123</code>. Build numbers should monotonically grow, but now further constraints apply. | ||
+ | |||
+ | |||
+ | The OSGi version qualifier (''like "v20201224-2359-nightly"'') will be matched against the following pattern: <code>"(.*[^0-9])?(\\d\\d\\d\\d\\d\\d\\d\\d)-?(\\d\\d\\d\\d(\\d\\d)?).*"</code> | ||
+ | * an optional prefix ending in a non-digit will be ignored (''"v"'') | ||
+ | * next 8 chars must be digits interpreted as the date (''"20201231"'') | ||
+ | * an optional <code>"-"</code> separator will be skipped (''"-"'') | ||
+ | * next, 4 or 6 digits are expected, interpreted as the time (if only 4 digits they will be right-padded) (''"235900"'') | ||
+ | * arbitrary postfix is again ignored (''"nightly"'') | ||
+ | |||
+ | Version qualifiers not matching that pattern cannot be used for creating a maven snapshot. | ||
+ | |||
+ | By marking individual [[#Maven Mapping|Maven Mappings]] as snapshot it is possible to create snapshot artifacts which then depend on release versions of other artifacts. | ||
+ | |||
+ | ===Example=== | ||
+ | A sample aggr file, [https://github.com/eclipse-cbi/p2repo-aggregator/blob/main/plugins/org.eclipse.cbi.p2repo.aggregator/samples/SDK4Mvn.aggr SDK4Mvn.aggr], shows an easy-to-use example of how to create a Maven-conformant p2 repository (i.e. one that works with Maven or p2). The sample has a short [https://github.com/eclipse-cbi/p2repo-aggregator/blob/main/plugins/org.eclipse.cbi.p2repo.aggregator/samples/SDK4Mvn.description.txt description file] that explains some of the details. | ||
=Headless support= | =Headless support= | ||
Line 364: | Line 378: | ||
| ''no value'' | | ''no value'' | ||
| Exclude all references that matches the given regular expression pattern. An exclusion takes precedence over an inclusion in case both patterns match a reference. | | Exclude all references that matches the given regular expression pattern. An exclusion takes precedence over an inclusion in case both patterns match a reference. | ||
+ | |||
+ | |- valign="top" | ||
+ | | '''--mavenBuildNumber''' | ||
+ | | <number> | ||
+ | | ''no value'' | ||
+ | | When producing a [[#Maven_Snapshots|maven snapshot]] the build number is supposed to uniquely identify a particular snapshot build. | ||
+ | |||
|} | |} | ||
Line 1,109: | Line 1,130: | ||
| - | | - | ||
| If Version Pattern matched the given Version, then this Version Template is used to construct the version as seen in Maven, useful in particular to shorten versions ending in ".0" to 2-part versions etc.. The Version Template may contain pattern group references (i.e. $1, ...).<br> | | If Version Pattern matched the given Version, then this Version Template is used to construct the version as seen in Maven, useful in particular to shorten versions ending in ".0" to 2-part versions etc.. The Version Template may contain pattern group references (i.e. $1, ...).<br> | ||
+ | Since {{bug|406557}} the special token "-SNAPSHOT" can be used after the main version part to denote a snapshot version.<br> | ||
If no Version Pattern is given or if the Version Pattern doesn't match, then the global strategy from Version Format is applied. | If no Version Pattern is given or if the Version Pattern doesn't match, then the global strategy from Version Format is applied. | ||
Line 1,187: | Line 1,209: | ||
This following list simply duplicates the documentation that describes the main jobs there and are listed in roughly the order they are typically ran in. | This following list simply duplicates the documentation that describes the main jobs there and are listed in roughly the order they are typically ran in. | ||
− | *[https://ci.eclipse.org/cbi/view/p2RepoRelated/job/cbi.p2repo. | + | *[https://ci.eclipse.org/cbi/view/p2RepoRelated/job/cbi.p2repo.aggregator_gerrit/ cbi.p2repo.aggregator_gerrit] |
Job to run a build of CBI aggregator based on a Gerrit patch in master branch. | Job to run a build of CBI aggregator based on a Gerrit patch in master branch. | ||
*[https://ci.eclipse.org/cbi/view/p2RepoRelated/job/cbi.p2repo.aggregator_cleanAndDeploy/ cbi.p2repo.aggregator_cleanAndDeploy] | *[https://ci.eclipse.org/cbi/view/p2RepoRelated/job/cbi.p2repo.aggregator_cleanAndDeploy/ cbi.p2repo.aggregator_cleanAndDeploy] |
Latest revision as of 07:27, 12 January 2024
Contents
- 1 Introduction
- 2 Functional Overview
- 3 Git repository
- 4 Installation
- 5 Getting started with standard examples
- 6 Headless support
- 7 Aggregation model components and specific actions
- 8 Legacy format support
- 9 What else should be documented
- 10 Information for developers of CBI aggregator
Introduction
The CBI Aggregator is one of the deliverables of the CBI project. It is a tool to combine several p2 repositories. Among other things, it makes sure they all have consistent constraints (that is, can be "installed together") unlike a raw p2 mirror task.
The CBI Aggregator was formerly known as "b3 aggregator" from the now defunct "Eclipse b3 Project" (see bug 506726).
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
Functional Overview
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.
Git repository
Git repository: https://github.com/eclipse-cbi/p2repo-aggregator/
Installation
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
|
Headless 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
where
- <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.13/
- -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
Mirroring contributions
(This example aggregation can be downloaded via the CBI project Git and opened in an appropriately set up workbench: [1]).
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
|