I am coming back to Octopus server after couple of years
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?
It is great to hear that you are coming back to Octopus .
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).
thanks for your answer - I am not a Linux expert too so that makes two of us . Being not a Lunux expert makes me extra careful how I do things, so I need to double & triple check.
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.