diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2022-08-25 01:05:13 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2022-08-26 14:31:13 +0300 |
commit | ec07a6f769c73eee8631b52ef21a7451960ddd5f (patch) | |
tree | 84f949df2c467123fc6cc4c05b55f61c15bb5083 | |
parent | 2dde52be2fcec8407a2a333ebb1cb9a08c2be71c (diff) |
Abort the clone_repositories task if clone failsaxil-fail-if-stable-branch-clone-fails
-rw-r--r-- | lib/tasks/build_site.rake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/tasks/build_site.rake b/lib/tasks/build_site.rake index 7c4296ff..75e31120 100644 --- a/lib/tasks/build_site.rake +++ b/lib/tasks/build_site.rake @@ -34,8 +34,12 @@ task :clone_repositories do `git clone --branch #{branch} --single-branch #{product['repo']} --depth 1 #{product['project_dir']}` + latest_commit = `git -C #{product['project_dir']} log --oneline -n 1` + + abort("\n#{TaskHelpers::COLOR_CODE_RED}ERROR: Failed to clone #{product['repo']}.#{TaskHelpers::COLOR_CODE_RESET}") if latest_commit.empty? + # Print the latest commit from each project so that we can see which commit we're building from. - puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Latest commit: #{`git -C #{product['project_dir']} log --oneline -n 1`}#{TaskHelpers::COLOR_CODE_RESET}" + puts "\n#{TaskHelpers::COLOR_CODE_GREEN}INFO: Latest commit: #{latest_commit}#{TaskHelpers::COLOR_CODE_RESET}" end end |