fix: Add a trigger to allow plugins to cleanup after a new clone is created
This commit is contained in:
1 parent
86cc15d285
commit
0498a707c8
3 files changed
+17
No files matched your search
@@ -559,6 +559,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
# TODO
|
# TODO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `post-app-clone-setup`
|
||||||
|
|
||||||
|
- Description: Allows you to run commands after an app is setup, and before it is rebuild. This is useful for cleaning up tasks, or ensuring configuration from an old app is copied to the new app
|
||||||
|
- Invoked by: `dokku apps:clone`
|
||||||
|
- Arguments: `$OLD_APP_NAME $NEW_APP_NAME`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
### `post-app-rename`
|
### `post-app-rename`
|
||||||
|
|
||||||
- Description: Allows you to run commands after an app was renamed.
|
- Description: Allows you to run commands after an app was renamed.
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
hook
|
||||||
@@ -39,6 +39,7 @@ apps_clone_cmd() {
|
|||||||
pushd "$DOKKU_ROOT/$OLD_APP/." > /dev/null
|
pushd "$DOKKU_ROOT/$OLD_APP/." > /dev/null
|
||||||
find ./* -not \( -name .cache \) | grep -v "./cache" | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
find ./* -not \( -name .cache \) | grep -v "./cache" | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
|
||||||
popd > /dev/null 2>&1 || pushd "/tmp" > /dev/null
|
popd > /dev/null 2>&1 || pushd "/tmp" > /dev/null
|
||||||
|
plugn trigger post-app-clone-setup "$OLD_APP" "$NEW_APP"
|
||||||
|
|
||||||
if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then
|
if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then
|
||||||
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
|
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache
|
||||||
|
|||||||
Reference in new issue
Block a user