Lets assume there are two job:
I'd like, in specific cases, to start the end-to-end tests job from the micro-service job. For example, after introducing a change that even though passed unit testing and integration testing, it needs further testing, available in the end-to-end tests job.
I'd like for the developers to make a commit with a specific phrase. To that end, I implemented the following in the micro-service pipeline:
pipeline {
...
...
stages {
...
}
post {
success {
if (BRANCH_NAME == "develop") {
result = sh (script: "git log -1 | grep '.*\\[e2e\\].*'", returnStatus: true)
if (result == 0) {
build job: '****', wait: false
}
}
}
...
...
}
}
This seemingly works, as I see the following in the log:
git log -1
grep '.[e2e].'
Run tests [e2e] [Pipeline] build (Building ****)
Scheduling item: ****
So it found "[e2e]" and supposedly scheduled a build in the end-to-end tests job, but in actuality nothing happened - no job was scheduled/run.
Because I am using a multi-branch job, I had to - of course - also specify the branch name... d'oh.
build job: '****/master', wait: false