Own Linux Worker - Environment Variables for all users not read?

Hi All,

I am coming back to Octopus server after couple of years :slight_smile:
Now I have setup a Cloud trial for my client and I have setup own Linux worker (hosted in Azure).
It is the first time I am using Linux worker/deployment targets with Octopus and I’ve been banging my head today for something very simple:
The Linux worker has some permanent environment variable for all users (set via sh script under /etc/profile.d/<fale_name>.sh), but these env vars cannot be read from a deployment task that runs directly on the worker?
head-bang-wall

I guess there is simple explanation…

Thanks
Emil

Hi @emil.yankov,

It is great to hear that you are coming back to Octopus :smile:.

Just to be upfront, my Linux knowledge is very limited here but hopefully we can get this answered for you.

It would be great to hear how you have set this up currently just to help with a little more context.

Typically our installation instructions ask users to run the Tentacle using systemd. However, systemd is shell agnostic so it won’t source those files.

I have asked around internally and there may be a couple or ways to achieve this:

  • You could use the Environment options as a part of the systemd unit file to add environment variables in, either manually or via a file.

  • You can look to put the variables into .bashrc file (you just need to put them right at the top of the file before it returns on a non-interactive session).

I hope this helps.

All the best,
Doug

Hi @doug.pipe,

thanks for your answer - I am not a Linux expert too so that makes two of us :slight_smile:. Being not a Lunux expert makes me extra careful how I do things, so I need to double & triple check.

I used the polling worker script from your [installation instructions page]
(Linux Tentacle - Octopus Deploy) - I hope this is OK?

Thinking again what I am trying to do may be sharing env vars between users is not a good idea - although it was only for proof of concept.

I know use structured variable substitution instead relying on host variables to be available.

Thanks for your comprehensive - I wouldn’t suggest sharing variables as I though initially because it is not good from security point of view even if there are no secrets it is not good to make environment variables to other process apart the one that needs them.

Cheers,
Emil

Hi @emil.yankov,

Thank you for your reply.

Following our documentation is usually the best place to start.

Sounds like a sensible approach when thinking about sharing your variables.

If you do have any further questions, please do reach out to us.

Good luck,
Doug