Merge "Compress and upload Javadoc for publish jobs"
authorThanh Ha (zxiiro) <thanh.ha@linuxfoundation.org>
Mon, 7 Jan 2019 22:25:00 +0000 (22:25 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Mon, 7 Jan 2019 22:25:00 +0000 (22:25 +0000)
docs/jjb/lf-ci-jobs.rst
jjb/lf-ci-jobs.yaml
jjb/lf-macros.yaml
releasenotes/notes/puppet-verify-linting-1bb7dd93dcf20ddc.yaml [new file with mode: 0644]
shell/jenkins-configure-clouds.sh
shell/puppet-lint.sh [new file with mode: 0644]
shell/python-tools-install.sh
shell/tox-run.sh

index 299d201..8d6ef7d 100644 (file)
@@ -96,6 +96,16 @@ lf-packer-verify-file-paths
 
 Gerrit file-paths for packer verify jobs.
 
+lf-puppet-parameters
+--------------------
+
+Parameters useful for Puppet related tasks.
+
+:Parameters:
+
+    :puppet-lint-version: Version of puppet-lint to install / use.
+        (shell: PUPPET_LINT_VERSION)
+
 Job Templates
 =============
 
@@ -721,3 +731,46 @@ Packer Verify job runs `packer validate` to verify packer configuration.
     :gerrit_verify_triggers: Override Gerrit Triggers.
     :gerrit_trigger_file_paths: Override file paths which can be used to
         filter which file modifications will trigger a build.
+
+
+Puppet Verify
+-------------
+
+Runs puppet-lint in the ``puppet-dir`` directory. puppet-lint runs recursively,
+so the base directory is usually the best place to run from.
+
+:Template Names:
+
+    - {project-name}-puppet-verify
+    - gerrit-puppet-verify
+    - github-puppet-verify
+
+:Comment Trigger: recheck|reverify
+
+:Required Parameters:
+
+    :build-node: The node to run build on.
+    :jenkins-ssh-credential: Credential to use for SSH. (Generally set
+        in defaults.yaml)
+
+:Optional Parameters:
+
+    :branch: The branch to build against. (default: master)
+    :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
+    :build-timeout: Timeout in minutes before aborting build. (default: 15)
+    :gerrit_trigger_file_paths: Override file paths which used to filter which
+        file modifications will trigger a build. Refer to JJB documentation for
+        "file-path" details.
+        https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
+    :git-url: URL clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
+    :puppet-dir: Directory containing the project's puppet module(s) relative
+        to the workspace.
+        (default: '')
+    :puppet-lint-version: Version of puppet-lint to use for testing.
+        (default: 2.3.6)
+    :stream: Keyword representing a release code-name.
+        Often the same as the branch. (default: master)
+    :submodule-recursive: Whether to checkout submodules recursively.
+        (default: true)
+    :submodule-timeout: Timeout (in minutes) for checkout operation.
+        (default: 10)
index e02d753..c34f63d 100644 (file)
           default: '{packer-version}'
           description: Packer version to download and install.
 
+- parameter:
+    name: lf-puppet-parameters
+    parameters:
+      - string:
+          name: PUPPET_LINT_VERSION
+          default: '{puppet-lint-version}'
+          description: Puppet-lint version to download and install.
+
 - lf_jjb_common: &lf_jjb_common
     name: lf-jjb-common
 
           included-regions: '{obj:github_included_regions}'
           white-list-target-branches:
             - '{branch}'
+
+#################
+# Puppet Verify #
+#################
+
+- lf_puppet_verify: &lf_puppet_verify
+    name: lf-puppet-verify
+
+    ######################
+    # Default parameters #
+    ######################
+
+    branch: master
+    build-days-to-keep: 7
+    build-timeout: 15
+    disable-job: false
+    git-url: '$GIT_URL/$GERRIT_PROJECT'
+    github-url: 'https://github.com'
+    parallel: true
+    puppet-dir: ''
+    puppet-lint-version: 2.3.6
+    stream: master
+    submodule-recursive: true
+    submodule-timeout: 10
+
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: '.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - '.*'
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: '{build-node}'
+    concurrent: true
+    disabled: '{disable-job}'
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - lf-infra-parameters:
+          project: '{project}'
+          branch: '{branch}'
+          stream: '{stream}'
+      - lf-puppet-parameters:
+          puppet-lint-version: '{puppet-lint-version}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    builders:
+      - shell: !include-raw-escape: ../shell/puppet-lint.sh
+
+    publishers:
+      - lf-infra-publish
+
+- job-template:
+    name: '{project-name}-puppet-verify'
+    id: gerrit-puppet-verify
+    <<: *lf_puppet_verify
+
+    ######################
+    # Default parameters #
+    ######################
+
+    gerrit_verify_triggers:
+      - 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)$'
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+          git-url: '{git-url}'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: gerrit
+
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_verify_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
+
+- job-template:
+    name: '{project-name}-puppet-verify'
+    id: github-puppet-verify
+    <<: *lf_puppet_verify
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    properties:
+      - lf-infra-properties:
+          project: '{project}'
+          build-days-to-keep: 7
+      - github:
+          url: '{github-url}/{github-org}/{project}'
+
+    scm:
+      - lf-infra-github-scm:
+          url: '{git-clone-url}{github-org}/{project}'
+          refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
+          branch: '$sha1'
+          submodule-recursive: '{submodule-recursive}'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: default
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    triggers:
+      - github-pull-request:
+          trigger-phrase: '^(recheck|reverify)$'
+          only-trigger-phrase: false
+          status-context: 'Puppet Verify'
+          permit-all: true
+          github-hooks: true
+          included-regions: '{obj:github_included_regions}'
+          white-list-target-branches:
+            - '{branch}'
index 206e717..08bb637 100644 (file)
@@ -56,6 +56,8 @@
 - builder:
     name: lf-infra-ship-logs
     builders:
