Merge "Disable CLM jobs by default"
authorThanh Ha (zxiiro) <thanh.ha@linuxfoundation.org>
Thu, 23 Aug 2018 19:50:08 +0000 (19:50 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Thu, 23 Aug 2018 19:50:08 +0000 (19:50 +0000)
17 files changed:
.jjb-test/lf-ci-jobs.yaml
.jjb-test/lf-maven-jobs.yaml
check_jjb_version.py [new file with mode: 0644]
docs/jjb/lf-ci-jobs.rst
docs/jjb/lf-maven-jobs.rst
jjb/lf-c-cpp-jobs.yaml
jjb/lf-ci-jobs.yaml
jjb/lf-macros.yaml
jjb/lf-maven-jobs.yaml
jjb/lf-python-jobs.yaml
jjb/lf-rtd-jobs.yaml
shell/jenkins-sandbox-cleanup.sh [new file with mode: 0644]
shell/openstack-install.sh [new file with mode: 0644]
shell/openstack-protect-in-use-images.sh [new file with mode: 0644]
shell/sigul-configuration.sh
shell/sigul-install.sh
tox.ini

index ecf365d..c9dfdfc 100644 (file)
     project-name: github-ciman
 
 
+- project:
+    name: gerrit-openstack-jobs
+    jobs:
+      - gerrit-openstack-cron
+
+    project-name: gerrit-ciman
+
+- project:
+    name: github-openstack-jobs
+    jobs:
+      - github-openstack-cron
+
+    project-name: github-ciman
+
+
 - project:
     name: gerrit-packer-jobs
     jobs:
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 0711e93..18cd0a5 100644 (file)
@@ -13,6 +13,7 @@ Recommended jobs that should be deployed for CI using Gerrit.
 :Includes:
 
     - gerrit-jenkins-cfg-merge
+    - gerrit-jenkins-sandbox-cleanup
     - gerrit-jjb-deploy-job
     - gerrit-jjb-merge
     - gerrit-jjb-verify
@@ -25,6 +26,7 @@ Recommended jobs that should be deployed CI using GitHub.
 :Includes:
 
     - github-jenkins-cfg-merge
+    - github-jenkins-sandbox-cleanup
     - github-jjb-deploy-job
     - github-jjb-merge
     - github-jjb-verify
@@ -271,9 +273,10 @@ configuration in the format ``KEY=value``.
        the one defined in default clouds will be inherited.
 
     :IMAGE_NAME: The image name to use for this template.
-        (default: "")
+        (required)
+    :HARDWARE_ID: OpenStack flavor to use. (required)
+
     :LABELS: Labels to assign to the vm. (default: FILE_NAME)
-    :HARDWARE_ID: OpenStack flavor to use. (default: "")
     :NETWORK_ID: OpenStack network to use. (default: "")
     :USER_DATA_ID: User Data to pass into the instance.
         (default: jenkins-init-script)
@@ -314,6 +317,30 @@ Troubleshooting
     inspected.
 
 
+Jenkins Sandbox Cleanup
+-----------------------
+
+Cleanup Jenkins Sandbox of jobs and views periodically.
+
+:Template names:
+
+    - {project-name}-jenkins-sandbox-cleanup
+    - gerrit-jenkins-sandbox-cleanup
+    - github-jenkins-sandbox-cleanup
+
+:Comment Trigger: NONE
+
+:Required parameters:
+
+    :build-node: The node to run build on.
+    :jenkins-ssh-credential: Credential to use for SSH. (Generally
+        should be configured in defaults.yaml)
+
+:Optional parameters:
+
+    :cron: Schedule to run job. (default: '0 8 * * 6')
+
+
 JJB Deploy Job
 --------------
 
@@ -365,8 +392,6 @@ Runs `jenkins-jobs update` to update production job configuration
     :build-node: The node to run build on.
     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
         be configured in defaults.yaml)
-    :mvn-settings: The name of settings file containing credentials for
-        the project.
 
 :Optional parameters:
 
@@ -374,6 +399,7 @@ Runs `jenkins-jobs update` to update production job configuration
     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
     :build-timeout: Timeout in minutes before aborting build. (default: 10)
     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
+    :jjb-version: JJB version to install. (default: see job-template)
     :stream: Keyword that can be used to represent a release code-name.
         Often the same as the branch. (default: master)
     :submodule-recursive: Whether to checkout submodules recursively.
