Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jenkinsci/validating-string-parameter-plugin
Jenkins validating-string-parameter plugin
https://github.com/jenkinsci/validating-string-parameter-plugin
jenkins
Last synced: 9 days ago
JSON representation
Jenkins validating-string-parameter plugin
- Host: GitHub
- URL: https://github.com/jenkinsci/validating-string-parameter-plugin
- Owner: jenkinsci
- Created: 2010-12-13T05:58:05.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2025-01-14T10:29:33.000Z (21 days ago)
- Last Synced: 2025-01-17T11:10:37.678Z (18 days ago)
- Topics: jenkins
- Language: Java
- Homepage: https://plugins.jenkins.io/validating-string-parameter/
- Size: 213 KB
- Stars: 15
- Watchers: 97
- Forks: 35
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Validating String Parameter Plugin
[![Jenkins](https://ci.jenkins.io/job/Plugins/job/validating-string-parameter-plugin/job/master/badge/icon)](https://ci.jenkins.io/job/Plugins/job/validating-string-parameter-plugin/job/master/)
[![Jenkins Plugin](https://img.shields.io/jenkins/plugin/v/validating-string-parameter.svg)](https://plugins.jenkins.io/validating-string-parameter)
[![GitHub release](https://img.shields.io/github/release/jenkinsci/validating-string-parameter-plugin.svg?label=changelog)](https://github.com/jenkinsci/validating-string-parameter-plugin/releases/latest)The validating string parameter plugin contributes a new parameter type
to Jenkins that supports regular expression validation of the user's
entered parameter.# Usage
This plugin is used wherever build parameter selection is available,
most commonly in the job configuration page by enabling parameterized
builds (this parameter type will also be available as release parameters
using the [release
plugin](https://plugins.jenkins.io/release/)).Configure the parameter by entering a name, regular expression to
validate the entered value and optionally a default value, an error
message shown when the user entered value fails the regular expression
check and a parameter description.
![](docs/images/configure.PNG)When a build is requested, the user will be prompted with the parameters
to enter. Users enter the parameter as normal, but will now be prompted
with an error message if the entered value does not meet the regular
expression.![](docs/images/build-error.PNG)
Once the entered value meets the configured regular expression, the
error message is no longer displayed.![](docs/images/build-success.PNG)
## Pipeline Examples
```groovy
pipeline {
agent anyparameters {
validatingString(
name: 'param1',
defaultValue: '',
regex: /^[0-9]+$/,
failedValidationMessage: '',
description: 'Numbers only parameter example'
)
}stages {
stage("Check") {
steps {
echo "${params.param1}"
}
}
}
}
```