Merge "Add Jenkins Sandbox Cleanup job"
authorJeremy Phelps <jphelps@linuxfoundation.org>
Fri, 10 Aug 2018 00:02:26 +0000 (00:02 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Fri, 10 Aug 2018 00:02:26 +0000 (00:02 +0000)
.jjb-test/lf-maven-jobs.yaml
check_jjb_version.py [new file with mode: 0644]
docs/jjb/lf-maven-jobs.rst
jjb/lf-ci-jobs.yaml
jjb/lf-maven-jobs.yaml
tox.ini

index ccd517b..a42214a 100644 (file)
@@ -6,8 +6,8 @@
       - gerrit-maven-javadoc-publish
       - gerrit-maven-javadoc-verify
       - gerrit-maven-merge
-      - gerrit-maven-release
       - gerrit-maven-sonar
+      - gerrit-maven-stage
       - gerrit-maven-verify
       - gerrit-maven-verify-dependencies
 
@@ -25,8 +25,8 @@
       - github-maven-javadoc-publish
       - github-maven-javadoc-verify
       - github-maven-merge
-      - github-maven-release
       - github-maven-sonar
+      - github-maven-stage
       - github-maven-verify
 
     project-name: github-maven
diff --git a/check_jjb_version.py b/check_jjb_version.py
new file mode 100644 (file)
index 0000000..5ab56a6
--- /dev/null
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2018 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+"""Ensures that the jjb-version in tox and jjb/lf-ci-jobs.yaml match."""
+
+__author__ = 'Thanh Ha'
+
+
+import os
+import re
+import sys
+
+
+def check_jjb_version(tox_file, releng_jobs_file):
+    with open(tox_file, 'r') as _file:
+        for num, line in enumerate(_file, 1):
+            if re.search('jenkins-job-builder==', line):
+                jjb_version_tox = line.rsplit('==', 1)[1].strip()
+                break
+
+    with open(releng_jobs_file, 'r') as _file:
+        for num, line in enumerate(_file, 1):
+            if re.search('jjb-version: ', line):
+                jjb_version = line.rsplit(':', 1)[1].strip()
+                break
+
+    print('JJB version in jjb/lf-ci-jobs.yaml: {}'.format(jjb_version))
+    print('JJB version in tox.ini: {}'.format(jjb_version_tox))
+
+    if jjb_version != jjb_version_tox:
+        print('ERROR: JJB version in jjb/lf-ci-jobs.yaml and tox.ini MUST match.')
+        sys.exit(1)
+
+
+if __name__ == "__main__":
+    check_jjb_version('tox.ini', os.path.join('jjb', 'lf-ci-jobs.yaml'))
index 519306e..02de9f1 100644 (file)
@@ -13,7 +13,7 @@ Jobs for Maven projects using Gerrit.
 :Includes:
 
     - gerrit-maven-clm
-    - gerrit-maven-release
+    - gerrit-maven-stage
     - gerrit-maven-verify
     - gerrit-maven-verify-dependencies
 
@@ -25,7 +25,7 @@ Jobs for Maven projects using GitHub.
 :Includes:
 
     - github-maven-clm
-    - github-maven-release
+    - github-maven-stage
     - github-maven-verify
 
 {project-name}-maven-javadoc-jobs
@@ -289,19 +289,22 @@ This job uses the following strategy to deploy jobs to Nexus:
     :gerrit_trigger_file_paths: Override file paths which can be used to
         filter which file modifications will trigger a build.
 
-Maven Release
--------------
+Maven Stage
+-----------
 
 Produces a release candidate by creating a staging repo in Nexus.
 
-Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
-directory can then be reused later to deploy to Nexus.
+The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
+"autorelease-2000", "odlparent-1201", etc...
+
+This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
+directory is then used later to deploy to Nexus.
 
 :Template Names:
 
-    - {project-name}-maven-release-{stream}
-    - gerrit-maven-release
-    - github-maven-release
+    - {project-name}-maven-stage-{stream}
+    - gerrit-maven-stage
+    - github-maven-stage
 
 :Required parameters:
 
index 7bf8643..5532a3e 100644 (file)
     branch: master
     build-timeout: 10
     github-url: 'https://github.com'
-    jjb-version: 2.0.5
+    jjb-version: 2.2.1
     stream: master
     submodule-recursive: true
 
index ce03f0c..7a57470 100644 (file)
@@ -11,7 +11,7 @@
     jobs:
       - gerrit-maven-clm
       - gerrit-maven-merge
-      - gerrit-maven-release
+      - gerrit-maven-stage
       - gerrit-maven-verify
       - gerrit-maven-verify-dependencies
 
@@ -25,7 +25,7 @@
     jobs:
       - github-maven-clm
       - github-maven-merge
-      - github-maven-release
+      - github-maven-stage
       - github-maven-verify
 
 - job-group:
       - timed: 'H H * * 6'
       - github-pull-request:
           trigger-phrase: '^run-clm$'
-          only-trigger-phrase: false
+          only-trigger-phrase: true
           status-context: 'CLM'
           permit-all: true
           github-hooks: true
             - '{branch}'
           included-regions: '{obj:github_included_regions}'
 
-#################
-# Maven Release #
-#################
+###############
+# Maven Stage #
+###############
 
-- lf_maven_release: &lf_maven_release
-    name: lf-maven-release
+- lf_maven_stage: &lf_maven_stage
+    name: lf-maven-stage
 
     ######################
     # Default parameters #
 
     gerrit_release_triggers:
       - comment-added-contains-event:
-          comment-contains-value: build release$
+          comment-contains-value: stage-release$
 
     #####################
     # Job Configuration #
       - lf-provide-maven-settings-cleanup
 
 - job-template:
-    name: '{project-name}-maven-release-{stream}'
-    id: gerrit-maven-release
+    name: '{project-name}-maven-stage-{stream}'
+    id: gerrit-maven-stage
     <<: *lf_maven_common
     # yamllint disable-line rule:key-duplicates
-    <<: *lf_maven_release
+    <<: *lf_maven_stage
 
     scm:
       - lf-infra-gerrit-scm:
                   branch-pattern: '**/{branch}'
 
 - job-template:
-    name: '{project-name}-maven-release-{stream}'
-    id: github-maven-release
+    name: '{project-name}-maven-stage-{stream}'
+    id: github-maven-stage
     <<: *lf_maven_common
     # yamllint disable-line rule:key-duplicates
-    <<: *lf_maven_release
+    <<: *lf_maven_stage
 
     properties:
       - lf-infra-properties:
diff --git a/tox.ini b/tox.ini
index e0e9c69..1b7d8c3 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,13 @@
 [tox]
 minversion = 1.6
-envlist = coala,ensure-documented,jjb,jjb-compare-xml,license
+envlist =
+  coala,
+  ensure-documented,
+  jjb,
+  jjb-compare-xml,
+  jjb-latest,
+  jjb-version
+  license
 skipsdist = true
 passenv = TOX_WORK_DIR
 toxworkdir = {env:TOX_WORK_DIR:/tmp/v}
@@ -29,7 +36,7 @@ commands =
 
 [testenv:jjb]
 deps =
-    jenkins-job-builder>=2.0.5
+    jenkins-job-builder==2.2.1
 commands =
     jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test
 
@@ -39,6 +46,15 @@ deps =
 commands =
     ./jjb-compare-xml.sh
 
+[testenv:jjb-latest]
+deps =
+    jenkins-job-builder
+commands =
+    jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test
+
+[testenv:jjb-version]
+commands = python {toxinidir}/check_jjb_version.py
+
 [testenv:license]
 deps = lftools
 commands = lftools license check-dir -r '.+' shell