Have you seen Generic Webhook Trigger 
Plugin? https://github.com/jenkinsci/generic-webhook-trigger-plugin

Exact usage depends on what Git service you are using. If it is GitHub you 
may have a look at this:
https://github.com/jenkinsci/generic-webhook-trigger-plugin/blob/master/src/test/resources/org/jenkinsci/plugins/gwt/bdd/github/github-push-specific-branches.feature

Den måndag 15 juli 2019 kl. 01:38:04 UTC+2 skrev Francis Chuang:
>
> 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 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7494d2c3-2f23-4695-b0f1-90b57e9b6a69%40googlegroups.com.

Reply via email to