Skip to content

Comments

Add code for properly handling bicep parameters#1805

Open
Jtango18 wants to merge 1 commit intomainfrom
jt-handle-bicep-templates
Open

Add code for properly handling bicep parameters#1805
Jtango18 wants to merge 1 commit intomainfrom
jt-handle-bicep-templates

Conversation

@Jtango18
Copy link
Contributor

⚠️ Does this change require a corresponding Server Change?
⚠️ If so - please add a "Requires Server Change" label to this PR!

Recent andon cord pull (https://slipway.octopushq.com/software-products/OctopusServer/problems/SoftwareReleaseProblems-9261) was the result of differnt way Octopus/Calamari/SPF attemopt to handle parameters.

ARM Templates are heavily processed on the Server side which seems a problematic approach long term.
SPF has everything morphed into JSON through multiple serialise/deserialise calls within Calamari

This PR attempts to handle the manangement of variables sent directly from Octopus and p[rocessed specifically for Bicep template deployment.

Copy link
Contributor

@zentron zentron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works it works


var result = new JObject();

foreach (var kvp in parameterKeyValuePairs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stylistic nit, not a blocker.

You're using Linq to partly transform and allocate a list above, and then just iterating over it here to put it into a JObject.
Id consider either doing it all in a single Linq expression, or even simpler and just do it all in a singer foreach iterator.

static JToken ParseStringOrObject(string value)
{
var trimmed = value.Trim();
if (trimmed.StartsWith("{") && trimmed.EndsWith("}"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not nice but I get why its needed.
To confirm, there's no way to distinguish from the parameter type what is a string and what is an object (where the object needs the parsing and string remains as-is regardless of curly braces)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants