Export/Import variables using API between projects

Hi,
We have many projects that will share the same set of variables (different values) and process steps. Hence, we want to use the API to export/import the process and variables from one project to another.
I have successfully imported a set of variables to Project 2 from Project 1, but now I can see that the variable IDs in Project 2 are the same ones as the variable Ids in Project 1.
Can this be a problem?
I have tried to change values in Project 2 and values do not change in Project 1, so apparently is fine, but I would need to know if this can give any issue.
The same for process steps.

Thanks,

Hi,

Thanks for getting in touch,

You shouldn’t experience any issue with the variables having the same ID as the variables themselves reside within VariableSets table in the database each pertaining to a unique ID.

Based on the information provided in your query, however, It sounds like you’re essentially cloning this project.

There are some other alternative options which I’ve included below to accomplish this;

  1. Use the Octo.exe tool to export the project (variables included) and then import this into your instance with a unique project name.

I’ve included a link to our documentation on this below; (You can download the Octo.exe tool via the Downloads area of our website; https://octopus.com/downloads)

Export- https://octopus.com/docs/api-and-integration/octo.exe-command-line/export

Import - https://octopus.com/docs/api-and-integration/octo.exe-command-line/import

  1. Create all the desired variables as LibrarySetVariables so they are available for all Projects (to filter this you can apply scoping) and then also create a reusable step template to be used for all future variations of this project.

I’ve also included some documentation below for this, (This solution is more appropriate in scenarios where you aim to clone the project multiple times, whether this be to create new projects that are largely similar or to provide projects for testing purposes, ultimately this is dependant on your end goal)

LibrarySetVariables - https://octopus.com/docs/deployment-process/variables/library-variable-sets

Step Templates - https://octopus.com/docs/deployment-process/steps/custom-step-templates

I hope this helps!

If I’ve misunderstood your query in any way, or you require further assistance, please let me know :slight_smile:

Have a great day!

Kind Regards,

Reece

Thanks a lot Reece for your reply.

Exactly I am somehow cloning the projects, we create the project and assign a particular lifecycle, but some variables and process should be the same.

Actually, I am already using Octo.exe Export/Import commands, I did my tests using them. This is how I saw the same Ids in variables and steps in both projects.
But as you confirmed having same Ids is not a problem, I will continue using this approach, thanks!

Regarding your suggestions, we are already using Step templates and Library Variable Sets for those global variables that apply to All our projects.

Thanks for your assistance!
A.

Hi,

Thanks for getting back to me,

Not a problem, I’m glad to be of assistance. I also greatly appreciate you letting me know your thoughts.

If you require any assistance in the future, please don’t hesitate to reach out :slight_smile:

Have a great day!

Kind Regards,

Reece

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