feat: add plugin trigger for checking if an app has code
This will allow us to short-circuit build processes that would otherwise be triggered due to various commands in Dokku.
This commit is contained in:
1 parent
68c0d7e964
commit
1b6861cdbb
3 files changed
+48
No files matched your search
@@ -774,6 +774,20 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
# TODO
|
# TODO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `git-has-code`
|
||||||
|
|
||||||
|
- Description: Checks to see if there is code at the specified branch
|
||||||
|
- Arguments: `$APP $BRANCH_NAME`
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
```
|
||||||
|
|
||||||
### `git-post-pull`
|
### `git-post-pull`
|
||||||
|
|
||||||
- Description:
|
- Description:
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/git/internal-functions"
|
||||||
|
set -eo pipefail
|
||||||
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
|
trigger-git-git-has-code() {
|
||||||
|
declare desc="checks if there is code at a specific branch"
|
||||||
|
declare trigger="git-has-code"
|
||||||
|
declare APP="$1" BRANCH_NAME="$2"
|
||||||
|
|
||||||
|
if fn-git-has-code "$APP" "$BRANCH_NAME"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
trigger-git-git-has-code "$@"
|
||||||
@@ -405,6 +405,22 @@ fn-git-fetch() {
|
|||||||
fn-git-cmd "$APP_ROOT" config --add core.bare true
|
fn-git-cmd "$APP_ROOT" config --add core.bare true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn-git-has-code() {
|
||||||
|
declare desc="checks if there is code at a specific branch"
|
||||||
|
declare APP="$1" DOKKU_DEPLOY_BRANCH="$2"
|
||||||
|
|
||||||
|
if [[ -z "$DOKKU_DEPLOY_BRANCH" ]]; then
|
||||||
|
DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local HEAD_FILE="$DOKKU_ROOT/$APP/refs/heads/$DOKKU_DEPLOY_BRANCH"
|
||||||
|
if [[ -f "$HEAD_FILE" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
fn-git-last-updated-at() {
|
fn-git-last-updated-at() {
|
||||||
declare desc="retrieve the deploy branch for a given application"
|
declare desc="retrieve the deploy branch for a given application"
|
||||||
declare APP="$1"
|
declare APP="$1"
|
||||||
|
|||||||
Reference in new issue
Block a user