I dealt with the same problem for my own work. The best solution I could find was that in every project / repo in my organization there was a common Jenkinsfile:
node { checkout([$class: 'GitSCM', branches: [[name: env.DELIVERY_PIPELINE_BRANCH]], userRemoteConfigs: [[credentialsId: env.DELIVERY_PIPELINE_CREDENTIALS, url: env.DELIVERY_PIPELINE_URL]]]) stash includes: '*.groovy', name: 'assets', useDefaultExcludes: false load './Jenkinsfile.groovy' }
I used environment variables in case something should change, maybe it can be even more dynamic than my current current one (anyway, itβs still in development).
Then stash is used to store the remaining groovy scripts used later and deactivate them in the declarative pipeline.
Finally, it loads the declarative pipeline. It doesnβt mix with representations, basically everything behaves normally.
So this is not exactly what you were looking for, and I'd rather be able to just pull it out of SCM. But hey, it works well enough for me at the moment.
source share