Duplicate step IDs when copying templates causes missing steps in build configurations

Hi,

When you copy a build configuration template, the IDs of the build steps (e.g. "RUNNER_XXXX") in the new template are identical to the ones in the original template. If you then attach both templates to a build configuration you only see the build steps from the topmost template in the list, and the build steps from the other template are invisible.

To reproduce:

Create a new template

+ Create a new build configuration "MyBuildConfiguration"
+ Add a single PowerShell build step "MyPowerShellStep"
+ Extract the build configuration into a new template
+ Query the template via the API to see the step ids - e.g. https://myserver/app/rest/buildTypes/id:MyBuildConfiguration

Copy the template

+ Copy the original template into a new template "MyOtherBuildConfiguration"
+ Change the PowerShell step name to "MyOtherPowerShellStep"
+ Change the contents of the Powerhell script so it's effectively doing a different job
+ Query the template via the API to see the step ids - e.g. https://myserver/app/rest/buildTypes/id:MyOtherBuildConfiguration
+ Note that the step ID hasn't changed in the new template

Attach both templates

+ Create a new build configuration and attach both templates
+ Order the templates into the order (1) MyBuildConfiguration (2) MyOtherBuildConfiguration
+ Note that only one build step is added to the project - i.e. "MyPowerShellStep"
+ Query the build configuration via the API and note there's only one step listed
+ Order the templates into the order (1) MyOtherBuildConfiguration (2) MyBuildConfiguration
+ Note that the build step changes to "MyOtherPowerShellStep"
+ Query the build configuration via the API and note there's only one step listed

Why is this a problem?
When creating a new template, I'd like to be able to copy an existing one so that I pick up all of the existing settings before I make my changes. However, if I then attach the new template to a build configuration that already has the original template attached I don't get my steps added, and critically, I don't get any warning either. There is a good chance that my build configuration will be missing critical steps from the new template without me realising, and I might spend a lot of time troubleshooting before I discover the root cause.

What is the expected behaviour?

When I copy a template, modify the steps (and their display names), and then attach it to a build configuration that already has the original template attached, I expect all of the steps in the copied template to appear in my build configuration.

Workarounds

+ Create templates from scratch every time to avoid duplicate Step IDs. This means I have to reproduce all of the configuration settings in the template, rather than start with a copy of an existing template.

or

+ Copy an existing template, but then manually create copies of every step and then delete the originals. The copied steps will have new internal IDs and won't collide with the original template if both are attached to the same build configuration.

Cheers,

Mike

0
4 comments

Hi Mike,

thanks for the very detailed report. I think this is the exact same issue, could you confirm? https://youtrack.jetbrains.com/issue/TW-50492

0
Avatar
Permanently deleted user

Hi Denis,

Yeah, that looks to be the same issue.

I disagree with Anton's assessment about "create duplicate effective settings in B" being undesirable though - for me in the scenario I described above it was the *expected* behaviour and it was very confusing that only one of the steps was visible because of the duplicate IDs (which I only worked out was the root cause after a lot of investigation).

To give you a bit more of a concrete example, this is the original template I created:

Template 1 - "Create Release in Octopus Deploy"

  • Parameters: ServerUrl, Username, Password, ProjectName
  • Build Step - PowerShell script to create release

I then copied this because it already had the parameters defined and it seemed a bit daft to create a whole new template from scratch:

Template 2 - "Deploy Release in Octopus Deploy"

  • Parameters: ServerUrl, Username, Password, ProjectName
  • Build Step - modify the PowerShell script to deploy a release instead

So when I attached both of them to a build configuration I only got the "Create Release" or "Deploy Release" step depending on the order of the templates because of the underlying duplicate RUNNER IDs for the build step.

In the end, I "copied" the build step in Template 2 and this assigned it a new, unique RUNNER ID, I then deleted the original step and the template started working the way I expected.

I know in this specific case there's the Octo.exe build step plugin, but I couldn't use that for some unrelated reasons.

Hopefully that helps see why I was expecting both build steps to be shown in the process.

Cheers,

M

 

 

0

Thanks for the info. While I left a comment with a link to this topic, I would recommend further discussion be done in the issue on the tracker, as that will require the dev (Anton in this case) one less step to see your points. Feel free to put your last comment there as well, as I added the link before your comment so it might have been too late.

0
Avatar
Permanently deleted user

Hi Denis,

Will do.

Cheers,

M

0

Please sign in to leave a comment.