TamaMcGlinn / AdaBots_examples

Example AdaBots programs
0 stars 2 forks source link

refactor: Use a dockerfile instead and setup env properly #1

Closed axonasif closed 2 years ago

TamaMcGlinn commented 2 years ago

I appreciate the effort, but opening the PR in gitpod does not work. Anyway, I think I will wait until gitpod supports editor-wide environment variables, or Alire allows me to autogenerate a gpr file for it. Otherwise, the language server won't pick up the alr environment. The only viable interim solution is to handwrite a non-alire gpr project file specifically for gitpod.

axonasif commented 2 years ago

It should work if the variable exports from eval $(alr printenv) is to be loaded into globally within your whole workspace container. I have to learn a bit about your project tooling and try myself. Will let you know shortly.

The thing is, whatever environment variables you export from within ~/.bashrc, will be visible to all the workspace processes (including IDE process).

So let say in your dockerfile if you have

FROM gitpod/workspace-full:latest

RUN echo 'export TEST_VAR="my_value"' >> $HOME/.bashrc

Then after your workspace is started, TEST_VAR should be available for any IDE extension/process or any manually created terminal AFAIK.

TamaMcGlinn commented 2 years ago

However, we need the contents of AdaBots_examples in order to execute 'alr printenv', since it downloads dependencies and sets GPR_PROJECT_PATH to point to specific directories inside itself and it is not available yet in the docker image. As far as I understand, the docker image is first built, without the repository workdir, and then the workdir is mounted upon starting the docker container. So with that setup, the best we can hope for is to have the env variables set when opening a terminal directory. Hence the feature request to overcome this gitpod limitation.

I really hope I am wrong, but I tried a dozen different things and concluded that this is not yet possible in gitpod.