Merged in DCD-621-parallelize-builds (pull request #20)

DCD-621 parallelize builds

* DCD-621: Parallelizes tests ny invoking the parralelize script

* DCD-621: Removes leading / to start jira command in product_startup role

* DCD-621: Runs a scenario by name instead of using the all parameter

* DCD-621: A better find all scenarios function to ensure we look at relevant molecule scenarios. Better logging too

* DCD-510: Parallelizes tests further, running in 26 batches on 1 each. The pipeline file is now generated using Jinja

* DCD-510: Adds a pre check stage to verify if number of batches match actual number of scenarios. This test will fail (deliberately)

* DCD-510: Adds a pre check stage to verify if number of batches match actual number of scenarios. Fixes 'test' failure

* DCD-590: Adds note to development.md on how to generate a pipeline file. Adds a makefile and updates a few script commands

* DCD-590: Better documentation in development README document. Updates YML with instructions on how to fix issues with the prevalidation stage

Approved-by: Steve Smith <ssmith@atlassian.com>
Approved-by: Ben Partridge <bpartridge@atlassian.com>
This commit is contained in:
Varun Arbatti
2019-08-30 06:22:53 +00:00
parent 51e75c202c
commit 522706467e
8 changed files with 379 additions and 81 deletions

View File

@@ -6,7 +6,7 @@ set -e
# Install dev packages from Pipfile.lock if necessary.
pipenv sync --dev
BATCH_SIZE=3
BATCH_SIZE=1
BATCH_NUMBER=""
batch_args="$1"
@@ -29,17 +29,25 @@ case ${BATCH_NUMBER} in
*) echo "Bad Input for Batch number. ${BATCH_NUMBER} is not a valid batch number (Should be a number >= 1)" && exit -1 ;;
esac
scenarios=( $(ls -d1 roles/**/molecule/* | sort) )
scenarios=( $(find roles -type f -name 'molecule.yml' -exec dirname {} ';' | sort) )
offset=$(( ${BATCH_NUMBER} - 1))
test_start_index=$(( ${offset} * $BATCH_SIZE ))
scenario_batch="${scenarios[@]:$test_start_index:$BATCH_SIZE}"
echo "Scenarios that will be executed as part of this batch: ${scenario_batch}"
if [[ ${scenario_batch[@]} ]]; then
echo "Scenarios that will be executed as part of this batch: ${scenario_batch}"
else
echo "Scenario Batch for ${BATCH_NUMBER} is empty. Exiting (Non zero) now"
exit -1
fi
for scenario in ${scenario_batch}; do
pushd $(dirname $(dirname $scenario))
scenario_name=$(basename ${scenario})
role_name=$(dirname $(dirname ${scenario}))
echo "Running scenario ${scenario_name} in ${role_name}"
pushd ${role_name}
pipenv run \
molecule test --all
molecule test -s ${scenario_name}
popd
done;