@@ -402,8 +428,6 @@ Runs `jenkins-jobs test` to validate JJB syntax
     :build-node: The node to run build on.
     :jenkins-ssh-credential: Credential to use for SSH. (Generally should
         be configured in defaults.yaml)
-    :mvn-settings: The name of settings file containing credentials for
-        the project.
 
 :Optional parameters:
 
@@ -411,6 +435,7 @@ Runs `jenkins-jobs test` to validate JJB syntax
     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
     :build-timeout: Timeout in minutes before aborting build. (default: 10)
     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
+    :jjb-version: JJB version to install. (default: see job-template)
     :stream: Keyword that can be used to represent a release code-name.
         Often the same as the branch. (default: master)
     :submodule-recursive: Whether to checkout submodules recursively.
@@ -421,6 +446,37 @@ Runs `jenkins-jobs test` to validate JJB syntax
         filter which file modifications will trigger a build.
         (default defined by lf_jjb_common)
 
+.. _jjb-verify-upstream-gjjb:
+
+JJB Verify Upstream Global JJB
+------------------------------
+
+Runs ``jenkins-jobs test`` to validate JJB syntax for upstream global-jjb
+patches. This job is useful to notify upstream that they may be breaking
+project level jobs.
+
+:Template Names:
+    - {project-name}-jjb-verify-upstream-gjjb
+    - gerrit-jjb-verify-upstream-gjjb
+
+:Comment Trigger: recheck|reverify
+
+:Required parameters:
+
+    :build-node: The node to run build on.
+    :jenkins-ssh-credential: Credential to use for SSH. (Generally should
+        be configured in defaults.yaml)
+
+:Optional parameters:
+
+    :branch: Git branch to fetch for the build. (default: master)
+    :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
+    :build-timeout: Timeout in minutes before aborting build. (default: 10)
+    :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
+    :jjb-version: JJB version to install. (default: see job-template)
+    :stream: Keyword that can be used to represent a release code-name.
+        Often the same as the branch. (default: master)
+
 .. _info-yaml-verify:
 
 Info YAML Verify
@@ -484,6 +540,41 @@ Job to scan projects for files missing license headers.
     :project-pattern: The ANT based pattern for Gerrit Trigger to choose which
         projects to trigger job against. (default: '**')
 
+.. _gjjb-openstack-cron:
+
+OpenStack Cron
+--------------
+
+Cron job that runs regularly to perform periodic tasks against OpenStack.
+
+This job requires a Config File Provider file named ``clouds-yaml`` available
+containing the credentials for the cloud.
+
+:Template Names:
+    - {project-name}-openstack-cron
+    - gerrit-openstack-cron
+    - github-openstack-cron
+
+:Required parameters:
+
+    :build-node: The node to run build on.
+    :jenkins-ssh-credential: Credential to use for SSH. (Generally should
+        be configured in defaults.yaml)
+
+:Optional parameters:
+
+    :branch: Git branch to fetch for the build. (default: master)
+    :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
+    :build-timeout: Timeout in minutes before aborting build. (default: 90)
+    :cron: Time when the packer image should be rebuilt (default: @daily)
+    :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
+    :openstack-cloud: OS_CLOUD setting to pass to openstack client.
+        (default: vex)
+    :stream: Keyword that can be used to represent a release code-name.
+        Often the same as the branch. (default: master)
+    :submodule-recursive: Whether to checkout submodules recursively.
+        (default: true)
+
 .. _gjjb-packer-merge:
 
 Packer Merge
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 6b24038..5e85448 100644 (file)
@@ -15,6 +15,7 @@
     build-dir: '$WORKSPACE/target'
     build-timeout: 15
     cmake-opts: ''
+    cron: '@daily'
     git-url: '$GIT_URL/$PROJECT'
     github-url: 'https://github.com'
     install-prefix: '$BUILD_DIR/output'
           choosing-strategy: gerrit
 
     triggers:
+      - timed: '{obj:cron}'
       - gerrit:
           server-name: '{gerrit-server-name}'
           trigger-on:
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     triggers:
+      - timed: '{obj:cron}'
       - github-pull-request:
           trigger-phrase: '^(stage-release)$'
           only-trigger-phrase: true
