From d0d9e11b0b3536baf47c01eb9ed068fbd1b03e52 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 3 Jun 2021 22:02:25 +0200 Subject: [PATCH] Use a pluggable branch --- README.md | 6 +++++- plugin.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 878831b..6ce46a4 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,13 @@ Use [`abra`](https://git.autonomic.zone/coop-cloud/abra) as a [Drone plugin](htt ### Required (no default) -- **deploy_key**: SSH private key part for running `git push` related commands - **command**: The command to run (passed to `abra` executable) +### Optional + +- **deploy_key**: SSH private key part for running `git push` related commands +- **recipe_branch** (default: `main`): The target branch to use for recipe release `git push` operations + ## Example ```yaml diff --git a/plugin.sh b/plugin.sh index a2d50c1..b253e18 100755 --- a/plugin.sh +++ b/plugin.sh @@ -4,6 +4,7 @@ set -e ABRA=/root/.local/bin/abra +PLUGIN_BRANCH=${PLUGIN_BRANCH:-main} PLUGIN_HOST=${PLUGIN_HOST:-git.autonomic.zone} PLUGIN_PORT=${PLUGIN_PORT:-2222} @@ -37,8 +38,7 @@ run_abra_cmd() { git remote rm origin && \ git remote add origin "ssh://git@git.autonomic.zone:2222/coop-cloud/$recipe.git" - git checkout main && git push --set-upstream origin main > /dev/null 2>&1 || \ - git checkout master && git push --set-upstream origin master > /dev/null 2>&1 + git push --set-upstream origin "$PLUGIN_BRANCH" fi # shellcheck disable=SC2086