No mention of Jenkins Shared Libraries? When Jenkinsfile pipelines start getting complex, or need to make them more generic, you can create groovy lib-s in a separate repository. Single line to load the lib dynamically at start of Jenkinsfile. Then you can call library functions/tasks passing appropriate params within your pipeline. But as anything Jenkins, documentation lacking or out of date.