index c07bd03..4fd2c0c 100644 (file)
@@ -4,6 +4,7 @@
 
     jobs:
       - gerrit-jenkins-cfg-merge
+      - gerrit-jenkins-sandbox-cleanup
       - gerrit-jjb-deploy-job
       - gerrit-jjb-merge
       - gerrit-jjb-verify
@@ -13,6 +14,7 @@
 
     jobs:
       - github-jenkins-cfg-merge
+      - github-jenkins-sandbox-cleanup
       - github-jjb-deploy-job
       - github-jjb-merge
       - github-jjb-verify
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
           status-context: 'Jenkins CFG Merge'
-          permit-all: false
+          permit-all: true
           github-hooks: true
           org-list:
             - '{github-org}'
           white-list-target-branches:
             - '{branch}'
 
+
+###########################
+# JENKINS SANDBOX CLEANUP #
+###########################
+
+- lf_jenkins_sandbox_cleanup: &lf_jenkins_sandbox_cleanup
+    name: lf-jenkins-sandbox-cleanup
+
+    ######################
+    # Default parameters #
+    ######################
+
+    build-timeout: 30
+    # Run every Saturday at 08:00 UTC
+    cron: '0 8 * * 6'
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: '{build-node}'
+    concurrent: true
+
+    parameters:
+      - lf-infra-jjb-parameters:
+          jjb-version: '{jjb-version}'
+
+    triggers:
+      - timed: '{obj:cron}'
+
+    builders:
+      - lf-infra-jjbini
+      - shell: !include-raw-escape:
+          - ../shell/jjb-install.sh
+          - ../shell/jenkins-sandbox-cleanup.sh
+          - ../shell/jjb-cleanup.sh
+
+- job-template:
+    name: '{project-name}-jenkins-sandbox-cleanup'
+    id: gerrit-jenkins-sandbox-cleanup
+    <<: *lf_jjb_common
+    # yamllint disable-line rule:key-duplicates
+    <<: *lf_jenkins_sandbox_cleanup
+
+- job-template:
+    name: '{project-name}-jenkins-sandbox-cleanup'
+    id: github-jenkins-sandbox-cleanup
+    <<: *lf_jjb_common
+    # yamllint disable-line rule:key-duplicates
+    <<: *lf_jenkins_sandbox_cleanup
+
+
 ##################
 # JJB DEPLOY JOB #
 ##################
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
           status-context: 'JJB Merge'
-          permit-all: false
+          permit-all: true
           github-hooks: true
           org-list:
             - '{github-org}'
           white-list-target-branches:
             - '{branch}'
 
+############################
+# JJB Verify Upstream GJJB #
+############################
+
+- lf_jjb_verify: &lf_jjb_verify_upstream_gjjb
+    name: lf-jjb-verify-upstream-gjjb
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    concurrent: true
+
+    builders:
+      - shell: |
+          cd jjb/global-jjb
+          git fetch https://gerrit.linuxfoundation.org/infra/releng/global-jjb $GERRIT_REFSPEC
+          git cherry-pick FETCH_HEAD
+      - lf-infra-jjbini
+      - shell: !include-raw-escape:
+          - ../shell/git-validate-jira-urls.sh
+          - ../shell/jjb-install.sh
+          - ../shell/jjb-verify-job.sh
+          - ../shell/jjb-check-unicode.sh
+          - ../shell/jjb-cleanup.sh
+      - lf-infra-gpg-verify-git-signature
+
+- job-template:
+    name: '{project-name}-jjb-verify-upstream-gjjb'
+    id: gerrit-jjb-verify-upstream-gjjb
+    <<: *lf_jjb_common
+    # yamllint disable-line rule:key-duplicates
+    <<: *lf_jjb_verify_upstream_gjjb
+
+    ######################
+    # Default parameters #
+    ######################
+
+    git-url: '$GIT_URL/$PROJECT'
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    scm:
+      - lf-infra-gerrit-scm:
+          git-url: '{git-url}'
+          refspec: ''
+          branch: 'master'
+          submodule-recursive: true
+          choosing-strategy: default
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    triggers:
+      - gerrit:
+          server-name: 'LinuxFoundation'
+          trigger-on:
+            - patchset-created-event:
+                exclude-drafts: true
+                exclude-trivial-rebase: false
+                exclude-no-code-change: false
+            - draft-published-event
+            - comment-added-contains-event:
+                comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: 'releng/global-jjb'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/master'
+          override-votes: true
+          gerrit-build-failed-codereview-value: -1
+          gerrit-build-failed-verified-value: 0
+          gerrit-build-successful-codereview-value: 1
+          gerrit-build-successful-verified-value: 0
+
 #################
 # License Check #
 #################
           white-list-target-branches:
             - '{branch}'
 
