Step templates with Parameters defined cannot be edited

William Lieurance's Avatar

William Lieurance

20 Apr, 2017 09:53 PM

Hi there,

I've found a weird situation in OctopusDeploy around step templates. Normally, after I create a step template using the API I can edit it, either with the API directly again or through the web UI. However, somewhere between 3.12.0 (works) and 3.12.4 (does not), I'm seeing an issue. I've tried it on 3.12.5 (does not work) and 3.12.6 (does not work) as well. If the step template contains a "Parameter", any later attempts to update it returns the strangely-worded error

{
  "ErrorMessage": "There was a problem with your request.",
  "Errors": [
    "An action template verision with this name and version already exists."
  ]
}

I'm able to replicate this error with the following step template declaration:

{
  "Name": "fail-on-edit",
  "Description": "Proof of bug concept",
  "ActionType": "Octopus.TentaclePackage",
  "Version": 0,
  "Properties": {
  },
  "Parameters": [
      {
        "Name": "dummy-parameter",
        "DefaultValue": "#{Octopus.Project.Name}",
        "DisplaySettings": {
          "Octopus.ControlType": "SingleLineText"
        }
      }
  ]
}
After POSTing that json blob to $OCTOPUS_URL/api/actiontemplates , the resulting step template can no longer be edited, for example by adding features to it or adding text in any textbox. Any idea what might be causing that error?

Thanks!

  1. Support Staff 1 Posted by Rob Pearson on 21 Apr, 2017 03:17 AM

    Rob Pearson's Avatar

    Hi William,

    Thanks for getting in touch. I wasn't able to reproduce the issue but I think I've figured out what is happening. That error message is shown when there is a duplicate step template name and version in a database history table (Octopus maintains a history of step template changes/details). I'm guessing there is some wierd combination of things happening that is causing this issue.

    Can you run the following queries against your Octopus database and share the results?

    SELECT Id, Name, Version, LatestActionTemplateId, ActionType FROM ActionTemplateVersion;
    SELECT Id, Name, Version, ActionType, CommunityActionTemplateId FROM ActionTemplate;
    

    NOTE: You can make this conversation private if there is anything you'd like to keep private.

    I suspect there is a duplicate step template name/version in the history table (ActionTemplateVersion) and it's causing problems. If we can confirm this, we can likely isolate/fix the bug or cleanup your database.

    Looking forward to your reply.

    Thanks

    Rob

  2. 2 Posted by William Lieuran... on 21 Apr, 2017 09:23 PM

    William Lieurance's Avatar

    Very cool, Rob. On additional investigation based on what you put in your response, I figured out that the first upload of the template is fine, but if you delete that template, then add a new one with the same name, it is the replacement that cannot be edited.

    In the meantime, I'll get with my DBA to pull the queries you wanted.

    Thanks!

  3. Support Staff 3 Posted by Rob Pearson on 24 Apr, 2017 01:05 AM

    Rob Pearson's Avatar

    Hi William,

    Just a quick follow-up, one of my team members found a bug based on your reply and created a GitHub issue to get it fixed. Can you take a look at it and let me know if this is the same issue you're seeing or if your scenario is different.

    https://github.com/OctopusDeploy/Issues/issues/3435

    Thanks

    Rob

  4. 4 Posted by William Lieuran... on 24 Apr, 2017 10:54 PM

    William Lieurance's Avatar

    That issue is exactly what we're seeing. Turns out if I manually prune the orphaned ActionTemplateVersion rows (solution 1 of the github issue there) then my cannot-edit-step-templates problem is solved. This is a perfectly serviceable workaround until that issue is resolved.

    Thanks so much!

  5. Support Staff 5 Posted by Rob Pearson on 25 Apr, 2017 11:17 PM

    Rob Pearson's Avatar

    Hi William,

    Thanks for the reply and confirmation. That issue should get actioned at some point in future.

    In the mean time, happy deploying!

    Thanks

    Rob

  6. Paul Stovell closed this discussion on 31 Jul, 2017 07:22 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac