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
=============
: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)
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}'
--- /dev/null
+#!/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"