+##################
+# OPENSTACK CRON #
+##################
+
+- lf_openstack_cron: &lf_openstack_cron
+    name: lf-openstack-cron
+
+    ######################
+    # Default parameters #
+    ######################
+
+    branch: master
+    build-days-to-keep: 7
+    build-timeout: 10
+    cron: '@daily'
+    git-url: '$GIT_URL/$PROJECT'
+    github-url: 'https://github.com'
+    openstack-cloud: vex
+    stream: master
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: '{build-node}'
+    concurrent: false
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - lf-infra-parameters:
+          project: '{project}'
+          stream: '{stream}'
+          branch: '{branch}'
+          lftools-version: '{lftools-version}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+      # Listed after to override openstack-infra-wrappers clouds.yaml definition
+      - config-file-provider:
+          files:
+            - file-id: clouds-yaml
+              target: '$HOME/.config/openstack/clouds.yaml'
+            - file-id: npmrc
+              target: '$HOME/.npmrc'
+            - file-id: pipconf
+              target: '$HOME/.config/pip/pip.conf'
+
+    triggers:
+      - timed: '{obj:cron}'
+
+    builders:
+      - inject:
+          properties-content: OS_CLOUD={openstack-cloud}
+      - shell: !include-raw-escape: ../shell/openstack-install.sh
+      - shell: !include-raw-escape: ../shell/openstack-protect-in-use-images.sh
+
+    publishers:
+      - lf-infra-publish
+
+- job-template:
+    name: '{project-name}-openstack-cron'
+    id: gerrit-openstack-cron
+    <<: *lf_openstack_cron
+
+    scm:
+      - lf-infra-gerrit-scm:
+          git-url: '{git-url}'
+          refspec: 'refs/heads/{branch}'
+          branch: '{branch}'
+          submodule-recursive: true
+          choosing-strategy: default
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+- job-template:
+    name: '{project-name}-openstack-cron'
+    id: github-openstack-cron
+    <<: *lf_openstack_cron
+
+    scm:
+      - lf-infra-github-scm:
+          url: '{git-clone-url}{github-org}/{project}'
+          refspec: ''
+          branch: 'refs/heads/{branch}'
+          submodule-recursive: true
+          choosing-strategy: default
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
 ################
 # Packer Merge #
 ################
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
           status-context: 'Packer {platforms}-{templates} Merge'
-          permit-all: false
+          permit-all: true
           github-hooks: true
           org-list:
             - '{github-org}'
index bc1ce58..16cd33c 100644 (file)
               variable: SIGUL_PASSWORD
             - file-id: sigul-pki
               variable: SIGUL_PKI
-      - shell: !include-raw-escape: ../shell/sigul-configuration.sh
+      - shell: !include-raw: ../shell/sigul-configuration.sh
 
 - builder:
     name: lf-pip-install
     name: lf-provide-sigul-configuration-cleanup
     # Clear sigul configuration files after we're done using them
     builders:
-      - shell: !include-raw-escape: ../shell/sigul-configuration-cleanup.sh
+      - shell: !include-raw: ../shell/sigul-configuration-cleanup.sh
 
 - builder:
     name: lf-rtd-trigger-build
     name: lf-sigul-install
     # Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
     # Environment variable
-    builder:
-      - shell: !include-raw-escape: ../shell/sigul-install.sh
+    builders:
+      - shell: !include-raw: ../shell/sigul-install.sh
 
 - builder:
     name: lf-infra-provide-docker-cleanup
           # yamllint disable-line rule:line-length
           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn'
           description: 'Maven selector to be used by shell scripts'
-      - string:
-          name: STAGING_PROFILE_ID
-          default: '{staging-profile-id}'
-          description: |
-              Nexus staging profile ID.
-
 
 - parameter:
     name: lf-infra-openstack-parameters
index b1b4205..57cec94 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:
           mvn-opts: '{mvn-opts}'
           mvn-params: '{mvn-params}'
           mvn-version: '{mvn-version}'
