From 766db0047b6decef51e662880aad3d154332c43e Mon Sep 17 00:00:00 2001 From: Zhao Xiaojie Date: Thu, 18 Apr 2019 14:14:37 +0800 Subject: [PATCH] Add an example for how to use parameter --- .../parameters-using-steps.groovy | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 declarative-examples/simple-examples/parameters-using-steps.groovy diff --git a/declarative-examples/simple-examples/parameters-using-steps.groovy b/declarative-examples/simple-examples/parameters-using-steps.groovy new file mode 100644 index 0000000..2d45f26 --- /dev/null +++ b/declarative-examples/simple-examples/parameters-using-steps.groovy @@ -0,0 +1,29 @@ +pipeline { + agent any + + parameters { + text defaultValue: 'anonymous', description: 'my name', name: 'name' + booleanParam defaultValue: true, description: 'whether skip this', name: 'skip' + } + + stages{ + stage("one"){ + steps{ + echo params.name + } + } + + stage("two"){ + when{ + anyOf{ + expression{ + return params.skip + } + } + } + steps{ + echo "stage two" + } + } + } +}