Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .circleci/generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -30,12 +30,15 @@ die ()

print_help()
{
echo "Usage: $0 [-f|-p|-a|-e|-i]"
echo "Usage: $0 [-f|-p|-a|-e|-i|-b]"
echo " -a Generate the config.yml, config.yml.FREE and config.yml.PAID expanded configuration"
echo " files from the main config_template.yml reusable configuration file."
echo " Use this for permanent changes in config that will be committed to the main repo."
echo " -f Generate config.yml for tests compatible with the CircleCI free tier resources"
echo " -p Generate config.yml for tests compatible with the CircleCI paid tier resources"
echo " -b Specify the base git branch for comparison when determining changed tests to"
echo " repeat. Defaults to ${BASE_BRANCH}. Note that this option is not used when"
echo " the '-a' option is specified."
echo " -e <key=value> Environment variables to be used in the generated config.yml, e.g.:"
echo " -e DTEST_BRANCH=CASSANDRA-8272"
echo " -e DTEST_REPO=https://github.com/adelapena/cassandra-dtest.git"
Expand Down Expand Up @@ -75,7 +78,7 @@ paid=false
env_vars=""
has_env_vars=false
check_env_vars=true
while getopts "e:afpi" opt; do
while getopts "e:afpib:" opt; do
case $opt in
a ) all=true
;;
Expand All @@ -90,6 +93,8 @@ while getopts "e:afpi" opt; do
fi
has_env_vars=true
;;
b ) BASE_BRANCH="$OPTARG"
;;
i ) check_env_vars=false
;;
\?) die "Invalid option: -$OPTARG"
Expand Down Expand Up @@ -177,6 +182,14 @@ fi

# add new or modified tests to the sets of tests to be repeated
if (!($all)); then
# Sanity check that the referenced branch exists
if ! git show ${BASE_BRANCH} -- >&/dev/null; then
echo -e "\n\nUnknown base branch: ${BASE_BRANCH}. Unable to detect changed tests.\n"
echo "Please use the '-b' option to choose an existing branch name"
echo "(e.g. origin/${BASE_BRANCH}, apache/${BASE_BRANCH}, etc.)."
exit 2
fi

add_diff_tests ()
{
dir="${BASEDIR}/../${2}"
Expand Down