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

Fix support for Heroku-24 #15

Merged
merged 7 commits into from
May 30, 2024
Merged

Fix support for Heroku-24 #15

merged 7 commits into from
May 30, 2024

Conversation

jason-salesforce
Copy link
Contributor

@jason-salesforce jason-salesforce commented May 23, 2024

This also changes the test to run inside of a dockerfile using our base builder images. Prior to this, we were getting passing tests on a broken heroku-24 build that was attempting to install packages that no longer exist in ubuntu 24.

@jason-salesforce jason-salesforce force-pushed the jason/h24 branch 2 times, most recently from 11c9973 to 8884d58 Compare May 29, 2024 21:12
@jason-salesforce jason-salesforce marked this pull request as ready for review May 29, 2024 21:42
@jason-salesforce jason-salesforce changed the title try with Dockerfile Add Heroku 24 to the CI matrix May 29, 2024
@edmorley edmorley changed the title Add Heroku 24 to the CI matrix Add support for Heroku-24 May 30, 2024
@edmorley edmorley changed the title Add support for Heroku-24 Fix support for Heroku-24 May 30, 2024
To make testing fully representative of the Heroku platform, we have to run
the built app against the run image and not the build image. (Whilst Heroku CI
will use the build image, some apps will use the buildpack outside of CI, and so
against the run image which has fewer system libraries than the build image.)
This prevents unnecessary Docker cache invalidation when editing files
that don't affect the image, meaning quicker iteration times when
developing on this buildpack locally.
Fixes this error:

```
chrome: error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory
```

And also cleans up the packages list, removing some packages that
either are no longer needed, or already exist in the base image. This
is safe to do now that `bin/test.sh` checks for missing shared libraries.
@jason-salesforce
Copy link
Contributor Author

Thanks @edmorley!

@edmorley
Copy link
Member

@jason-salesforce No problem! (I've been doing quite a few similar testing setups for missing dynamic libs etc in other repos, so thought it might save you some hassle if I pushed some changes rather than try and use review suggestion code blocks etc :-) )

@edmorley
Copy link
Member

edmorley commented May 30, 2024

With the new setup debugging should be a lot easier in the future - you run ./bin/test.sh 24 locally once - it prints out some error, then you can manually run docker run --rm -it heroku-buildpack-chrome-for-testing where you get a bash shell with all the env vars set correctly so you can run chrome directly and go from there :-)

Copy link
Member

@edmorley edmorley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling this! :-D

@jason-salesforce jason-salesforce merged commit 10cb812 into main May 30, 2024
3 checks passed
@jason-salesforce jason-salesforce deleted the jason/h24 branch May 30, 2024 13:17
@edmorley
Copy link
Member

edmorley commented May 31, 2024

GitHub release created:
https://github.com/heroku/heroku-buildpack-chrome-for-testing/releases/tag/1.0.6

And published to the buildpack registry:

$ heroku buildpacks:publish heroku-community/chrome-for-testing 1.0.6
Publishing buildpack heroku-community/chrome-for-testing... done
Publishing buildpack was successful

$ h buildpacks:versions heroku-community/chrome-for-testing | head -n 4
 Version Released At              Status
 ─────── ──────────────────────── ─────────
 7       2024-05-31T13:25:05.288Z published
 6       2024-05-22T13:39:10.282Z published

edmorley added a commit that referenced this pull request Jun 21, 2024
- Trims the APT package list for Heroku-20 and Heroku-22 to match
  the packages list used for Heroku-24.
- Uses `--no-install-recommends` to avoid pulling in unnecessary
  transitive dependencies.
- Now outputs the size of the app dir when running tests (plus removes
  test containers after they exit).

The tests added in #15 ensure that there are no missing dynamically
linked libraries, and that Chrome + Chromedriver can start.

This reduces the uncompressed slug size impact of this buildpack as follows:
- Heroku-20: 442 MB -> 350 MB
- Heroku-22: 426 MB -> 351 MB
- Heroku-24: 381 MB -> 353 MB

Fixes #17.
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.

2 participants