and then do the
$varset | update-octopusresource
I'll write more about this tomorrow morning : )
been working on this console project to load all the data needed for the tests to run this week. Like I mentioned earlier, this + a nice doc are the missing pieces to finally share a dev guide of the project so others can contribute to it.
^ That screenshot is the first try of running all the tests with the data generated by the console. I still haven't made the console create channels, deployments or releases, so 100/141 is not a bad first result.
Gonna work the rest of the week on improving those numbers, which will probable lead into refactoring lots of tests and writing brand new ones. Gonna try to tame the scope-creep inside of me as much as I can to ship this fast
Full Cake build:
Took it from 7-8min to 2:50 :tada:
:tada: We have on official first draft of the contributing guide :tada:
Still a WIP of cours
Get-OctopusMachine -ResourceOnly | select -ExpandProperty Name
Get-OctopusVariableSet). Here's a gist of doing it for a variableset object, it's not complete but it will give you the idea: https://gist.github.com/JamesDawson/54a09171911403e4bb68c8bd292031e7 Whilst I could write a bunch of functions to do this, it just struck me that it would be way more efficient to write all the instantiation code in C#... unless I'm missing something and there is already an easier way?
This snippet should work
In your code I can see you are creating some objects from the
Octoposh namespace. You should never do that, as the
Octoposh objects are just translations of the actual
Octopus objects for the human eyes.
If you want to create/update/delete anything in Octopus, you need to use Octopus objects.
-resourceOnly? That tells the cmdlet to return the actual Octopus resource, instead of the
Octoposhobject. Later on I add the variable (again an Octopus object, this time of the type
Octopus.client.model.variableResource) to the Octopus resource, and finally I pass the variable set Octopus object ($variableSet) to
-resourceOnlyparameter is super importante and a bit obscure atm. I've been trying to write documentation about it for ages but I always forget. I'll try to get it done this week.
Get-OctopusResourceModelcmdlet which will simplify creating my mock objects if I change my script to use
-ResourceOnlythroughout. Many thanks for the pointer.
Get-OctopusResourceModelthat made life easier when using it to create the test data objects I was talking about above... see what you think.
BeginProcessingmethod is something I already did in my refactoring branch :) https://github.com/Dalmirog/OctoPosh/blob/enh_addingGenericFunctions/Octoposh/Cmdlets/GetOctopusResourceModel.cs
As for the addition of
VariableSetResource: In Octopus a
VariableSetResource is a type of object that holds a collection of variables. This
VariableSetResource can belong to 2 other different kinds of objects:
1 - a
2 - a
VariableSetResource object doesn't exist by itself, but only as a child object of these 2. Therefore the only organic way to create a
VariableSetResource must be through the creation of either a
ProjectResource or a
For that reason in the snippet I gave you in line 10 I'm creating a
LibraryVariableSet, and then in line 13 I'm getting the
VariableSetResource that was associated with the
LibraryVariableSet that I previously created. I'm never directly creating a
I'm afraid that if the module gives users the ability to create orphan an
VariableSetResource , It'll confuse more ppl than it would help. Advanced users such as yourself should be able to work around this by creating a
VariableSetResource using raw powershell like
That said, I'm curious of how are you setting up your tests in a way that you need to create an orphan
VariableSetResource like this.
/api/variables) so I don't see it has inherently wrong - presumably the API has consistency checks to ensure that the 'OwnerId' property is valid to avoid actual orphans?.
New-*cmdlets would be an effective way of leading them into the 'pit of success' of only creating the right types objects?