Hey all,
I have a question with configuring Jenkins that I have been struggling
with for a while. We are using Jenkins 2.150.1.
My jenkinsfile looks like this:
pipeline {
agent {
node {
label 'some-node'
}
}
environment {
COMPOSE_PROJECT_NAME = "${env.JOB_NAME}-${env.BUILD_ID}"
}
options {
timeout(time: 40, unit: 'MINUTES')
}
stages {
stage('Build Site') {
when {
branch 'test-site'
}
steps {
...
}
}
stage('Build Javadoc') {
when {
buildingTag()
}
steps {
...
}
}
stage('Deploy Site') {
when {
branch 'test-site'
}
steps {
...
}
stage('Deploy Javadoc') {
when {
buildingTag()
}
steps {
...
}
}
}
post {
always {
sh 'docker system prune --force --all'
}
}
}
I want to run a pipeline when a commit is pushed to a branch. I am able
to do this by setting "Branches to build" to `refs/heads/test-site`.
However, I also need to build a pipeline when a tag that matches a regex
is pushed. I tried adding a refspec following
https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/136740885/Triggering+Jenkins+Based+on+New+Tags
, however it doesn't trigger the build.
Does anyone have any tips for how to get this to work?
Francis