gradleExecuteBuild¶
This step runs a gradle build command with parameters provided to the step.
Description¶
This step runs a gradle build command with parameters provided to the step.Supports execution of gradle tasks with or without wrapper.Gradle tasks and flags can be specified via 'task' or 'buildFlags' parameter. If both are not specified 'build' task will run by default.
Usage¶
We recommend to define values of step parameters via .pipeline/config.yml file.
In this case, calling the step is essentially reduced to defining the step name.
Calling the step can be done either in an orchestrator specific way (e.g. via a Jenkins library step) or on the command line.
library('piper-lib-os')
gradleExecuteBuild script: this
piper gradleExecuteBuild
Outputs¶
Output type | Details |
---|---|
commonPipelineEnvironment |
|
Parameters¶
Overview - Step¶
Name | Mandatory | Additional information |
---|---|---|
script | (yes) | reference to Jenkins main pipeline script |
applyPublishingForAllProjects | no | |
artifactGroupId | no | |
artifactId | no | |
artifactVersion | no | |
buildFlags | no | |
createBOM | no | |
excludeCreateBOMForProjects | no | |
excludePublishingForProjects | no | |
path | no | |
publish | no | |
repositoryPassword | no | pass via ENV or Jenkins credentials |
repositoryUrl | no | |
repositoryUsername | no | pass via ENV or Jenkins credentials |
task | no | |
useWrapper | no | |
verbose | no | activates debug output |
Overview - Execution Environment¶
Orchestrator-specific only
These parameters are relevant for orchestrator usage and not considered when using the command line option.
Name | Mandatory | Additional information |
---|---|---|
containerCommand | no | |
containerShell | no | |
dockerEnvVars | no | |
dockerImage | no | |
dockerName | no | |
dockerOptions | no | |
dockerPullImage | no | |
dockerVolumeBind | no | |
dockerWorkspace | no |
Details¶
applyPublishingForAllProjects¶
If set to false publishing logic will be applied in 'rootProject' directive, otherwise 'allprojects' will be directive used
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
artifactGroupId¶
The group of the artifact.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_artifactGroupId (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: groupId |
artifactId¶
The name of the artifact.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_artifactId (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: artifactId |
artifactVersion¶
Version of the artifact to be built.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_artifactVersion (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: artifactVersion |
buildFlags¶
Defines a list of tasks and/or arguments to be provided for gradle in the respective order to be executed. This list takes precedence if specified over 'task' parameter
To run command gradle clean build -x test
, it can be achieved as follows
steps:
gradleExecuteBuild:
buildFlags:
- clean
- build
- -x
- test
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_buildFlags (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
containerCommand¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Allows to specify start command for container created with dockerImage parameter to overwrite Piper default (/usr/bin/tail -f /dev/null).
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
containerShell¶
Jenkins-specific: Used for proper environment setup.
Allows to specify the shell to be executed for container with containerName.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
createBOM¶
Creates the bill of materials (BOM) using CycloneDX plugin.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerEnvVars¶
Jenkins-specific: Used for proper environment setup.
Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerImage¶
Jenkins-specific: Used for proper environment setup.
Name of the docker image that should be used. If empty, Docker is not used and the command is executed directly on the Jenkins system.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | gradle:6-jdk11-alpine |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerName¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Name of the container launching dockerImage. SideCar only: Name of the container in local network.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | gradle |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerOptions¶
Jenkins-specific: Used for proper environment setup.
Docker options to be set when starting the container.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerPullImage¶
Jenkins-specific: Used for proper environment setup.
Set this to 'false' to bypass a docker image pull. Useful during development process. Allows testing of images which are available in the local registry only.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | true |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerVolumeBind¶
Jenkins-specific: Used for proper environment setup.
Volumes that should be mounted into the docker container.
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerWorkspace¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME
.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
excludeCreateBOMForProjects¶
Defines which projects/subprojects will be ignored during bom creation. Only if applyCreateBOMForAllProjects is set to true
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_excludeCreateBOMForProjects (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
excludePublishingForProjects¶
Defines which projects/subprojects will be ignored during publishing. Only if applyCreateBOMForAllProjects is set to true
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_excludePublishingForProjects (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
path¶
Path to the folder with build.gradle (or build.gradle.kts) file which should be executed.
Scope | Details |
---|---|
Aliases | buildGradlePath |
Type | string |
Mandatory | no |
Default | $PIPER_path (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
publish¶
Configures gradle to publish the artifact to a repository.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
repositoryPassword¶
Password for the repository to which the project artifacts should be published.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_repositoryPassword (if set) |
Secret | yes |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/repositoryPassword |
repositoryUrl¶
Url to the repository to which the project artifacts should be published.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_repositoryUrl (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/repositoryUrl |
repositoryUsername¶
Username for the repository to which the project artifacts should be published.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_repositoryUsername (if set) |
Secret | yes |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/repositoryUsername |
script¶
Jenkins-specific: Used for proper environment setup.
The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the this
parameter, as in script: this
. This allows the function to access the commonPipelineEnvironment
for retrieving, e.g. configuration parameters.
Scope | Details |
---|---|
Aliases | - |
Type | Jenkins Script |
Mandatory | yes |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
task¶
A single gradle task that should be executed. If you prefer more than one, use 'buildFlags' parameter. If 'buildFlags' parameter is specified, this parameter will be ignored.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | build |
Secret | no |
Configuration scope |
|
Resource references | none |
useWrapper¶
If set to false all commands are executed using 'gradle', otherwise 'gradlew' is executed.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
verbose¶
verbose output
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |