Developing a Jenkinsfile is very difficult because even simple functions are not whitelisted. Examples of strange things:
- the .contains() function for maps/lists
- when declaring a map in Jenkinsfile, the key cannot be named print or println (Jenkins thinks, the equally named functions are used here)
- When a map contains functions (closures), Jenkins does not allow writing myMap.myFunction arg1 arg2 because Jenkins thinks, myFunction is a function defined in the Map<...> class. Since the Jenkinsfile is simply a groovy file, I think that I can use the Map property notation.
Also, when using a Multibranch Pipeline project, writing a Jenkinsfile needs lots of commits, if I need to try something out (which does not always work, see points above).
Improvement:
- Make the whitelist editable (and, in a help box, the syntax needed to add properly formatted entries)
- Provide a Jenkinsfile "validator" which gets a Jenkinsfile (via text box or upload) and which checks, if this file can be used in terms of syntax/whitelist. This will prevent users to make many commits while developing a Jenkinsfile.