-          # Staging repos do not make sense for CLM jobs so set it blank.
-          staging-profile-id: '{staging-profile-id}'
       - string:
           name: ARCHIVE_ARTIFACTS
           default: '{archive-artifacts}'
     mvn-params: ''
     mvn-version: mvn35
     nexus-iq-stage: 'build'
-    staging-profile-id: ''  # Unused in this job
     stream: master
     submodule-recursive: true
 
           mvn-opts: '{mvn-opts}'
           mvn-params: '{mvn-params}'
           mvn-version: '{mvn-version}'
-          # Staging repos do not make sense for CLM jobs so set it blank.
-          staging-profile-id: '{staging-profile-id}'
       - string:
           name: ARCHIVE_ARTIFACTS
           default: '{archive-artifacts}'
     mvn-opts: ''
     mvn-params: ''
     mvn-version: mvn35
-    staging-profile-id: ''  # Unused by the javadoc jobs
     stream: master
     submodule-recursive: true
 
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
           status-context: 'Maven Javadoc Publish'
-          permit-all: false
+          permit-all: true
           github-hooks: true
           org-list:
             - '{github-org}'
     mvn-opts: ''
     mvn-params: ''
     mvn-version: mvn35
-    staging-profile-id: ''  # Unused by the javadoc jobs
     stream: master
     submodule-recursive: true
 
     branch: master
     build-days-to-keep: 30  # 30 days in case we need to troubleshoot
     build-timeout: 60
-    cron: 'H H * * 0'  # push fresh snapshot weekly
+    cron: '@daily'
     git-url: '$GIT_URL/$PROJECT'
     github-url: 'https://github.com'
     java-version: openjdk8
     mvn-params: '-Dmerge'
     mvn-version: mvn35
     nexus-cut-dirs: 6  # Number of dirs in the Nexus path to remove for wget -r.
-    staging-profile-id: ''  # Unused by this job.
     stream: master
     submodule-recursive: true
 
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     triggers:
+      - timed: '{obj:cron}'
       - github
       - pollscm:
           cron: ''
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
           status-context: 'Maven Merge'
-          permit-all: false
+          permit-all: true
           github-hooks: true
           org-list:
             - '{github-org}'
             - '{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 #
     branch: master
     build-days-to-keep: 30  # 30 days in case a release takes long to get approved.
     build-timeout: 60
-    cron: ''
+    cron: '@daily'
     git-url: '$GIT_URL/$PROJECT'
     github-url: 'https://github.com'
     java-version: openjdk8
 
     gerrit_release_triggers:
       - comment-added-contains-event:
-          comment-contains-value: build release$
+          comment-contains-value: stage-release$
 
     #####################
     # Job Configuration #
     #####################
 
+    parameters:
+      - lf-infra-parameters:
+          project: '{project}'
+          branch: '{branch}'
+          stream: '{stream}'
+          lftools-version: '{lftools-version}'
+      - lf-infra-maven-parameters:
+          mvn-opts: '{mvn-opts}'
+          mvn-params: '{mvn-params}'
+          mvn-version: '{mvn-version}'
+          staging-profile-id: '{staging-profile-id}'
+      - string:
+          name: ARCHIVE_ARTIFACTS
+          default: '{archive-artifacts}'
+          description: Artifacts to archive to the logs server.
+      - string:
+          name: STAGING_PROFILE_ID
+          default: '{staging-profile-id}'
+          description: Nexus staging profile ID.
+
     builders:
       - lf-jacoco-nojava-workaround
       - lf-maven-install:
       - 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:
     mvn-params: ''
     mvn-version: mvn35
     sonar-mvn-goal: 'sonar:sonar'
-    staging-profile-id: ''  # Unused in this job
     stream: master
     submodule-recursive: true
 
           mvn-opts: '{mvn-opts}'
           mvn-params: '{mvn-params}'
           mvn-version: '{mvn-version}'
-          # Staging repos do not make sense for Sonar jobs so set it blank.
-          staging-profile-id: ''
       - string:
           name: ARCHIVE_ARTIFACTS
           default: '{archive-artifacts}'
     mvn-opts: ''
     mvn-params: '-Dstream=$STREAM'
     mvn-version: mvn35
