diff --git a/check_releasepy.bash b/check_releasepy.bash index 8a92b7f03..58bd6611e 100755 --- a/check_releasepy.bash +++ b/check_releasepy.bash @@ -11,14 +11,14 @@ exec_releasepy_test() ./release.py \ --dry-run \ --no-sanity-checks \ - gz-foo 1.2.3 token ${test_params} + gz-foo 1.2.3 token ${test_params}"" } expect_job_run() { output="${1}" job="${2}" - if ! $(grep -q "job/${job}/buildWith" <<< "${output}"); then + if ! grep -q "job/${job}/buildWith" <<< "${output}"; then echo "${job} not found in test output" exit 1 fi @@ -28,7 +28,7 @@ expect_job_not_run() { output="${1}" job="${2}" - if $(grep -q "job/${job}/buildWith" <<< "${output}"); then + if grep -q "job/${job}/buildWith" <<< "${output}"; then echo "${job} found in test output. Should not appear." exit 1 fi @@ -38,7 +38,7 @@ expect_number_of_jobs() { output=${1} njobs=${2} - if [[ `grep "job/.*/buildWithParameters" <<< "${output}" | wc -l` != "${njobs}" ]]; then + if [[ $(grep -c "job/.*/buildWithParameters" <<< "${output}") != "${njobs}" ]]; then echo "Number of jobs caled is not the expected ${njobs}" exit 1 fi @@ -48,7 +48,7 @@ expect_param() { output="${1}" param="${2}" - if ! $(grep -q "[&\?]${param}" <<< "${output}"); then + if ! grep -q "[&\?]${param}" <<< "${output}"; then echo "${param} not found in test output" exit 1 fi diff --git a/release.py b/release.py index fafebaafd..7d4f6268e 100755 --- a/release.py +++ b/release.py @@ -181,21 +181,25 @@ def get_release_repository_info(package): error("release repository not found in github.com/gazebo-release") -def download_release_repository(package, release_branch): - vcs, url = get_release_repository_info(package) - release_tmp_dir = tempfile.mkdtemp() - - if vcs == "git" and release_branch == "default": - release_branch = "master" - - # If main branch exists, prefer it over master - if release_branch == "master": - if exists_main_branch(url): - release_branch = 'main' - cmd = [vcs, "clone", "-b", release_branch, url, release_tmp_dir] - check_call(cmd, IGNORE_DRY_RUN) - return release_tmp_dir, release_branch +def download_release_repository(package, release_branch): + try: + return os.environ['_RELEASEPY_TEST_RELEASE_REPO'], 'main' + except KeyError: + vcs, url = get_release_repository_info(package) + release_tmp_dir = tempfile.mkdtemp() + + if vcs == "git" and release_branch == "default": + release_branch = "master" + + # If main branch exists, prefer it over master + if release_branch == "master": + if exists_main_branch(url): + release_branch = 'main' + + cmd = [vcs, "clone", "-b", release_branch, url, release_tmp_dir] + check_call(cmd, IGNORE_DRY_RUN) + return release_tmp_dir, release_branch def sanity_package_name_underscore(package, package_alias):