postStart commands should run in project directory
MR: postStart commands should run in project directory (!203029 - merged)
Problem
Currently postStart commands are run in the WORKDIR . That is both surprising and confusing for users, as it differs from how it works in competitor products, where the project directory is always automatically selected.
When I set up the devfile for our design system, fixing this cost me nearly 30 minutes:
- First I was confused why commands that should be available in the project directory were not working
- I then updated the devfile and installed necessary dependencies again to figure out if that was the problem
- When that not worked, I tried to figure out which directory I'm in by updating the devfile and adding the
pwdcommand - Once I noticed that this was the problem, I updated the devfile once more and manually switch the user to the right directory
@gitlab.mschoenlaub also ran into the same problem:
I think I had the same observation, I couldn't easily figure out where the post-start directory was. I just wrapped my stuff in
pushd-popdwith absolute paths. Just to be sure that I know where mycwdis
Solution
postStart commands should run in the project directory.
Acceptance Criteria
-
workingDirattribute for commands is enabled in the devfile -
main container post start commands execute in clone project directory ($PROJECT_SOURCE) by default -
secondary container post start commands execute in the WORKDIRof the container by default -
if workingDirattribute is provided for any post start command in the devfile, then post start commands execute in that specified directory for both main and secondary containers. -
Add a new fixture for the workingDirattribute -
Update documentation for the new postStart execution directory
Edited by 🤖 GitLab Bot 🤖