-    staging-profile-id: ''  # Unused in this job
     stream: master
     submodule-recursive: true
 
     mvn-opts: ''
     mvn-params: '-Dstream=$STREAM'
     mvn-version: mvn35
-    staging-profile-id: ''  # Unused by this job
     stream: master
     submodule-recursive: true
 
index c1fd50b..c5f67fe 100644 (file)
@@ -96,7 +96,6 @@
     github-url: 'https://github.com'
     java-version: openjdk8
     nexus-iq-cli-version: 1.44.0-01
-    staging-profile-id: ''  # Unused in this job
     stream: master
     submodule-recursive: true
 
index 5d53bde..74d3827 100644 (file)
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
           status-context: 'RTD Merge'
-          permit-all: false
+          permit-all: true
           github-hooks: true
           org-list:
             - '{github-org}'
diff --git a/shell/jenkins-sandbox-cleanup.sh b/shell/jenkins-sandbox-cleanup.sh
new file mode 100644 (file)
index 0000000..c196973
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+# 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
+##############################################################################
+# Deletes all jobs on a Jenkins Sandbox system.
+echo "---> jenkins-sandbox-cleanup.sh"
+
+set -eux -o pipefail
+
+bash -c "/usr/bin/yes 2>/dev/null || true" | jenkins-jobs -s sandbox delete-all
diff --git a/shell/openstack-install.sh b/shell/openstack-install.sh
new file mode 100644 (file)
index 0000000..a7e5099
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+# 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
+##############################################################################
+# Install the openstack cli
+echo "---> Install openstack cli"
+
+set -eux -o pipefail
+
+pip install --user --quiet --upgrade "pip<10.0.0" setuptools
+pip install --user --quiet --upgrade python-openstackclient python-heatclient
+pip freeze
diff --git a/shell/openstack-protect-in-use-images.sh b/shell/openstack-protect-in-use-images.sh
new file mode 100644 (file)
index 0000000..a23a4ed
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash -l
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2017, 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
+##############################################################################
+# Checks the image "protected" value and set "True" marker
+#
+# The script searches the ciman repo for the images presently used and ensures
+# the protection setting is set for those images to prevent the image from
+# getting purged by the image cleanup script.
+# This script assumes images prefixed with the string "ZZCI - " are ci-managed
+# images.
+echo "---> Protect in-use images"
+
+os_cloud="${OS_CLOUD:-vex}"
+
+set -eu -o pipefail
+
+declare -a images
+declare -a cfg_images
+declare -a yaml_images
+readarray -t cfg_images <<< "$(grep -r IMAGE_NAME --include \*.cfg \
+    | awk -F'=' '{print $2}' | sort -u)"
+readarray -t yaml_images <<< "$(grep -r 'ZZCI - ' --include \*.yaml \
+    | awk -F": " '{print $3}' | sed "s:'::;s:'$::;/^$/d" | sort -u)"
+mapfile -t images < <(for R in "${cfg_images[@]}" "${yaml_images[@]}" ; do echo "$R" ; done | sort -u)
+
+
+for image in "${images[@]}"; do
+    os_image_protected=$(openstack --os-cloud "$os_cloud" \
+        image show "$image" -f value -c protected)
+    echo "Protected setting for $image: $os_image_protected"
+
+    if [[ $os_image_protected != True ]]; then
+        echo "    Image NOT set as protected, changing the protected value."
+        openstack --os-cloud "$os_cloud" image set --protected "$image"
+    fi
+done
index bdc4de6..c063b18 100644 (file)
@@ -11,7 +11,7 @@
 echo "---> sigul-configuration.sh"
 
 # Ensure we fail the job if any steps fail.
-set -eu -o pipefail
+set -e -o pipefail
 
 # Sigul pki configuration is designed to live in ${HOME}/sigul
 cd "${HOME}"
@@ -23,4 +23,3 @@ tar Jxf sigul.tar.xz
 
 # Any future use of $SIGUL_PASSWORD needs to have it null terminated
 sed -i 's/$/\x0/' "${SIGUL_PASSWORD}"
-
index 5d015ff..8573154 100644 (file)
@@ -11,7 +11,7 @@
 echo "---> sigul-install.sh"
 
 # Ensure we fail the job if any steps fail.
-set -eu -o pipefail
+set -e -o pipefail
 
 # Setup sigul RPM repo
 echo "[fedora-infra-sigul]
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