How do you test a Jenkinsfile change without breaking the main pipeline?

IntermediateConceptJenkins
Answer

Options in increasing rigour: use the Replay feature on a run to edit and re-run the Jenkinsfile without committing; run the declarative linter (curl -X POST -F "jenkinsfile=<Jenkinsfile" $JENKINS_URL/pipeline-model-converter/validate); work on a branch, since multibranch builds use that branch's Jenkinsfile; and unit test shared libraries with JenkinsPipelineUnit. Use a staging Jenkins for plugin or core upgrades.

All CI/CD questions

More on Jenkins