feat: prohibit non-dns names for apps and process types
This is necessary for ensuring ssl certificates can be auto-retrieved for apps, and also easing integration into schedulers that use names and process types as part of DNS records. As well, this fixes an issue where we may potentially have invalid DNS entries when adding apps to custom networks. Closes #4102 Closes #4114
This commit is contained in:
24
plugins/ps/post-extract
Executable file
24
plugins/ps/post-extract
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-ps-post-extract() {
|
||||
declare desc="ps post-extract plugin trigger"
|
||||
declare trigger="post-extract"
|
||||
declare APP="$1" TMP_WORK_DIR="$2" REV="$3"
|
||||
|
||||
if [[ ! -f "$TMP_WORK_DIR/Procfile" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
pushd "$TMP_WORK_DIR" >/dev/null
|
||||
for process_type in $(procfile-util list); do
|
||||
if echo "$process_type" | grep -vqE '^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'; then
|
||||
dokku_log_fail "Invalid process type name ($process_type)"
|
||||
fi
|
||||
done
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
trigger-ps-post-extract "$@"
|
||||
Reference in New Issue
Block a user