Files
dokku/plugins/ps/post-extract
Jose Diaz-Gonzalez 0f514f300e 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
2020-09-09 20:07:50 -04:00

25 lines
667 B
Bash
Executable File

#!/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 "$@"