I am doing code review with gerritcodereview and I need to create a jenkins pipeline for CI, CD. I am using the events triggered by gerrit trigger plugin.
I want to obtain this:
PastchSet Created
- build start on refs/changes/**/**/** branch
- report results to gerrit for code review
Change Merged(into develop) or Ref Updated(develop)
- build start on origin/develop branch
- deploy code to internal server
Ref Updated(master)
- build start on origin/master branch
- deploy code to external server
Questions for which I didn't find good answers:
- do I need to use a simple pipeline or multibranch pipeline?
- how do I start the build on the correct branch?
- how can I checkout the correct branch using a Jenkinsfile instead of using the configuration page?