Prepend 'launcher' to commands executed with 'heroku run:inside' #3116
+71
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Changes implemented here are better described on this Slack thread (Heroku internal).
TL;DR we're providing
heroku run:inside
for customers on Fir Pilot to replaceheroku run
which isn't supported on Fir apps yet, to run arbitrary commands on a dyno. For CNB stack apps (all Fir apps, currently), commands provided by a buildpack or depending on configs set by a buildpack need to be run through an entrypoint script calledlauncher
). Here we first check the app stack and if it's a CNB app, we prepend the stringlauncher
to the command being invoked by default.We also change some copy texts to the approved CX strings, remove the
hidden
property for this command to be exposed and add a--no-launcher
flag that allows to opt-out from the automatically added prefix for some edge use cases.Testing
Pre-work
For running these tests you will need the latest beta version for Heroku CLI (
heroku update beta
) and both a deployed app to a Cedar (Dogwood) Private Space and another one deployed to a Fir space, with active dynos. I did the following for preparation (thanks @justinwilaby for letting me use your test spaces):heroku apps:create test-run-inside-cedar --space justins-dev-space
.heroku apps:create test-run-inside-fir --space justins-dev-fir-space
.git clone [email protected]:heroku/node-js-getting-started.git
.cd node-js-getting-started && heroku git:remote -a test-run-inside-cedar -r cedar && heroku git:remote -a test-run-inside-fir -r fir
.git push cedar main
, wait for build and release to finish.git push fir main
.Actual testing
heroku ps -a test-run-inside-cedar
, it should always beweb.1
.heroku ps -a test-run-inside-fir
, for me it wasweb-55695d5c49-n9sc2
, but it'll change for you, just grab whatever the dyno name is.heroku run:inside web.1 -a test-run-inside-cedar -- echo test
. It should error out saying the command is unavailable for that app (it requires a special flag for cedar apps).run:inside
:heroku labs:enable dyno-run-inside -a test-run-inside-cedar
.heroku run:inside web.1 -a test-run-inside-cedar -- echo test
. Now it should work and you should see the messagetest
.heroku run:inside web-55695d5c49-n9sc2 -a test-run-inside-fir -- echo test
. It should run prependinglauncher
to the actual command and it should work.heroku run:inside web-55695d5c49-n9sc2 -a test-run-inside-fir --no-launcher -- echo test
. It should run without prependinglauncher
to the command and it should work.A caveat, though, there seems to be an issue with the
launcher
script when using double quotes around the command arguments, this doesn't work on the dyno:Using
--no-launcher
makes work, but the response isn't the expected one either:(notice the quotes were included in the output, when they shouldn't)
This is a failure coming from the dyno, probably due to a bad parsing of arguments on the
launcher
script. We will notify this on the Slack thread.SOC2 Compliance
GUS Work Item: W-17309565