Blueprint project to demonstrate the source code based generation of Jenkins jobs and views via a Gradle task. The jobs are thought to trigger the (repeated) execution of Cucumber features and monitor the results. The job names are generated out of the feature file names, the execution environment (e.g. prod, uat) and cucumber tags (e.g. smoke) contained in the feature files. For each env and tag combination (e.g. 'smoke.uat' or 'untagged.prod') a view and a multijob is created. A multijob is a parent (or upstream) job which comprises all child (or downstream) jobs which correspond to the tag/env - specification.
-
download, install and start Jenkins (example assumes Jenkins at http://localhost:8080, as configured here)
-
install Jenkins plugins
-
setup a gradle user with permissions to run scripts as well as to create, update and delete jobs and views
-
configure the number of executors in global Jenkins settings
create and/or update jobs/views on your Jenkins server
./gradlew updateJenkinsItems -Pjenkins_user=gradle -Pjenkins_pass=<password>
remove all items on server
./gradlew deleteJenkinsItems -Pjenkins_user=gradle -Pjenkins_pass=<password>
check which project job/view configuration differs from the server version
./gradlew validateJenkinsItems -Pjenkins_user=gradle -Pjenkins_pass=<password>
run all cucumber features
./gradlew cucumber