Fix murano-deployment gate

Currently murano-deployment gate is broken,
it is failing due to outdated syntax_check.sh script,
outdated job configuration and also some scripts fails to pass
shellcheck testing included in the gate.

This commit does the following:

- fix bash scripts so they can pass shellcheck in
gate-murano-deployment job.
- fix path to jobs in syntax_check.sh
- fix gate-murano-deployment job configuration
- set trusty-devstack-* slaves label for
gate-murano-deployment job
- logs names pattern is updated in rotate-devstack-logs.sh
- now rotate-devstack-logs.sh rotates all logs except stack.sh log

Change-Id: I39d86e405014ee368eaef8348d720d1ab8443e3b
Closes-Bug: #1600213
This commit is contained in:
Mykyta Karpin 2016-07-08 19:05:23 +03:00
parent 2694621613
commit 0b8a5f2d1b
20 changed files with 47 additions and 36 deletions

View File

@ -50,7 +50,7 @@ qemu-img convert -O raw $IBR/cirros.img $IBR/cirros.raw
mkdir /mnt/image |: mkdir /mnt/image |:
[ -n "$(losetup --all | grep $LOOP_DEV)" ] && \ losetup --all | grep -q $LOOP_DEV && \
die "Device /dev/$LOOP_DEV already exists." die "Device /dev/$LOOP_DEV already exists."

View File

@ -15,7 +15,7 @@ split_multipart() {
tail -n +$((${1} + 1)) "${udf}" | head -n $((${2} - ${1} - 1)) | \ tail -n +$((${1} + 1)) "${udf}" | head -n $((${2} - ${1} - 1)) | \
awk "//{if(f2==1){print \$0;next}} /^$/{if(f2==0){f1=1;next}} //{if(f1==1){f2=1;print \$0}}" > "${udf}.part.${n}" awk "//{if(f2==1){print \$0;next}} /^$/{if(f2==0){f1=1;next}} //{if(f1==1){f2=1;print \$0}}" > "${udf}.part.${n}"
echo ${n} echo ${n}
n=$((${n} + 1)) n=$((n + 1))
shift shift
done done
} }

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
for yaml_file in $(ls *.yaml) ; do for yaml_file in *.yaml ; do
[[ -e $yaml_file ]] || break # handle the case of no *.yaml files
echo "Converting $yaml_file ..." echo "Converting $yaml_file ..."
../ExecutionPlanGenerator.py $yaml_file ../ExecutionPlanGenerator.py $yaml_file
done done

View File

