This is an automated email from the ASF dual-hosted git repository. adelapena pushed a commit to branch cassandra-3.0 in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-3.0 by this push: new 8d3c30dde4 Validate the comparison git branch when generating CircleCI configs 8d3c30dde4 is described below commit 8d3c30dde4b615835073089594003ca40a730992 Author: Derek Chen-Becker <dchen...@amazon.com> AuthorDate: Mon Nov 7 13:32:01 2022 -0700 Validate the comparison git branch when generating CircleCI configs Allow the user to use a flag to specify a non-default comparison git branch when detecting changed unit tests to repeat. Patch by Derek Chen-Becker; reviewed by Andrés de la Peña and Berenguer Blasi for CASSANDRA-17997 --- .circleci/generate.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.circleci/generate.sh b/.circleci/generate.sh index ee62a9b9da..40bdd205db 100755 --- a/.circleci/generate.sh +++ b/.circleci/generate.sh @@ -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 @@ -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" @@ -71,7 +74,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 ;; @@ -79,6 +82,8 @@ while getopts "e:afpi" opt; do ;; p ) paid=true ;; + b ) BASE_BRANCH="$OPTARG" + ;; e ) if (!($has_env_vars)); then env_vars="$OPTARG" else @@ -169,6 +174,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}" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org