refactor: switch detected builder so first one wins

Also rename internal cnb references to pack (where possible).
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-28 16:02:22 -05:00
parent 43b9d9d4b6
commit 1ec71cd509
12 changed files with 59 additions and 37 deletions

View File

@@ -8,6 +8,24 @@ trigger-builder-dockerfile-builder-detect() {
declare trigger="builder-detect"
declare APP="$1" SOURCECODE_WORK_DIR="$2"
# hack: unfortunately our legacy code requires that buildpacks
# are detected before dockerfile support is detected
# as such, we need to force-check the herokuish and pack
# builders before allowing the dockerfile check to succeed
# in a future release, we may drop this hack, but for now,
# such is life
if [[ -f "$PLUGIN_ENABLED_PATH/builder-herokuish/builder-detect" ]]; then
if [[ -n "$($PLUGIN_ENABLED_PATH/builder-herokuish/builder-detect "$APP" "$SOURCECODE_WORK_DIR")" ]]; then
return
fi
fi
if [[ -f "$PLUGIN_ENABLED_PATH/builder-pack/builder-detect" ]]; then
if [[ -n "$($PLUGIN_ENABLED_PATH/builder-pack/builder-detect "$APP" "$SOURCECODE_WORK_DIR")" ]]; then
return
fi
fi
if [[ -f "$SOURCECODE_WORK_DIR/Dockerfile" ]]; then
echo "dockerfile"
return