I do not want to allow two jobs of the same type (same repository) to run in parallel on the same node.
How can I do this using groovy inside Jenkinsfile ?
I think there are more than just one approach to this problem.
lock step, as suggested in other answer. Execute concurrent builds if necessary.node or label for each project.1?