Create Large number of Projects

I’m looking at a situation where we may receive large number of different web applications for deployment. The design I have in mind is that each application will be a project and all the application project will have the same deployment steps. The only difference between the application project will be:

  1. Target Role
  2. Variable values

I need a means to quickly create (plus recreate if change occurs) these project and I came up with the following solution:

  1. Auto generate the project from scratch using powershell script (instead of the UI) - which will allow me to source manage project construction.
    - The question here is, how difficult is this and do we have any sample code to do this?
  2. Create a Project template using the UI and then Clone and amend the project using powershell.
    I’ve found the script to do the Clone project and Amend the Variables. Now how do you amend Step details (e.g. Role)

It would be interesting to hear whether you have any other suggest on how we can tackle the setup of large quantity of application.

Hi,

Thanks for getting in touch! From what I can see, it does not look like we have anything currently written for this. However, we do have a quite extensive wiki for our API which I can help by pointing out appropriate pages and documentation.

The first place to start would be the GitHub and docs page for our API:


The docs have some basic info and links to the GitHub API page. The GitHub page has links to the API wiki and a bunch of example scripts that have been useful at one point or another. You should be able to use these example scripts alongside the API wiki to create a script to do what you are after.

In our API wiki we have some instructions on creating projects via the API:

There is also a section on creating deployment steps:

As for your second idea, there are users who create a single reference project and clone it multiple times in the UI. You could then use PowerShell and the above API info to make these changes.

Again, this will all require quite a bit of coding on your end as I cannot find any example code to do this with.

Let me know what you think here. 

Best regards,
Daniel

It would be nice to create the project from scratch but a lot of work (maybe when I have time I’ll give it a go). For now I’ve been able create a script to clone and amend variables in a project.

One thing I’m not sure how to do is, how do you amend the Package ID of a “Deploy a package” Step

Hi,

Thanks for getting back! One of our devs just uploaded the following script to our API repo on GitHub, it’s a script for updating the deployment process via the API but can be modified to change the Package ID of your deployment steps.

https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/Octopus.Client/Csharp/Projects/UpdateProjectActionProperties

If you retrieve one of your projects deployment process via api, you should see Octopus.Action.Package.PackageId This is used to store the PackageID.

Let me know if this helps or if you have any further questions.

Best regards,
Daniel