简体   繁体   中英

how to synchronize jenkins' builds?

my build consists of many stages. one of them is to perform database tests on a real database. i'd like to configure:

  • one build that will test all important (whatever it means) branches
  • second parametrized build: 'test my branch'

the problem is i have only 1 available database so the db test phase must be synchronized between builds. two processes can't use same database at same time or tests results will be wrong.

i didn't find any option to synchronize stages. is there any plugin or configuration option i missed?

Look into the Jenkins Lockable Resources plugin.

Then define a "database" which as a lockable resource, and have both jobs require one database. The job that is launched first will acquire the database and the secondary job will block.

https://wiki.jenkins-ci.org/display/JENKINS/Lockable+Resources+Plugin

First you may try to use Pipeline plugin which is creating workflow of builds which can be executed on one click:

https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin

Secondly if you can use junit test @Category which can group some tests and execute them for example usig maven profile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM