This is an automated email from the ASF dual-hosted git repository.
ivank pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 96ff1c0 Jenkins seed job for testing DSLs
96ff1c0 is described below
commit 96ff1c0d44bf1ac6b0ce3ca21053ae10ab7e2294
Author: Ivan Kelly <[email protected]>
AuthorDate: Wed Mar 14 15:20:03 2018 +0100
Jenkins seed job for testing DSLs
The job allows you to specify a repo and a branch. It will look for
all files named .test-infra/jenkins/jenkins_testing_job_*.groovy and
try to generate jobs for them. The seed job is in the folder
bookkeeper-jenkins-testing/ and has lookupStrategy set to
'SEED_JOB'. This means that any job generated by this seed will be
created in the same folder, thus lowering the chance of breaking our
existing production jobs.
Author: Ivan Kelly <[email protected]>
Reviewers: Jia Zhai <None>, Sijie Guo <[email protected]>
This closes #1248 from ivankelly/test-seed
---
.test-infra/jenkins/job_seed.groovy | 1 +
.../{job_seed.groovy => job_testing_seed.groovy} | 46 ++++++++++++----------
site/community/testing.md | 12 ++++++
3 files changed, 38 insertions(+), 21 deletions(-)
diff --git a/.test-infra/jenkins/job_seed.groovy
b/.test-infra/jenkins/job_seed.groovy
index a77d056..bffafac 100644
--- a/.test-infra/jenkins/job_seed.groovy
+++ b/.test-infra/jenkins/job_seed.groovy
@@ -40,6 +40,7 @@ job('bookkeeper-seed') {
'/seed')
steps {
+ folder('bookkeeper-jenkins-testing')
dsl {
// A list or a glob of other groovy files to process.
external('.test-infra/jenkins/job_*.groovy')
diff --git a/.test-infra/jenkins/job_seed.groovy
b/.test-infra/jenkins/job_testing_seed.groovy
similarity index 55%
copy from .test-infra/jenkins/job_seed.groovy
copy to .test-infra/jenkins/job_testing_seed.groovy
index a77d056..5688ba7 100644
--- a/.test-infra/jenkins/job_seed.groovy
+++ b/.test-infra/jenkins/job_testing_seed.groovy
@@ -16,34 +16,38 @@
* limitations under the License.
*/
-import common_job_properties
+job('bookkeeper-jenkins-testing/seed') {
+ description('Seed job, which allows DSL jobs to be tested before being
pushed for review')
-// Defines the seed job, which creates or updates all other Jenkins projects.
-job('bookkeeper-seed') {
- description('Automatically configures all Apache BookKeeper Jenkins projects
based' +
- ' on Jenkins DSL groovy files checked into the code repository.')
-
- // Set common parameters.
- common_job_properties.setTopLevelMainJobProperties(delegate)
+ // Source code management.
+ scm {
+ git {
+ remote {
+ url('${gitrepo}')
+ refspec('+refs/heads/*:refs/remotes/origin/*')
+ }
+ branch('${sha1}')
+ extensions {
+ cleanAfterCheckout()
+ }
+ }
+ }
- // This is a post-commit job that runs once per day, not for every push.
- common_job_properties.setPostCommit(
- delegate,
- 'H 6 * * *',
- false,
- '[email protected]')
+ parameters {
+ stringParam(
+ 'gitrepo', 'https://github.com/apache/bookkeeper/', 'Repo to clone')
- // Allows triggering this build against pull requests.
- common_job_properties.enablePhraseTriggeringFromPullRequest(
- delegate,
- 'Seed Job',
- '/seed')
+ stringParam(
+ 'sha1',
+ 'master',
+ 'Commit id or refname (eg: origin/pr/9/head) you want to build.')
+ }
steps {
dsl {
// A list or a glob of other groovy files to process.
- external('.test-infra/jenkins/job_*.groovy')
-
+ external('.test-infra/jenkins/jenkins_testing_job_*.groovy')
+ lookupStrategy('SEED_JOB')
// If a job is removed from the script, delete it
removeAction('DELETE')
}
diff --git a/site/community/testing.md b/site/community/testing.md
index bb44fc4..2d784f9 100644
--- a/site/community/testing.md
+++ b/site/community/testing.md
@@ -53,3 +53,15 @@ Any jenkins changes should be made in these files and
reviewed by the community.
For Travis CI jobs, they are defined in
[.travis.yml](https://github.com/apache/bookkeeper/blob/master/.travis.yml).
Any travis CI changes should be made in this file and reviewed by the
community.
+
+#### Testing Jenkins DSL scripts
+
+Changes to the Jenkins DSL scripts should be tested before submission to avoid
having to send multiple PRs for a single change.
+There is a [Jenkins testing seed
job](https://builds.apache.org/job/bookkeeper-jenkins-testing/job/seed/) which
can be used for testing DSL scripts.
+
+To test a DSL script, create it in ```.test-infra/jenkins``` with a filename
with the pattern ```jenkins_testing_job_<something>.groovy```. Commit this to a
branch, and push the branch to your own fork on github. Then kick off the
testing seed job, specifying your fork and the branch as parameters. This will
generate jobs under the ```bookkeeper-jenkins-testing``` folder in Jenkins.
+
+Run your job a couple of times to makes sure it works and is stable. Once
you're satisfied with the job, rename the file to the pattern
```job_<something>.groovy```, and create a PR.
+
+> NOTE: Kicking off the testing seed job requires a jenkins account, which is
only available to committer. <br/>
+> **WARN: Don't put triggers in your testing job, as you could mess up
outstanding PRs approvals. Add them later.**
--
To stop receiving notification emails like this one, please contact
[email protected].