--- /dev/null
+.. _lf-global-jjb-info-vote:
+
+#############
+INFO VOTE JOB
+#############
+
+Job counts the votes from the committers against a change
+to the INFO.yaml file
+
+If needed, will also check for a majority of tsc voters
+(not yet implemented)
+
+Auto-merges the change on a majority vote.
+
+
+info-vote
+---------
+
+:Comment Trigger: recheck|reverify|Vote
+
+:Required parameters:
+
+ :build-node: The node to run build on.
+ :jenkins-ssh-credential: Credential to use for SSH. (Generally set
+ in defaults.yaml)
ReadTheDocs verify script.
+check-info-votes
+----------------
+
+Calls shell script to validate votes on a change to an INFO.yaml
+
lf-sigul-sign-dir
-----------------
--- /dev/null
+---
+####################
+# COMMON FUNCTIONS #
+####################
+
+- lf_info_vote_common: &lf_info_vote_common
+ name: lf-info-vote-common
+
+ gerrit_trigger_file_paths:
+ - compare-type: REG_EXP
+ pattern: 'INFO.yaml'
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ project-type: freestyle
+ node: '{build-node}'
+
+ properties:
+ - lf-infra-properties:
+ build-days-to-keep: 7
+
+ parameters:
+ - lf-infra-parameters:
+ project: $GERRIT_PROJECT
+ branch: 'master'
+ refspec: 'refs/heads/{branch}'
+ stream: 'master'
+
+ wrappers:
+ - lf-infra-wrappers:
+ build-timeout: '{build-timeout}'
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+ publishers:
+ - lf-infra-publish
+
+
+- lf_info_vote_verify: &lf_info_vote_verify
+ name: lf-info-vote-verify
+
+ branch: master
+ stream: master
+ build-days-to-keep: 7
+ build-timeout: 15
+ disable-job: false
+ git-url: '$GIT_URL/$PROJECT'
+ submodule-timeout: 10
+ submodule-recursive: true
+ gerrit-skip-vote: false
+
+ gerrit_verify_triggers:
+ - comment-added-contains-event:
+ comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(vote)$'
+ - comment-added:
+ approval-category: 'CRVW'
+ approval-value: '+2'
+ - comment-added:
+ approval-category: 'Code-Review'
+ approval-value: '+2'
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ disabled: '{disable-job}'
+
+ builders:
+ - check-info-votes:
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+- job-template:
+ name: 'info-vote'
+ id: info-vote-verify
+ <<: *lf_info_vote_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_info_vote_verify
+
+ scm:
+ - lf-infra-gerrit-scm:
+ branch: '$GERRIT_BRANCH'
+ jenkins-ssh-credential: '{jenkins-ssh-credential}'
+ git-url: '{git-url}'
+ refspec: '$GERRIT_REFSPEC'
+ 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: 'REG_EXP'
+ project-pattern: '**'
+ branches:
+ - branch-compare-type: 'ANT'
+ branch-pattern: '**/master'
+ file-paths: '{obj:gerrit_trigger_file_paths}'
+ skip-vote:
+ successful: '{gerrit-skip-vote}'
+ failed: '{gerrit-skip-vote}'
+ unstable: '{gerrit-skip-vote}'
+ notbuilt: '{gerrit-skip-vote}'
- shell: !include-raw-escape: ../shell/tox-install.sh
- shell: !include-raw-escape: ../shell/rtd-verify.sh
+- builder:
+ name: check-info-votes
+ builders:
+ - inject:
+ properties-content: JENKINS_SSH_CREDENTIAL={jenkins-ssh-credential}
+ - shell: !include-raw-escape: ../shell/check-info-votes.sh
+
- builder:
name: lf-sigul-sign-dir
# Requires that Jenkins be configured with SIGUL_BRIDGE_IP as a global
--- /dev/null
+---
+features:
+ - |
+ New ``info-vote-verify`` macro
+ Will count votes against an INFO.yaml change and sumbit
+ automatically if a majority of committers and tsc mebers
+ vote +1 or +2 on the change.
--- /dev/null
+#!/bin/bash -l
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 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 "---> check-info-votes.sh"
+set -xe -o pipefail
+
+ref=$(echo "$GERRIT_REFSPEC" | awk -F"/" '{ print $4 }')
+pip="pip3"
+
+# For OPNFV
+if [[ $NODE_NAME =~ "lf-build" ]]; then
+ pip=pip
+fi
+
+if [ -d "/opt/pyenv" ]; then
+ echo "---> Setting up pyenv"
+ export PYENV_ROOT="/opt/pyenv"
+ export PATH="$PYENV_ROOT/bin:$PATH"
+ PYTHONPATH=$(pwd)
+ export PYTHONPATH
+ pyenv local 3.6.4
+ export PYENV_VERSION="3.6.4"
+fi
+
+$pip install --user niet
+$pip install --user lftools
+$pip install --user lftools[nexus]
+$pip install --user jsonschema
+
+change="$(echo "$GERRIT_CHANGE_URL" | awk -F"/" '{print $NF}')"
+echo "Checking votes:"
+lftools infofile check-votes INFO.yaml "$GERRIT_URL" "$ref" > gerrit_comment.txt
+exit_status="$?"
+
+if [[ "$exit_status" -ne 0 ]]; then
+ echo "Vote not yet complete"
+ cat gerrit_comment.txt
+ exit "$exit_status"
+else
+ echo "Vote completed submitting review"
+ ssh -p "$GERRIT_PORT" "$JENKINS_SSH_CREDENTIAL"@"$GERRIT_HOST" gerrit review "$change" --submit
+fi