Sign in Start for free

Deleting templates

How to delete process templates and project templates from Platform Hub

When you no longer need a process template or project template, you can delete it from Platform Hub. Deleting a template removes its files from your Git repository and its published versions from Octopus, so a deleted template doesn’t leave anything behind.

You can delete a template from the branch or tag you’re viewing. Octopus only deletes the versions published from that branch or tag, unless you choose to delete all versions from the default branch.

You need the PlatformHubEdit permission to delete a template.

Before you delete a template

Octopus only deletes a template when nothing depends on it. If you select Delete on a template that’s still shared or in use, Octopus tells you what’s stopping the delete.

These checks apply to the template on every branch and tag, not just the one you’re viewing.

Process templates

Before you delete a process template:

  • Stop sharing it. A process template that’s shared with all spaces or with specific spaces can’t be deleted.
  • Make sure no templated project gets it through a project template. See Process templates used by project templates.

Octopus doesn’t check projects that use the process template directly in a deployment process or runbook. After you stop sharing a process template, those projects can’t load it. Before you stop sharing, see where the process template is used and ask the project owners to remove it.

Process templates used by project templates

A project template can include a process template in its deployment process. You can’t delete a process template while any of the following is true:

  • A templated project is on a project template version that uses the process template.
  • A templated project can update to a project template version that uses the process template. A project on a stable version can update to the newest stable version in the same major version.
  • The latest stable or latest pre-release version of a project template uses the process template, because new projects would get it. This applies even when no project uses the project template.

Older project template versions that no project is on, or can update to, don’t stop the delete.

To remove a process template from use:

  1. Publish a new version of the project template without the process template.
  2. Ask project owners to update their projects to the latest version.

Project templates

Before you delete a project template:

  • Stop sharing it.
  • Remove every project created from it. This includes projects in any space, on any version of the template, and disabled projects.

You can’t detach a templated project from its project template. To see which projects use a project template, select the template’s Usage column in the Project Templates list.

Delete a template

  1. In Platform Hub, go to Process Templates or Project Templates.
  2. Select the branch you want to delete the template from.
  3. Open the overflow menu (…) for the template and select Delete.
  4. On the default branch, choose which versions to delete. See Delete all versions.
  5. Select Delete.

Octopus commits the change to the branch and deletes the versions published from that branch.

You can’t undo deleting a template.

What Octopus deletes

Where you delete from Git repository Published versions
A branch Removes the template’s files from that branch Deletes the versions published from that branch
The default branch, with All versions selected Removes the template’s files from the default branch Deletes every version, wherever it was published from
A tag No change Deletes the versions published from that tag

Octopus never changes the template’s files on other branches or tags. If the template still exists on another branch, you can keep working on it there.

For a process template, Octopus removes a single OCL file. For a project template, Octopus removes the template’s folder, including its deployment process, parameters, variables, channels, and lifecycles.

Octopus keeps a process template’s sensitive parameter default values, and a project template’s sensitive variables, while another branch or tag still has published versions of the template. Octopus deletes them when you delete all versions. It also deletes them when no other branch or tag has published versions and the template is no longer on the default branch.

Delete all versions

On the default branch, the delete dialog asks Which versions do you want to delete? when other branches or tags have published versions of the template:

  • Only versions from the default branch deletes the versions published from the default branch. This is the default.
  • All versions deletes every published version of the template, including versions published from other branches, tags, and branches or tags that no longer exist.

You can only delete all versions from the default branch.

Delete versions published from a tag

A tag can’t be changed, so Octopus doesn’t remove the template’s files from a tag. Instead, you can delete the versions published from it.

  1. Select the tag in the branch selector.
  2. Open the overflow menu (…) for the template and select Delete versions.
  3. Select Delete versions.

Delete versions is only available when the template has versions published from the tag.

Protected branches

You can’t delete a template from a protected branch, because Octopus can’t commit to it. Delete is unavailable and shows that the branch is protected.

To delete a template from a protected branch:

  1. Remove the template in a pull request. You can delete the template from an unprotected branch in Octopus, then select Create pull request next to the branch selector. This link is available when your Platform Hub repository is hosted on github.com or gitlab.com.
  2. Merge the pull request into the protected branch.
  3. In Octopus, select the protected branch. The template now shows as Removed from Git.
  4. Delete the template. See Templates removed from Git.

Templates removed from Git

When a template’s files are removed from a branch outside Octopus, such as through a pull request, the versions published from that branch still exist in Octopus. The template stays in the list with a Removed from Git status so you can clean it up.

Renaming a process template’s OCL file or a project template’s folder has the same effect, because the name is the template’s slug. The old name shows as Removed from Git, and the new name appears as a template that hasn’t been published.

For a template that’s been removed from Git, you can:

  • Stop sharing it
  • Delete it, including on a protected branch

Octopus only deletes the published versions, and doesn’t commit anything to your repository.

You can’t open, edit, share, or publish a template that’s been removed from Git.

Removed branches and tags

When a branch or tag is deleted from your Git repository, the versions published from it still exist in Octopus. The branch selector keeps listing the branch or tag with a Removed label for as long as it has published versions.

Select a removed branch or tag to see the templates with versions published from it. Each template shows as Removed from Git. You can stop sharing and delete these templates, but you can’t create or edit templates there.

After you delete the last template with versions published from a removed branch or tag, it no longer appears in the branch selector.

After you delete a template

Existing releases and runbook snapshots that use a deleted process template can still be deployed and run. They keep their own copy of what they need from the template.

If you create a new template with the same name as a deleted one, it starts fresh only when no other branch or tag still has published versions of the old template. If you want to reuse a name, delete all versions first.

Octopus stops you deleting a Platform Hub certificate that a published template version uses. After you delete a template, Octopus no longer knows that existing releases use the certificate, and lets you delete it. Deploying those releases then fails. Before you delete a certificate that a deleted template used, check that you no longer need to deploy those releases.

Version notes

  • Deleting process templates and project templates with their published versions is available from Octopus Server 2027.1.1326