0

I have a Java project in http://localhost:7990/scm/bout/boutique-a.git I want to have 2 Jenkins pipeline jobs:

  • Job 1/ trigger on commit done on */develop
  • Job 2/ trigger on commit done on any */feature p each job will do a basic mvn install, mvn test, sonar ...

a simple script with

    node {
     checkout([$class: 'GitSCM',
     branches: [[name: 'develop]],
     doGenerateSubmoduleConfigurations: false,
     extensions: [[$class: 'SubmoduleOption', disableSubmodules: false,
     parentCredentials: false, recursiveSubmodules: true, reference: '',
     trackingSubmodules: false]], submoduleCfg: [],
     userRemoteConfigs: [[credentialsId: 'admin',
     url: 'http://localhost:7990/scm/bout/boutique-a.git']]])
    }

works if a commit is done in /develop or if I give explicitly the branch name like feature/test-a but how to configure a script for any feature/

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189

1 Answers1

0

It seems that what i'm asking is not possible using pipeline job. I found a work arround for "feature/** ". I created a param BRANCH_NAME in the job, then the branch name is send by bitbucket when a push is made on "feature/** " through a basic POST request.

http://user:token@localhost:8081/jenkins/job/MY_JOB_NAME/buildWithParameters?token=U1C1yQo7x3&BRANCH_NAME=feature/branche-test