Was trying to split out common code in separate lib, but it's not at all trivial. The way to do it for declarative syntax Jenkinsfile is by using Shared Libraries which requires separate repo!
The patch ended up being just naming refactors.
Renames OUTPUTDIR to OUTPUT_DIR
Renames OUTPUT_RELATIVE to OUTPUT_DIR_RELATIVE