@ -26,11 +26,11 @@ echo "Remove route ..."
sudo route del -net ${FIXED_RANGE} dev ${OVS_PHYSICAL_BRIDGE} sudo route del -net ${FIXED_RANGE} dev ${OVS_PHYSICAL_BRIDGE}
echo "Cleaning directory with instances ..." echo "Cleaning directory with instances ..."
cd ${instances_mount_point} && sudo rm -rf * cd ${instances_mount_point} && sudo rm -rf ./*
cd /opt/stack cd /opt/stack
echo "Unmounting SSD drive ..." echo "Unmounting SSD drive ..."
if [ -z "$(mount | grep ${instances_mount_point})" ]; then if ! mount | grep -q ${instances_mount_point} ; then
echo "'${instances_mount_point}' is not mounted" echo "'${instances_mount_point}' is not mounted"
else else
timeout=60 timeout=60

View File

@ -29,21 +29,24 @@
defaults: global defaults: global
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.\ description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.\
\n<p>Please use this repository to make changes: <a href=\"https://git.openstack.org/openstack/murano-deployment\">https://git.openstack.org/openstack/murano-deployment</a></b>\ \n<p>Please use this repository to make changes: <a href=\"https://git.openstack.org/openstack/murano-deployment\">https://git.openstack.org/openstack/murano-deployment</a></b>\
\n<p>This job check syntax in *.yaml, *.sh files" \n<p>This job checks syntax in jenkins jobs, shell scripts"
disabled: false disabled: false
concurrent: false concurrent: false
node: master #In Jenkins v1.642.1 jobs triggered by zuul cannot be run on master
node: trusty-devstack-cz5608 || trusty-devstack-cz5680
builders: builders:
- shell: | - shell: |
#!/bin/bash #!/bin/bash
sudo pip install jenkins-job-builder
sudo apt-get install shellcheck
rm -rf murano-deployment rm -rf murano-deployment
git clone https://git.openstack.org/openstack/murano-deployment git clone https://git.openstack.org/openstack/murano-deployment
git fetch https://review.openstack.org/openstack/murano-deployment $ZUUL_REF && git checkout FETCH_HEAD cd murano-deployment
git fetch $ZUUL_URL/openstack/murano-deployment $ZUUL_REF && git checkout FETCH_HEAD
bash ./murano-deployment/murano-ci/scripts/syntax_check.sh bash ./murano-ci/scripts/syntax_check.sh
publishers: publishers:
- console-log - console-log

View File

@ -49,7 +49,7 @@ function collect_coverage() {
if [ -f "${WORKSPACE}/.with_coverage" ]; then if [ -f "${WORKSPACE}/.with_coverage" ]; then
pushd "${WORKSPACE}" pushd "${WORKSPACE}"
while [ ! -z "$(pgrep -f murano-api)" ] || [ ! -z "$(pgrep -f murano-engine)" ]; do while pgrep -f murano-api || pgrep -f murano-engine ; do
sleep 10 sleep 10

View File

@ -25,10 +25,9 @@ function prepare_murano_apps() {
if [[ "${PROJECT_NAME}" == 'murano' || "${PROJECT_NAME}" == 'murano-agent' ]]; then if [[ "${PROJECT_NAME}" == 'murano' || "${PROJECT_NAME}" == 'murano-agent' ]]; then
git clone --branch ${APPS_BRANCH} -- ${APPS_REPO} ${clone_dir} git clone --branch ${APPS_BRANCH} -- ${APPS_REPO} ${clone_dir}
local manifest
cd "${clone_dir}" cd "${clone_dir}"
for manifest in $(find . -type f -name manifest.yaml); do find . -type f -name manifest.yaml | while read file; do
local package=$(dirname "$manifest") local package=$(dirname "$file")
make_package "${package}" "${start_dir}" make_package "${package}" "${start_dir}"
done done
fi fi
@ -45,8 +44,8 @@ function prepare_old_murano_apps() {
local manifest local manifest
cd "${clone_dir}" cd "${clone_dir}"
for manifest in $(find . -type f -name manifest.yaml); do find . -type f -name manifest.yaml | while read file; do
local package=$(dirname "$manifest") local package=$(dirname "$file")
make_package "${package}" "${clone_dir}" make_package "${package}" "${clone_dir}"
done done
fi fi

View File

@ -117,7 +117,7 @@ function run_tests() {
cat << EOF cat << EOF
List of murano processes: List of murano processes:
******************************************************************************** ********************************************************************************
$(ps aux | grep murano) $(pgrep -l -f -a murano)
******************************************************************************** ********************************************************************************
EOF EOF
fi fi

View File

@ -46,9 +46,9 @@ set -o xtrace
CI_ROOT_DIR=$(cd $(dirname "$0") && cd .. && pwd) CI_ROOT_DIR=$(cd $(dirname "$0") && cd .. && pwd)
# Check Jenkins Job syntax # Check Jenkins Job syntax
jenkins-jobs -l debug test -r -o $WORKSPACE $CI_ROOT_DIR/jobs jenkins-jobs -l debug test -r -o $WORKSPACE $CI_ROOT_DIR/jenkins/jobs
# Validate shell scripts # Validate shell scripts
for script in $(find ${CI_ROOT_DIR} -name *.sh); do find "${CI_ROOT_DIR}" -name "*.sh" | while read file; do
shellcheck $script -e SC2086,SC2016,SC2034,SC2046,SC2140 shellcheck $file -e SC2086,SC2016,SC2034,SC2046,SC2140
done done

View File

@ -16,13 +16,13 @@ function rotate() {
mv "${link_name}.${i}" "${link_name}.${j}" mv "${link_name}.${i}" "${link_name}.${j}"
fi fi
done done
popd
mv "${link_target}" "${LOG_DIR}/${link_name}.1" mv "${link_target}" "${LOG_DIR}/${link_name}.1"
touch "${link_target}" touch "${link_target}"
popd
} }
#rotate Openstack services log files but not stack.sh.log
for item in $(find ${LOG_DIR} -type l -name 'screen*'); do find ${LOG_DIR} -type l -name '*.log' ! -name 'stack.sh.log' | while read file; do
rotate ${item} rotate "$file"
done done

View File

@ -11,7 +11,7 @@ to_date=${3} # $(date +'%Y-%m-%d')
to_time=${4} # '00:00:00' to_time=${4} # '00:00:00'
shift 4 shift 4
stack_components=$@ stack_components=$*
BUILD_TAG=${BUILD_TAG:-.} BUILD_TAG=${BUILD_TAG:-.}