Export all octopus variables in bash

Hi Team,

Similar to this posting, we have a need to be able to export all octopus variables in bash (project variables and library variable sets).

Reason for this is to simplify the experience when creating new projects. Each project would typically have different variables defined (e.g. docker container variables). We have a library script module that has common script code to help deploy a project.

What we are currently having to do for each project is to explicity export each of the variables. Furthermore, if we later add new variables, we need to remember to export that variable.

Ideally, we have a mechanism similar to Azure Devops where all the variables are automatically exported.

Alternatively if there was a way for a bash script to query the list of all available Octopus variables (bash list or csv), we can at least iterate over the list to the read the variable and export it. I believe powershell has that ability.

Hi sliew,

Thank you for reaching out to us.

I’m afraid we don’t have any example scripts for bash, but you may be able to adapt one of our PowerShell scripts to suit your purposes. You can find some examples on how to interact with variables below:

You might find this example showing how to get variables in a project to be a good starting point.

In terms of new variables being created, you might be able to monitor for them using a subscription:

I hope this helps you towards a solution. Please get back to us if you have any questions.

Best Regards,

Charles

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.