Artifact repository connector
Description
The artifact repository connector for Automation Packages provides a seamless integration with classical artifact repositories like Nexus. It enables the retrieval and execution of Automation Packages that are deployed on artifact repositories. The main use-case of this plugin is the integration with CI/CD pipelines. A common workflow relying on this feature looks as follow:
- Development of Step Automation Packages along with the source code of the application to be tested
- Build of the Automation Packages as part of the CI pipeline and deployment of the Automation Packages to an artifact repository
- Trigger of the central execution of the Automation Packages on a Step Controller by the CI pipeline via artifact repository plugin
Usage
The artifact repository connector works like any other repository plugin like ALM, Jira, etc. It retrieve Automation Packages from an Artifact repository via Maven and executes all the Plans contained in the package.
To start the execution of a an Automation Package using artifact repository connector you have 2 options:
- Manual start via STEP UI
- Trigger the start via Step Client or REST API
Manual start via STEP UI
Navigate to http://mycontroller:8080/#/root/repository?repositoryId=Artifact&groupId=…&artifactId=…&version=…
The following parameters allow to execute the embedded plans of a jar:
- groupId, artifactId, version and classifier : the maven coordinates of the jar to execute. The classifier is optional and the three others are mandatory
- libGroupId, libArtifactId, libVersion and libClassifier: the maven coordinates of an optional library, containing the Keyword dependencies. all of these parameters are optional.
- If libGroupId or libVersion are omitted but libArtifactId is specified, the value of groupId and version are taken to search for the dependency.
- If only libClassifier is specified; groupId, artifactId and version are taken to search for the dependency
- includePlans, excludePlans, includeCategories and excludeCategories: optional parameters allowing to filter the tests to run based on the plan names or categories assigned to the plans
- threads: Optional, the number of threads used by the TestSet. Default to 1
- mavenSettings: Optional, the name of the controller parameter to use for finding the settings.xml. Default to “default”
Execution via the Step Client
try (StepClient client = new StepClient("url","user","password")) {
ExecutionParameters executionParams = new ExecutionParameters();
executionParams.setMode(ExecutionMode.RUN);
executionParams.setUserID("user");
executionParams.setDescription("description");
RepositoryObjectReference repoObject = new RepositoryObjectReference();
repoObject.setRepositoryID("Artifact");
Map<String, String> repoParameters = new HashMap<String, String>() {{
put("groupId","ch.my.group");
put("artifactId","my-artifact");
put("version","0.0.0-SNAPSHOT");
}};
repoObject.setRepositoryParameters(repoParameters);
executionParams.setRepositoryObject(repoObject);
String executionID = client.getExecutionManager().execute(executionParams);
}
Execution via REST
POST /rest/executions/start
{
"userID": "admin",
"description": "Test",
"mode": "RUN",
"repositoryObject": {
"repositoryID": "Artifact",
"repositoryParameters": {
"groupId": "ch.my.group",
"artifactId": "my-artifact",
"version": "0.0.0-SNAPSHOT"
}
},
"exports": [],
"isolatedExecution": false,
"customParameters": {
"EXEC_PARAM": "Value"
}
}
Changing the maven setting
When retrieving artifacts from a maven repository, it may be necessary to change the setting used by the Step controller.
This can be done via the controller parameter maven_settings_default and can be configured with the following REST call:
POST /rest/settings/maven_settings_default
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>my-repository</id>
<name>my repository</name>
<url>https://at.home.ch/repository/maven/</url>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>my-repository</id>
<username>myUser</username>
<password>myPassword</password>
</server>
</servers>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
</settings>
Note that you can configure different settings by calling POST /rest/settings/maven_settings_mySettings and specifying the setting name with the mavenSettings parameter:
POST /rest/executions/start
{
"userID": "admin",
...
"repositoryObject": {
"repositoryID": "Artifact",
"repositoryParameters": {
...
"mavenSettings":"mySettings"
}
},
"exports": [],
"isolatedExecution": false,
"customParameters": {
"EXEC_PARAM": "Value"
}
}