+      # Ensure no pre-existing .netrc files are overriding logs config
+      - lf-provide-maven-settings-cleanup
       - config-file-provider:
           files:
             - file-id: 'jenkins-log-archives-settings'
diff --git a/releasenotes/notes/puppet-verify-linting-1bb7dd93dcf20ddc.yaml b/releasenotes/notes/puppet-verify-linting-1bb7dd93dcf20ddc.yaml
new file mode 100644 (file)
index 0000000..bfe6473
--- /dev/null
@@ -0,0 +1,14 @@
+---
+features:
+  - |
+    Add a puppet-verify job to lf-ci-jobs. This job will perform Puppet
+    linting on the specified repository.
+
+    .. code-block:: yaml
+
+       - project:
+           name: lf-infra-puppet-mymodule
+           project-name: lf-infra-puppet
+           project: puppet/modules/mymodule
+           jobs:
+             - gerrit-puppet-verify
index 29a20de..18c3d89 100644 (file)
@@ -133,6 +133,7 @@ get_minion_options() {
     # Fails on first instance of each different associatve array prefix
     # Fails when using single/double/no quotes, all of which are valid bash
     # shellcheck disable=SC2154
+    flavors["acumos-highcpu-4-avx"]="c720c1f8-62e9-4695-823d-f7f54db46c86"
     flavors["lf-highcpu-2"]="1051d06a-61ea-45e3-b9b4-93de92880b27"
     flavors["lf-highcpu-4"]="35eb8e11-490f-4d1a-9f19-76091fc04547"
     flavors["lf-highcpu-8"]="68af673f-54ee-4255-871c-158c18e4f643"
diff --git a/shell/puppet-lint.sh b/shell/puppet-lint.sh
new file mode 100644 (file)
index 0000000..0ceb5b0
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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
+##############################################################################
+echo "---> puppet-lint.sh"
+
+# Performs linting for Puppet code.
+set -e -o pipefail
+
+BINDIR=$(ruby -r rubygems -e 'puts Gem.bindir')
+ARCHIVE_PUPPETLINT_DIR="$WORKSPACE/archives/puppet-lint"
+mkdir -p "$ARCHIVE_PUPPETLINT_DIR"
+cd "$WORKSPACE/$PUPPET_DIR"
+
+gem install puppet-lint -v $PUPPET_LINT_VERSION
+echo "---> Running puppet-lint"
+"$BINDIR/puppet-lint" . | tee -a "$ARCHIVE_PUPPETLINT_DIR/puppet-lint.log"
index e0b04db..647a159 100644 (file)
@@ -18,9 +18,10 @@ REQUIREMENTS_FILE=$(mktemp /tmp/requirements-XXXX.txt)
 #       git+https://github.com/lfit/releng-lftools.git#egg=lftools[openstack]
 
 cat << EOF > "$REQUIREMENTS_FILE"
-lftools[openstack]~=0.19.1
+lftools[openstack]~=0.18.0
 python-heatclient~=1.16.1
 python-openstackclient~=3.16.0
+dogpile.cache~=0.6.8  # Version 0.7.[01] seems to break openstackclient
 EOF
 
 echo "Requirements file"
index 4738001..3f1f92a 100644 (file)
@@ -24,6 +24,11 @@ if [ -d "/opt/pyenv" ]; then
     export PATH="$PYENV_ROOT/bin:$PATH"
 fi
 
+# Set and pass in PYTHONPATH to circumvent installation bug in tox>=3.2.0
+PYTHONPATH=$(pwd)
+export PYTHONPATH
+export TOX_TESTENV_PASSENV=PYTHONPATH
+
 set +e  # Allow detox to fail so that we can collect the logs in the next step
 
 PARALLEL="${PARALLEL:-true}"