This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mike Cobbett <77053+techcobweb@users.noreply.github.com>
- Loading branch information
1 parent
86b6c88
commit f4f929d
Showing
27 changed files
with
569 additions
and
946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
# Maven Plugin for building Galasa | ||
|
||
This repository is an extension to Maven2 and includes goals that are used to build OSGI bundles and test catalogs for Galasa. The OSGI bundle repositories contain all the project information, configuration details and dependencies that are needed for building and running Galasa projects. The test catalog is used to manage Galasa test cases - attributes associated with test cases that are held in the catalog can used to schedule test runs. | ||
|
||
## How to build locally | ||
Use the `build-locally.sh` script to build this code locally. | ||
|
||
Environment variable over-rides: | ||
|
||
- `LOGS_DIR` - Optional. Where logs are placed. Defaults to creating a temporary directory. | ||
- `SOURCE_MAVEN` - Optional. Where a maven repository is from which the build will draw artifacts. | ||
- `DEBUG` - Optional. Defaults to 0 (off) | ||
- `GPG_PASSPHRASE` - Used to sign and verify artifacts during the build | ||
|
||
## How to use the plugin | ||
|
||
### Building a test catalog for a Java bundle | ||
|
||
This goal causes a test catalog to be constructed for all the tests in the child bundles of this maven project. | ||
|
||
Goal: `bundletestcat` | ||
|
||
Phase: `package` | ||
|
||
Input Parameters/Properties: | ||
- `galasa.skip.bundletestcatalog` required. | ||
|
||
Output: | ||
A test catalog file is generated holding references to all the test classes. | ||
|
||
Example: | ||
``` | ||
<plugin> | ||
<groupId>dev.galasa</groupId> | ||
<artifactId>galasa-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<id>build-testcatalog</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>bundletestcat</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
``` | ||
|
||
### Building an OBR resource | ||
|
||
Input Parameters/Properties: | ||
- `galasa.obr.url.type` property = "obrUrlType" optional | ||
- `includeSelf` optional. Default value is `false` | ||
|
||
### Publishing a test catalog to the Galasa ecosystem/server | ||
|
||
Goal: `deploytestcat` | ||
|
||
Phase: `deploy` | ||
|
||
Input Parameters/Properties: | ||
- `galasa.test.stream` required. A string. | ||
- `galasa.token` optional. An access token for the galasa ecosystem, if that ecosytem is using authentication. | ||
- `galasa.bootstrap` required. A URL to the ecosystem. | ||
- `galasa.skip.bundletestcatalog` optional. A boolean. If set to true, the test catalog is not deployed to the Galasa server. | ||
- `galasa.skip.deploytestcatalog` optional. A boolean. If set to true, the test catalog is not deployed to the Galasa server. | ||
|
||
For example: | ||
``` | ||
<plugin> | ||
<groupId>dev.galasa</groupId> | ||
<artifactId>galasa-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<executions> | ||
... | ||
<execution> | ||
<id>deploy-testcatalog</id> | ||
<phase>deploy</phase> | ||
<goals> | ||
<goal>deploytestcat</goal> | ||
</goals> | ||
</execution> | ||
... | ||
</executions> | ||
</plugin> | ||
``` | ||
|
||
#### Passing a secret token into a maven plugin. Method 1: using ${GALASA_TOKEN} | ||
|
||
The `galasa.token` maven property is used by this plugin. | ||
You can set it using the following in your pom.xml like this: | ||
|
||
``` | ||
<properties> | ||
... | ||
<galasa.token>${GALASA_TOKEN}</galasa.token> | ||
... | ||
</properties> | ||
``` | ||
|
||
This allows you to call maven and pass the value from the command-line | ||
``` | ||
mvn clean install deploy "-DGALASA_TOKEN=${GALASA_TOKEN}" | ||
``` | ||
|
||
This assumes you have `GALASA_TOKEN` set in your environment. | ||
|
||
Note: This method allows the caller of the command-line to pass in | ||
whatever value they want, from an environment variable (`GALASA_TOKEN` in this case) | ||
or from any other value. | ||
|
||
This may be useful if you are deploying to multiple Galasa server environments, | ||
or switching between tokens used to contact the Galasa Ecosystem. | ||
|
||
#### Passing a secret token into a maven plugin. Method 2: using ${env.GALASA_TOKEN} | ||
The `galasa.token` maven property is used by this plugin. | ||
You can set it using the following in your pom.xml like this: | ||
|
||
``` | ||
<properties> | ||
... | ||
<galasa.token>${env.GALASA_TOKEN}</galasa.token> | ||
... | ||
</properties> | ||
``` | ||
|
||
This allows you to set the GALASA_TOKEN as an environment variable, and | ||
the maven plugin for Galasa can pick up the value from the environment. | ||
|
||
Note: This causes a tighter 'binding' between your environment and the maven | ||
build, so all parties using this code need to use the same environment variable | ||
name. | ||
|
||
### Supressing the deploy of the test catalog | ||
Use the `galasa.skip.bundletestcatalog` or `galasa.skip.deploytestcatalog` to control whether | ||
the deploy of the test catalog is skipped. | ||
|
||
If either of these flags is true, then the publication of the test catalog to the Galasa | ||
ecosystem will be supressed. | ||
|
||
For example, to skip both the building of the test catalog and the deployment of it, you can | ||
add this to your pom.xml: | ||
``` | ||
<properties> | ||
... | ||
<galasa.skip.bundletestcatalog>true</galasa.skip.bundletestcatalog> | ||
<galasa.skip.deploytestcatalog>true</galasa.skip.deploytestcatalog> | ||
... | ||
</properties> | ||
``` | ||
|
||
Or you could pass a `-D` parameter on the command-line: | ||
``` | ||
mvn deploy -Dgalasa.skip.deploytestcatalog=true | ||
``` | ||
|
||
### Merging two test catalogs | ||
|
||
Input Parameters/Properties: | ||
- `galasa.skip.bundletestcatalog` optional. A boolean. | ||
- `galasa.build.job` optional. A string. | ||
|
||
### Building a gherkin test catalog for Gherkin features | ||
|
||
Input Parameters/Properties: | ||
- `galasa.skip.gherkintestcatalog` required. A boolean. | ||
|
||
|
||
### Building a .zip of gherkin tests | ||
|
||
This goal builds a zip file containing all the gherkin feature files. | ||
|
||
Goal: `gherkinzip` | ||
|
||
Phase: `package` | ||
|
||
Input Parameters/Properties: | ||
- `galasa.skip.gherkinzip` required. A boolean. | ||
|
||
|
||
### Calculating a git commit hash | ||
|
||
For example: | ||
``` | ||
<plugin> | ||
<groupId>dev.galasa</groupId> | ||
<artifactId>galasa-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<id>process-resources</id> | ||
<goals> | ||
<goal>gitcommithash</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
``` |
Oops, something went wrong.