mirror of
https://github.com/dokku/dokku.git
synced 2026-02-23 19:50:34 +01:00
refactor: deprecate git_deploy_branch in favor of plugn trigger
This commit is contained in:
5
docs/appendices/0.21.0-migration-guide.md
Normal file
5
docs/appendices/0.21.0-migration-guide.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# 0.21.0 Migration Guide
|
||||
|
||||
## Deprecations
|
||||
|
||||
- `git#git_deploy_branch()` is deprecated in favor of `plugn trigger git-deploy-branch`.
|
||||
@@ -531,6 +531,21 @@ verify_app_name "$APP"
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `git-deploy-branch`
|
||||
|
||||
- Description: Outputs the deploy branch for an app, inherited or not
|
||||
- Invoked by:
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `git-post-pull`
|
||||
|
||||
- Description:
|
||||
|
||||
@@ -3,6 +3,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/git/internal-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
@@ -109,18 +110,11 @@ git_trigger_build() {
|
||||
|
||||
git_deploy_branch() {
|
||||
declare desc="retrieve the deploy branch for a given application"
|
||||
declare cmd="git-hook"
|
||||
local APP="$1"
|
||||
declare APP="$1"
|
||||
declare deprecated=true
|
||||
dokku_log_warn "Deprecated: plugn#git-deploy-branch"
|
||||
|
||||
local DOKKU_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "$APP" "deploy-branch" "")"
|
||||
local DOKKU_GLOBAL_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "--global" "deploy-branch" "")"
|
||||
if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then
|
||||
echo "$DOKKU_DEPLOY_BRANCH"
|
||||
elif [[ -n "$DOKKU_GLOBAL_DEPLOY_BRANCH" ]]; then
|
||||
echo "$DOKKU_GLOBAL_DEPLOY_BRANCH"
|
||||
else
|
||||
echo "master"
|
||||
fi
|
||||
fn-git-deploy-branch "$APP"
|
||||
}
|
||||
|
||||
cmd-git-hook() {
|
||||
@@ -132,7 +126,7 @@ cmd-git-hook() {
|
||||
|
||||
is_valid_app_name "$APP"
|
||||
|
||||
DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")"
|
||||
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
|
||||
if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then
|
||||
echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via DOKKU_DEPLOY_BRANCH."
|
||||
echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'"
|
||||
@@ -174,7 +168,7 @@ git_build() {
|
||||
fi
|
||||
local REF="$REV"
|
||||
else
|
||||
DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")"
|
||||
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
|
||||
REF=$(<"$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH")
|
||||
fi
|
||||
|
||||
|
||||
14
plugins/git/git-deploy-branch
Executable file
14
plugins/git/git-deploy-branch
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$PLUGIN_AVAILABLE_PATH/git/internal-functions"
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
trigger-git-git-deploy-branch() {
|
||||
declare desc="git deploy-branch plugin trigger"
|
||||
declare trigger="git-deploy-branch"
|
||||
declare APP="$1"
|
||||
|
||||
fn-git-deploy-branch "$APP"
|
||||
}
|
||||
|
||||
trigger-git-git-deploy-branch "$@"
|
||||
@@ -69,3 +69,18 @@ cmd-git-report-single() {
|
||||
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
|
||||
fi
|
||||
}
|
||||
|
||||
fn-git-deploy-branch() {
|
||||
declare desc="retrieve the deploy branch for a given application"
|
||||
local APP="$1"
|
||||
|
||||
local DOKKU_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "$APP" "deploy-branch" "")"
|
||||
local DOKKU_GLOBAL_DEPLOY_BRANCH="$(fn-plugin-property-get "git" "--global" "deploy-branch" "")"
|
||||
if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then
|
||||
echo "$DOKKU_DEPLOY_BRANCH"
|
||||
elif [[ -n "$DOKKU_GLOBAL_DEPLOY_BRANCH" ]]; then
|
||||
echo "$DOKKU_GLOBAL_DEPLOY_BRANCH"
|
||||
else
|
||||
echo "master"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user