From c4bedfb516c2bd6be60702613bf45ea2b3e00c4d Mon Sep 17 00:00:00 2001 From: decentral1se Date: Sun, 4 Jul 2021 22:09:18 +0200 Subject: [PATCH] Get the right branch Closes https://git.autonomic.zone/coop-cloud/abra/issues/188. --- plugin.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin.sh b/plugin.sh index 368a09d..a2b565f 100755 --- a/plugin.sh +++ b/plugin.sh @@ -8,6 +8,10 @@ PLUGIN_BRANCH=${PLUGIN_BRANCH:-main} PLUGIN_HOST=${PLUGIN_HOST:-git.autonomic.zone} PLUGIN_PORT=${PLUGIN_PORT:-2222} +checkout_main_or_master() { + git checkout main > /dev/null 2>&1 || git checkout master > /dev/null 2>&1 +} + load_deploy_key() { echo "--- start ssh key load ---" mkdir -p "$HOME/.ssh/" @@ -34,7 +38,7 @@ run_abra_cmd() { echo "Automagically detected $recipe as desired recipe repository, cloning now..." git clone "https://git.autonomic.zone/coop-cloud/$recipe.git" "/root/.abra/apps/$recipe" - cd "/root/.abra/apps/$recipe" && \ + cd "/root/.abra/apps/$recipe" && checkout_main_or_master && \ git remote rm origin && \ git remote add origin "ssh://git@git.autonomic.zone:2222/coop-cloud/$recipe.git"