Suppose we have a very expensive test in terms of time. This may be some kind of deep analysis or performance test. I would like to run this on a sample of CI events in a Jenkins pipeline, say 20% of the pipeline executions.
What strategy could one use in the Jenkinsfile to determine whether this stage should be run? Would a global definition to select a random number work?
Note that we have the constraint of using the declarative pipeline format, so scripted steps should be avoided.