summaryrefslogtreecommitdiffstats
path: root/jjb
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2020-02-07 19:30:12 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-07 19:30:12 +0000
commit027b126c1d5ef27763fc3aad479da4b37661b66b (patch)
tree42d52867a7b9e2b5ae9d62776054d9ac0459bd89 /jjb
parent18b62c62e64582b87e60c8e388d8445d76a313bf (diff)
parent2dd0554f31f749e53e4eabab8a421721448e45a7 (diff)
Merge "Setup Vagrantfiles validation in integration repo"
Diffstat (limited to 'jjb')
-rw-r--r--jjb/integration/integration-macros.yaml13
-rw-r--r--jjb/integration/integration-templates.yaml45
-rw-r--r--jjb/integration/integration.yaml12
-rw-r--r--jjb/integration/vagrantfile-verify.sh32
4 files changed, 102 insertions, 0 deletions
diff --git a/jjb/integration/integration-macros.yaml b/jjb/integration/integration-macros.yaml
index 23eaae6eb..677e7e0bd 100644
--- a/jjb/integration/integration-macros.yaml
+++ b/jjb/integration/integration-macros.yaml
@@ -53,6 +53,19 @@
builders:
- shell: "${WORKSPACE}/autorelease/scripts/set-version.sh"
+- builder:
+ name: integration-install-vagrant
+ builders:
+ - shell: |
+ #!/bin/bash
+ set -ex # Fail build if any setup step fails
+ add-apt-repository --yes ppa:tiagohillebrandt/vagrant
+ apt update
+ apt --yes install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev vagrant
+ vagrant plugin install vagrant-libvirt
+ vagrant plugin install vagrant-disksize
+ mkdir -p ~/.ssh
+
- publisher:
name: integration-robot
publishers:
diff --git a/jjb/integration/integration-templates.yaml b/jjb/integration/integration-templates.yaml
new file mode 100644
index 000000000..5d07b31e3
--- /dev/null
+++ b/jjb/integration/integration-templates.yaml
@@ -0,0 +1,45 @@
+---
+- job-template:
+ # Job template for verifying Vagrantfiles
+ #
+ # The purpose of this job template is to run:
+ # vagrant validate
+
+ name: '{project-name}-{stream}-verify-vagrantfile'
+ project-type: freestyle
+ description: 'Job intended for validating vagrantfiles'
+ node: 'ubuntu1604-builder-2c-1g.cfg'
+
+ parameters:
+ - lf-infra-parameters:
+ project: '{project}'
+ stream: '{stream}'
+ branch: '{branch}'
+
+ properties:
+ - infra-properties:
+ build-days-to-keep: '{build-days-to-keep}'
+
+ scm:
+ - gerrit-trigger-scm:
+ refspec: '$GERRIT_REFSPEC'
+ choosing-strategy: 'gerrit'
+ submodule-recursive: '{submodule-recursive}'
+
+ wrappers:
+ - infra-wrappers:
+ build-timeout: '{build-timeout}'
+
+ triggers:
+ - gerrit-trigger-patch-submitted:
+ server: '{server-name}'
+ project: '{project}'
+ branch: '{branch}'
+ files: '**/Vagrantfile'
+
+ builders:
+ - integration-install-vagrant
+ - shell: !include-raw-escape: 'vagrantfile-verify.sh'
+
+ publishers:
+ - lf-infra-publish
diff --git a/jjb/integration/integration.yaml b/jjb/integration/integration.yaml
index 2bb525c82..31bda6ebd 100644
--- a/jjb/integration/integration.yaml
+++ b/jjb/integration/integration.yaml
@@ -31,3 +31,15 @@
pattern: 'test/vcpe/**'
jobs:
- '{project-name}-{stream}-{subproject}-verify-python'
+
+- project:
+ name: integration-verify-vagrantfile
+ project-name: 'integration'
+ project: 'integration'
+
+ stream:
+ - 'master':
+ branch: 'master'
+
+ jobs:
+ - '{project-name}-{stream}-verify-vagrantfile'
diff --git a/jjb/integration/vagrantfile-verify.sh b/jjb/integration/vagrantfile-verify.sh
new file mode 100644
index 000000000..6af0a9d03
--- /dev/null
+++ b/jjb/integration/vagrantfile-verify.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Copyright 2020 Samsung Electronics Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+echo "---> vagrantfile-verify.sh"
+
+set -e
+
+declare -a CHANGED_VAGRANTFILES
+CMD='vagrant validate'
+
+CHANGED_VAGRANTFILES=(`git diff HEAD^ HEAD --name-only "*Vagrantfile"`)
+
+for v_dir in ${CHANGED_VAGRANTFILES[@]};
+do
+ echo "---> Validating ./$v_dir"
+ pushd $(dirname $v_dir)
+ eval "$CMD"
+ popd
+done