Skip to content

Commit

Permalink
Add logging statements to the shim
Browse files Browse the repository at this point in the history
Right now then code in the shim fails it looks like the error is inside of the buildpack itself. For example this error:

```
[builder] -----> Detecting rails configuration
[builder] exit status 127
[builder] ERROR: failed to build: exit status 3
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51
```

Appears to indicate that the problem happened in `bin/compile` when in fact that was successful and the real problem didn't happen until `bin/release`. By logging our intentions to the output it makes it clearer to understand where failures are happening if/when they do happen.
  • Loading branch information
schneems authored and edmorley committed Apr 19, 2024
1 parent 85148d7 commit 3e1b6a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ cache_dir="${layers_dir}/shim"
mkdir -p "${cache_dir}"
echo "cache = true" >"${layers_dir}/shim.toml"

echo "-----> Running bin/compile"

"${target_dir}/bin/compile" "${app_dir}" "${cache_dir}" "${platform_dir}/env"

echo "-----> Setting up profile.d scripts"

# copy profile.d scripts into a layer so they will be sourced
if [[ -d .profile.d ]]; then
profile_dir="${layers_dir}/profile"
Expand All @@ -149,11 +153,15 @@ EOF
echo "launch = true" >"${profile_dir}.toml"
fi

echo "-----> Setting up exports"

if [[ -f "${target_dir}/export" ]]; then
echo "build = true" >>"${profile_dir}.toml"
mkdir -p "${profile_dir}/env.build/"
"${bp_dir}/bin/exports" "${target_dir}/export" "${platform_dir}" "${profile_dir}/env.build/"
fi

echo "-----> Running bin/release"

# run bin/release, read Procfile, and generate launch.toml
"${bp_dir}/bin/release" "${target_dir}" "${layers_dir}" "${platform_dir}" "${app_dir}"

0 comments on commit 3e1b6a9

Please sign in to comment.