Mateusz Pilat | 9c9be6f | 2019-05-06 17:12:36 +0200 | [diff] [blame] | 1 | #! /usr/bin/env bash |
| 2 | |
| 3 | # COPYRIGHT NOTICE STARTS HERE |
| 4 | # |
| 5 | # Copyright 2018 © Samsung Electronics Co., Ltd. |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # |
| 19 | # COPYRIGHT NOTICE ENDS HERE |
| 20 | |
| 21 | ### This script performs Jenkins Change Verification for ONAP Offline Installer |
| 22 | # No parameters are expected |
| 23 | ### |
| 24 | ####################################################################### |
| 25 | # MAIN # |
| 26 | ####################################################################### |
| 27 | #if ansible was changed |
| 28 | |
| 29 | if `git diff HEAD^ HEAD --name-only | grep -q "ansible/test"`; |
| 30 | then echo "TO DO: FULL ANSIBLE TEST" ; |
| 31 | else |
| 32 | ROLE_CHANGES=(`git diff HEAD^ HEAD --name-only | grep "ansible/role" | cut -f 1-3 -d "/" | sort | uniq`) |
| 33 | if [ -z "${ROLE_CHANGES}" ]; then |
| 34 | echo "NO ANSIBLE TESTS REQUIRED" |
| 35 | else |
| 36 | for i in ${ROLE_CHANGES[@]} |
| 37 | do |
| 38 | sudo ./ansible/test/bin/ci-molecule.sh ${i} |
| 39 | MOLECULE_RC=$? |
| 40 | if [ ${MOLECULE_RC} -ne "0" ]; then echo "MOLECULE TEST FAILED FOR ${i};";exit 1; fi |
| 41 | done |
| 42 | fi |
| 43 | fi |
| 44 | |
| 45 | |
| 46 | #if build was changed |
| 47 | |
| 48 | if `git diff HEAD^ HEAD --name-only | grep -q "build"`; |
| 49 | then echo "TO DO: BUILD TEST" ; |
| 50 | else |
| 51 | echo "NO BUILD TEST REQUIRED" |
| 52 | fi |
| 53 | |
| 54 | #if documentation was changed |
| 55 | |
| 56 | if `git diff HEAD^ HEAD --name-only | grep -q "docs"`; |
| 57 | then echo "TO DO: DOC TEST"; |
| 58 | else |
| 59 | echo "NO DOC TEST REQUIRED" |
| 60 | fi |
| 61 | |