diff --git a/entrypoint-ssh.sh b/entrypoint-ssh.sh index 3cb39ce..041b8a1 100644 --- a/entrypoint-ssh.sh +++ b/entrypoint-ssh.sh @@ -6,8 +6,20 @@ token_env=${PLUGIN_TOKEN_ENV} output=${PLUGIN_OUTPUT} name=${PLUGIN_NAME} email=${PLUGIN_EMAIL} -if [[ -z "$token_env" || -z "$branch" || -z "$name" || -z "$email" ]]; then - echo "Invalid configuration: Token environment variable name, branch name empty, name, or email" + +# Allow passing a different push SSH URL +clone_url=$CI_REPO_CLONE_SSH_URL +if [[ -n "$PLUGIN_SSH_URL" ]]; then + clone_url=${PLUGIN_SSH_URL} +fi + +if [[ -z "$token_env" || -z "$branch" || -z "$name" || -z "$email" || -z "$clone_url" ]]; then + echo "Invalid configuration: Token environment variable name, branch name empty, name, clone URL, or email" + echo "Token env: $token_env" + echo "branch: $branch" + echo "Name: $name" + echo "Email: $email" + echo "Clone URL: $clone_url" exit 1 fi @@ -33,4 +45,4 @@ git add --all git commit -m "Deploy new version $CI_COMMIT_SHA" # Push the repository -git push -u "$CI_REPO_CLONE_SSH_URL" -f "$branch" \ No newline at end of file +git push -u "$clone_url" -f "$branch" \ No newline at end of file