Best way to make (temporary) changes in Community Step Template

Suppose you have a process with more than a few steps based on a Community Library Step Template. Now this step turns out to have a bug that causes a few of the steps to fail. When I make a modification in the script Octopus suggests to Make a copy but then I still need to duplicate all the failing steps by hand to use the newly created Step Template.

Cloning the step will still base it on the template that contains the bug and there is no possibility to switch templates.

I really like the idea that Octopus is now (we’re using version 3.8) more connected to the Community Library, but I can think of a scenario where multiple projects are using more than one step based on a certain template causing the deploy to fail. In that case you need to be able to fix the bug quickly.

Is there an easier way than recreating all the failing steps and disabling/removing the failing ones?

Kind regards,

Emiel

Hi Emiel,

Thanks for getting in touch! I fully agree that this is something we should support out of the box. I’ve created an issue so you can track the progress of our work. Can you please have a look at the proposed solution and let us know there whether this is something you are looking for?

Danger zone. Please backup your database before trying this.

As a temporary workaround you can create a new custom template based on the community template by using Save as action. Don’t modify the template just yet. Then use Octopus Client to switch your existing deployment processes that use the community template to the new template:

static void Main(string[] args)
        {
            var client = new OctopusClient(new OctopusServerEndpoint(url, api));
            var repo = new OctopusRepository(client);
            var project = repo.Projects.FindByName("ProjectName");
            var deploymentProcess = repo.DeploymentProcesses.Get(project.DeploymentProcessId);
            // Find the right step
            var action = deploymentProcess.Steps.Single(s => s.Name == "StepName").Actions[0];
            action.Properties["Octopus.Action.Template.Id"] = "ActionTemplates-XXXXX"; //Id of the new custom template
            action.Properties["Octopus.Action.Template.Version"] = "1";
            repo.DeploymentProcesses.Modify(deploymentProcess);
        }

Now you can go and modify the custom template. Once that’s done go and update your existing deployment processes to the latest version of the custom template.

Please, let me know if that doesn’t solve your problem.

Regards,

Pawel