refactor: move pre-receive hook modification to post-app-clone-setup trigger
This commit is contained in:
@@ -49,7 +49,6 @@ cmd-apps-clone() {
|
||||
fi
|
||||
rm -rf "$NEW_CACHE_DIR"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
[[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP"
|
||||
plugn trigger post-app-clone "$OLD_APP" "$NEW_APP"
|
||||
dokku_log_info1_quiet "Cloning $OLD_APP to $NEW_APP... done"
|
||||
|
||||
13
plugins/git/post-app-clone-setup
Executable file
13
plugins/git/post-app-clone-setup
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
trigger-git-post-app-clone-setup() {
|
||||
declare desc="modifies git-hook"
|
||||
declare trigger="post-app-clone-setup"
|
||||
declare OLD_APP="$1" NEW_APP="$2"
|
||||
|
||||
[[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
|
||||
}
|
||||
|
||||
trigger-git-post-app-clone-setup "$@"
|
||||
Reference in New Issue
Block a user