Maven plugin
The Step Maven plugin serves as Command Line Interface (CLI) for all operations related to Automation Packages in Java. It provides an integration with the Step server and an easy way to integrate Step with a CI/CD pipeline. For non-Java projects, it is recommended to use the Step CLI.
The Step Maven plugin supports following operations:
- Upload Automation Packages to Step and execute them in isolation
- Deploy the content of Automation Packages to Step and enable the contained schedules
- Deploy an Automation Packages library to Step
You can choose to integrate the plugin goals during the package phase or any later phase as you see fit in the Maven Lifecycle.
Integration
To include the Step plugin in your project you need to add the appropriate dependency to the <pluginManagement> section in your pom.xml.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>ch.exense.step</groupId>
<artifactId>step-maven-plugin</artifactId>
<version>${step.plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
You can list the available plugin goals by calling the following command (in the folder of a maven project including the step-maven-plugin):
mvn step:help
To display the parameters of some plugin goal you can use the following command:
mvn step:help -Ddetail=true -Dgoal=goal-name
Once you have declared the plugin in the <pluginManagement> section, you can use it as any common Maven plugin: call a plugin goal directly from the command line, or bind a goal to a phase of the maven lifecycle (using the <plugins> section of the pom.xml file).
Integration with Step Enterprise Edition
The maven plugin supports the following optional features which are required to communicate with Step Enterprise, but should be left empty for Step Open Source:
- Authentication: the plugin allows to configure the API token which is used to authenticate to Step
- Project selection (multitenancy): because a user can have access to several projects in Step, the EE version allows to select the target project for deploying and running packages
Optional When triggering an execution on Step, an error summary is collected at the end of the execution in case of failure. To read error reports related to enterprise specific features an additional dependency reserved to Enterprise customer is required.
<pluginRepositories>
<pluginRepository>
<id>nexus-exense</id>
<url>https://nexus-enterprise.exense.ch/repository/exense/</url>
</pluginRepository>
</pluginRepositories>
<build>
<pluginManagement>
<plugins>
<!-- Make the Step maven plugin available -->
<plugin>
<groupId>ch.exense.step</groupId>
<artifactId>step-maven-plugin</artifactId>
<version>${step.version}</version>
<!-- adding dependencies to reports nodes for enterprise artefacts, only required to read errors that may occur during isolated executions -->
<dependencies>
<dependency>
<groupId>ch.exense.step-enterprise</groupId>
<artifactId>step-maven-plugin-ee-extensions</artifactId>
<version>${step.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Usage
Detailed descriptions of the goals are provided below.
Execute Automation Packages in Step
The maven goal execute-automation-package runs (executes) the plans contained in an Automation Package, on a one-off basis, and in an ephemeral context that is destroyed afterward. In other words, the Automation Package and its contents are not made permanently available on the server, but exist only temporarily during the execution.
The Automation Packages can either be:
- built as a part of current maven project
- an artefact deployed on an artifact repository
For this last case, the artifactGroupId, artifactId and artifactVersion must be specified. Remember that your Step instance needs to be configured to access this artifact repository.
| Property (xml) | Command Line Alias | Description | Required | Default Value |
|---|---|---|---|---|
| url | step.url | The URL of running Step server | true | |
| stepProjectName | step.step-project-name | The name of the target project in Step (Step Enterprise only) | false | |
| authToken | step.auth-token | The authentication token issued by the Step server (Step Enterprise only) | false | |
| userId | step-execute-auto-packages.user-id | The user id used for starting the execution | false | user of the authentication token |
| artifactGroupId | step-execute-auto-packages.artifact-group-id | For execution from an artifact repository: the group id of the maven artifact | false | |
| artifactId | step-execute-auto-packages.artifact-id | For execution from an artifact repository: The id of the maven artifact | false | |
| artifactVersion | step-execute-auto-packages.artifact-version | For execution from an artifact repository: The version of the maven artifact | false | |
| artifactClassifier | step-execute-auto-packages.artifact-classifier | The classifier of the maven artifact (jar, jar-with-dependencies, tests etc) to be selected locally or to be used for remote artifact | false | no classifier |
| artifactType | step-execute-auto-packages.artifact-type | For execution from an artifact repository, the type of the maven artifact (jar, zip, dll etc) | false | no type |
| library | step-execute-auto-packages.library | Optionally define the libary to be used for the execution. This is a nested configuration supporting either the fields
|
false | no library |
| executionParameters | step-execute-auto-packages.execution-parameters | The execution parameters to be set for the execution | false | |
| waitForExecution | step-execute-auto-packages.wait-for-exec | If this value is ‘false’, the execution is started asynchronously and the maven lifecyle continues without waiting the execution result. If this value is ’true’, the maven lifecycle is suspended until the execution is finished | false | true |
| executionResultTimeoutS | step-execute-auto-packages.exec-result-timeout-s | If the value of waitForExecution is true, this timeout (in seconds) is applied for running execution |
false | 30 |
| ensureExecutionSuccess | step-execute-auto-packages.ensure-exec-success | If the value of waitForExecution is true, the plugin will analyze the execution result and stop the maven lifecycle if this results is not successful |
false | true |
| includePlans | step-execute-auto-packages.include-plans | Comma-separated list of plans to include in the execution | false | all plans |
| excludePlans | step-execute-auto-packages.exclude-plans | Comma-separated list of plans to exclude from the execution | false | |
| includeCategories | step-execute-auto-packages.include-categories | Comma-separated list of categories to include in the execution | false | all categories |
| excludeCategories | step-execute-auto-packages.exclude-categories | Comma-separated list of categories to exclude from the execution | false | |
| wrapIntoTestSet | step-execute-auto-packages.wrap-into-test-set | When true, wraps all the plans into a TestSet at execution time. All the plans are then executed within a single TestSet instead of executing all the plans individually. | false | false |
| numberOfThreads | step-execute-auto-packages.number-of-threads | When wrapIntoTestSet is true, this option can be used to defines the parallelism within the TestSet. | false | 1 |
| reports | step-execute-auto-packages.reports | Specifies reports to be generated after the execution. It contains 2 nested properties:
|
false |
Example:
<plugin>
<groupId>ch.exense.step</groupId>
<artifactId>step-maven-plugin</artifactId>
<executions>
<execution>
<id>run-automation-package-in-step</id>
<phase>package</phase>
<configuration>
<url>http://localhost:4201</url>
<stepProjectName>Common</stepProjectName>
<authToken>eyJhbGciO.....iJIUzI</authToken>
<executionParameters>
<env>PROD</env>
<PARAM_EXEC>Value</PARAM_EXEC>
<PARAM_EXEC2>Value</PARAM_EXEC2>
</executionParameters>
<reports>
<report>
<type>junit</type>
<output>file,stdout</output>
</report>
<report>
<type>aggregated</type>
</report>
</reports>
</configuration>
<goals>
<goal>execute-automation-package</goal>
</goals>
</execution>
</executions>
</plugin>
To call the plugin from the command line you can use the following command:
mvn package step:execute-automation-package "-Dstep.url=https://your.step.server/" "-Dstep.step-project-name=Common" "-Dstep.auth-token=yourtoken"
Please note the call to the package phase in this command line: it is required because the command step:execute-automation-package doesn’t build the project.
Deploy Automation Packages to Step
The maven goal deploy-automation-package deploys an Automation Package on a Step Server. The deployment makes available (and activates) all content contained in the Automation Package, such as keywords, plans, schedules, etc.
| Property (xml) | Command Line Alias | Description | Required | Default Value |
|---|---|---|---|---|
| url | step.url | The URL of running Step server | true | |
| stepProjectName | step.step-project-name | The name of the target project in Step | false | |
| authToken | step.auth-token | The authentication token issued by Step server | false | |
| async | step-deploy-automation-package.async | Updating an existing package while executions based on it are running will be delayed until these executions end. Whith this property set to true, the plugin will not wait in case of delayed updates | false | false |
| versionName | step-deploy-automation-package.version-name | Optionally set the version of this automation package. This allows to deploy and use multiple versions of the same package on Step in combination with an activationExpression (more details) | false | |
| activationExpression | step-deploy-automation-package.activation-expression | When deploying multiple versions of the same package (see “versionName”), the expression is used to select the proper versions during the execution of plans. Example: “env == PROD” | false | |
| artifactGroupId | step-deploy-auto-packages.artifact-group-id | For deployment from an artifact repository: the group id of the maven artifact | false | |
| artifactId | step-deploy-auto-packages.artifact-id | For deployment from an artifact repository: The id of the maven artifact | false | |
| artifactVersion | step-deploy-auto-packages.artifact-version | For deployment from an artifact repository: The version of the maven artifact | false | |
| artifactClassifier | step-deploy-automation-package.artifact-classifier | The classifier of the maven artifact (jar, jar-with-dependencies, tests etc) | false | no classifier |
| artifactType | step-deploy-auto-packages.artifact-ytpe | For deployment from an artifact repository: The type of the maven artifact (jar, zip, dll) | false | |
| library | step-deploy-auto-packages.library | Optionally define the libary to be used for the deployment. This is a nested configuration supporting either the fields
|
false | no library |
| forceRefreshOfSnapshots | step-deploy-auto-packages.force-refresh-snapshots | Optionally forces a refresh of the SNAPSHOT artifact used by the package or its libraries, and reloads all Automation Packages that depend on it. Check the related documentation for more details. | false | use existing SNAPSHOT on Step |
<plugin>
<groupId>ch.exense.step</groupId>
<artifactId>step-maven-plugin</artifactId>
<executions>
<execution>
<id>deployed-automation-package-in-step</id>
<phase>deploy</phase>
<configuration>
<url>http://localhost:4201</url>
<stepProjectName>Common</stepProjectName>
<authToken>eyJhbGciO.....iJIUzI</authToken>
</configuration>
<goals>
<goal>deploy-automation-package</goal>
</goals>
</execution>
</executions>
</plugin>
To call the plugin from command line you can use the following command from the maven module where you have the deployed artifact with step Automation Package:
mvn deploy step:deploy-automation-package "-Dstep.url=https://your.step.server/" "-Dstep.step-project-name=Common" "-Dstep.auth-token=your_token_in_text_format"
Deploy Libraries to Step
You can deploy Automation Package libraries individually to a Step instance using the maven goal deploy-library. The library can either be deployed as a common or managed library.
| Property (xml) | Command Line Alias | Description | Required | Default Value |
|---|---|---|---|---|
| url | step.url | The URL of the running Step server | true | |
| stepProjectName | step.step-project-name | The name of the target project in Step | false | |
| authToken | step.auth-token | The authentication token issued by Step server | false | |
| artifactClassifier | step-deploy-library.artifact-classifier | The classifier of the maven artifact (jar, jar-with-dependencies, tests etc) used for the local build or for deployment from an artifact repository | false | no classifier |
| artifactGroupId | step-deploy-library.artifact-group-id | For deployment from an artifact repository: the group id of the maven artifact, when provided artifcatId and artifactVersion are required too | false | |
| artifactId | step-deploy-library.artifact-id | For deployment from an artifact repository: The id of the maven artifact | false | |
| artifactVersion | step-deploy-library.artifact-version | For deployment from an artifact repository: The version of the maven artifact | false | |
| artifactType | step-deploy-library.artifact-ytpe | For deployment from an artifact repository: The type of the maven artifact (jar, zip, dll) | false | |
| artifactType | step-deploy-library.artifact-ytpe | For deployment from an artifact repository: The type of the maven artifact (jar, zip, dll) | false | |
| managedLibraryName | step-deploy-library.managed-library-name | Is used to deploy the library as a managed library and set its name, otherwise a commong library is deployed | false |
<plugin>
<groupId>ch.exense.step</groupId>
<artifactId>step-maven-plugin</artifactId>
<executions>
<execution>
<id>deploy-library-in-step</id>
<phase>deploy</phase>
<configuration>
<url>http://localhost:4201</url>
<stepProjectName>Common</stepProjectName>
<authToken>eyJhbGciO.....iJIUzI</authToken>
</configuration>
<goals>
<goal>deploy-library</goal>
</goals>
</execution>
</executions>
</plugin>