Skip to content

Handle download progress, indentation, and "already enabled" printing inside installer plugin #803

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dzuelke
Copy link
Contributor

@dzuelke dzuelke commented May 13, 2025

Instead of having our caller re-write the "nice output" file descriptor to achieve the desired indent level, we print it with the correct indent in the first place.

With this, we can also add a progress meter that is useful e.g. in local CNB installs over slow network connections, as the downloads take longer than the installs, meaning a build might hang for quite some time without and progress output, until, suddenly, the names of the packages installed are printed in fairly quick succession.

This progress meter is disabled in the classic buildpack, because Heroku Dashboard currently trips over the ANSI cursor control codes and ends up swallowing quite a lot of lines.

GUS-W-18506658

Instead of having special logic in bin/compile's attempt-native-installs-of-polyfill-provided-packages loop, we can figure out if a requested package doesn't actually trigger an install event from inside the plugin.

This can happen when a polyfill declares that it provides a particular package, but that package is already there (e.g. because the extension is bundled with PHP and always enabled).

We previously had to handle this on the caller side in bin/compile by teeing the installer output to a special file we'd inspect afterwards, since a successful install of a ".native" variant of a package and a "nothing to install or update" outcome both resulted in a 0 exit status, so we could only tell the two apart by checking the output.

GUS-W-18557233

@dzuelke dzuelke requested a review from a team as a code owner May 13, 2025 15:43
@dzuelke dzuelke marked this pull request as draft May 14, 2025 00:32
@dzuelke dzuelke force-pushed the installer-dlprogress-and-indent branch from 6384234 to 101b8f9 Compare May 19, 2025 11:27
@dzuelke dzuelke changed the title Print install download progress and handle indentation inside installer plugin Handle download progress, indentation, and "already enabled" printing inside installer plugin May 19, 2025
@dzuelke dzuelke marked this pull request as ready for review May 19, 2025 11:31
@dzuelke dzuelke force-pushed the installer-dlprogress-and-indent branch from 101b8f9 to 9be8898 Compare May 22, 2025 11:47
dzuelke added 7 commits May 22, 2025 12:50
…roku-20 world

The old test would, even if our implementation broke, never install a native ext-xmlrpc anymore, because we no longer have PHP 7.

Updated to use PHP 8 and an ext-newrelic polyfill for a version that is only available until PHP 8.3. The whole thing should yield PHP 8.4, and not downgrade to 8.3 on the native extension install attempt.
…er plugin

Instead of having our caller re-write the "nice output" file descriptor to achieve the desired indent level, we print it with the correct indent in the first place.

With this, we can also add a progress meter that is useful e.g. in local CNB installs over slow network connections, as the downloads take longer than the installs, meaning a build might hang for quite some time without and progress output, until, suddenly, the names of the packages installed are printed in fairly quick succession.

This progress meter is disabled in the classic buildpack, because Heroku Dashboard currently trips over the ANSI cursor control codes and ends up swallowing quite a lot of lines.

GUS-W-18506658
Rather than in bin/compile's attempt-native-installs-of-polyfill-provided-packages loop, we can figure out if a requested package doesn't actually trigger an install event inside the plugin.

This can happen when a polyfill declares that it provides a particular package, but that package is already there (e.g. because the extension is bundled with PHP and always enabled).

We previously had to handle this on the caller side in bin/compile by tee-ing the installer output to a special file we'd inspect afterwards, since a successful install of a ".native" variant of a package and a "nothing to install or update" outcome both resulted in a 0 exit status, so we could only tell the two apart by checking the output.

GUS-W-18557233
This allows us to also test a 'composer require' for a native extension replacing a polyfill
Turns out 60 seconds is not always enough for a build (since during the build, there are no transfers obviously, so it kicks in together with GIT_HTTP_LOW_SPEED_LIMIT=1000)
@dzuelke dzuelke force-pushed the installer-dlprogress-and-indent branch from 9be8898 to f0170e7 Compare May 22, 2025 11:55
@dzuelke dzuelke requested a review from Malax May 22, 2025 12:02
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