Not able to add a Package Reference to an Project Action Step

We are attempting to create a project step via the Octopus API to our self-hosted Octopus instance. Using the SDK & PowerShell, we are attempting to add an action to a step within a project. The Step & its configuration is all being set correctly however the step is based on a custom step template that need’s a package reference.

We are able to add the Octopus.Client.Model.PackageReferenceCollection Package to the action to commit to the step in code. Once the deployment process object gets committed back to the server, the Octopus.Client.Model.PackageReferenceCollection configuration is missing. We believe this is to do with the Packages Property & likely the API endpoint only accepting {get;} rather then {get;set;} methods.

If this is the case, what is the prefer or required method of setting a package reference against a project step action?

A current manual workaround to get the config to set in Octopus is to update the ActionTemplate that is referenced in the step, once you update the step to use the latest version, the Octopus UI will set the require package config we are attempting to set. It seems either the UI is making the correct call or has the required method to set this config.

Many thanks

Octopus Version: v2021.1 (Build 7236)

Hi Tom, I’m sorry you are having a difficult time getting that script to work. I ran into something similar when I was working on the SpaceCloner. The package never appeared to be getting set.

You mention step templates and package references. I like to compare what the expected model is on what I know works. For my step template it is:

That parameter is:

In my experience, not only does the package reference have to be there, but the parameter has to be set as well.

You can find all the parameters to set by hitting the: /api/[Space-Id]/actiontemplates/[ActionTemplate-Id] endpoint

For example: api/Spaces-106/actiontemplates/ActionTemplates-221

That’ll return an array of parameters:

I hope that helps!

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