Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if we're not the first buildpack #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schneems
Copy link

@schneems schneems commented Jul 21, 2022

I had someone using the heroku/metrics buildpack which writes to .profile.d directory running before this buildpack. Because this buildpack deletes everything at the root, including things from other build packs, the change was not preserved even though it looked like it executed correctly.

I'm proposing if we detect that another buildpack has executed (i.e. if the .profile.d folder is not empty), that we abort and error with a helpful message:

[main 2446fe5] empty
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 185 bytes | 185.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. heroku/metrics
remote:        2. https://github.com/schneems/subdir-heroku-buildpack#schneems/don-t-delete-profile-d
remote: -----> HerokuRuntimeMetrics app detected
remote: -----> Setting up .profile.d to automatically run metrics agent...
remote: -----> Subdir buildpack app detected
remote: -----> Subdir buildpack in api
remote:        Another buildpack seems to have run
remote:        before the subdir buildpack. This
remote:        may cause unexpected problems.
remote:
remote:        Ensure '$ heroku buildpacks' lists
remote:        the subdir buildpack first and try
remote:        again.
remote:  !     Push rejected, failed to compile Subdir buildpack app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !	Push rejected to still-harbor-23981.
$ heroku buildpacks
=== still-harbor-23981 Buildpack URLs
1. heroku/metrics
2. https://github.com/schneems/subdir-heroku-buildpack#schneems/don-t-delete-profile-d

I had someone using the `heroku/metrics` buildpack which writes to `.profile.d` directory running before this buildpack. Because this buildpack deletes everything at the root, including things from other build packs, the change was not preserved even though it looked like it executed correctly. 

I'm proposing if we detect that another buildpack has executed (i.e. if the `.profile.d` folder is not empty), that we abort and error with a helpful message:

```
[main 2446fe5] empty
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 185 bytes | 185.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. heroku/metrics
remote:        2. https://github.com/schneems/subdir-heroku-buildpack#schneems/don-t-delete-profile-d
remote: -----> HerokuRuntimeMetrics app detected
remote: -----> Setting up .profile.d to automatically run metrics agent...
remote: -----> Subdir buildpack app detected
remote: -----> Subdir buildpack in api
remote:        Another buildpack seems to have run
remote:        before the subdir buildpack. This
remote:        may cause unexpected problems.
remote:
remote:        Ensure '$ heroku buildpacks' lists
remote:        the subdir buildpack first and try
remote:        again.
remote:  !     Push rejected, failed to compile Subdir buildpack app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !	Push rejected to still-harbor-23981.
$ heroku buildpacks
=== still-harbor-23981 Buildpack URLs
1. heroku/metrics
2. https://github.com/schneems/subdir-heroku-buildpack#schneems/don-t-delete-profile-d
```
@schneems schneems force-pushed the schneems/don-t-delete-profile-d branch from 36def2c to 99e5ac3 Compare July 21, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant