Search code examples
variablesjenkinsexportoctopus-deploy

Export variables from Octopus project to json file


Is there any way to export Octopus variables to json file, using "Command" step in Jenkins? According to official Octopus documentation I only able to export Projects and Releases.

Is there any way to export particular variables from particular project?


Solution

  • Currently you can not do this using Octo.exe.

    However you can still use Octopus REST API for your purpose.

    First you have to create a API Key, which is required to access those APIs. Then call following API end point to get your specific project.

    https://<your-octopus-installation>/api/projects/<project name>
    

    Then response JSON contains VariableSetId which you should use for following request.

    https://<your-octopus-installation>/api/variables/<VariableSetId>
    

    For each of the above requests you should provide X-Octopus-ApiKey HTTP header with the API key as the value. Please refer this for more details.

    Please note that you won't get the values of sensitive variables.

    Tips: When you access the Octopus via browser, observe the HTTP requests it perform. That will helps you to understand, API calls that needs to be performed, to achieve your requirement.

    If you are in to C# you can try Octopus.Client