by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Dalmiro Granas
@Dalmirog
I'm gonna ping you privately here on gitter to ask you for some info about your environment
Dalmiro Granas
@Dalmirog
@JamesDawson I reviewed the PR since it was super small :)
Dalmiro Granas
@Dalmirog

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 ProjectResource

2 - a LibraryVariableSetResource

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 LibraryVariableSet resource.

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 VariableSetResource.

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 new-object Octopus.Client.Model.VariableSet

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.

Does that make sense to you?
James Dawson
@JamesDawson
I get what you're saying, personally I'd just like a consistent way of writing these scripts as it makes it easier for others to follow. Octopus has an API endpoint that allows you to update a VariableSetResource object directly (/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?.
In terms of helping new or less experienced users, I was wondering whether having a set of New-* cmdlets would be an effective way of leading them into the 'pit of success' of only creating the right types objects?
James Dawson
@JamesDawson
As to the specifics of my scenario... I needed to unit test some code that contained a call to Update-OctopusResource - mocking a function in Pester doesn't override its parameter validation so when I attempted to use my original mock object (a hashtable that mimicked the required properties), it didn't match the required type Octopus.Client.Mode.Resource.
James Dawson
@JamesDawson
As you say, this is hardly a core scenario and there are multiple ways around it one way or another... so you need to do whatever you're most comfortable with for the project as a whole. Thanks for your responsiveness.
jigneshjdesai
@jigneshjdesai
@Dalmirog any example on how to delete releases? I am trying Remove-OctopusResource -Resource $release but it is throwing error Remove-OctopusResource : Cannot bind parameter 'Resource'. Cannot convert the "Octoposh.Model.OutputOctopusRelease" value of type
"Octoposh.Model.OutputOctopusRelease" to type "Octopus.Client.Model.Resource".
jigneshjdesai
@jigneshjdesai
@jigneshjdesai
@Dalmirog any example on how to delete releases? I am trying Remove-OctopusResource -Resource $release but it is throwing error Remove-OctopusResource : Cannot bind parameter 'Resource'. Cannot convert the "Octoposh.Model.OutputOctopusRelease" value of type
"Octoposh.Model.OutputOctopusRelease" to type "Octopus.Client.Model.Resource". hey @Dalmirog not sure if you had chance to look into this. Appreciate your help.
ConwayO
@ConwayO
@Dalmirog , Is there any reason why the Powershell Module New-OctopusAPIKey isn't available in the latest Octoposh Build : 0.6.11? I have been able to Load up the Module in Powershell, but would obviously prefer that it be included in a future build. Kind Regards
ConwayO
@ConwayO
@Dalmirog Is there a way to retrieve all Deploy Environments that does not force Octopus deploy to Skip 10 Environments when sourcing the Required Environment?
@Dalmirog is there a way to interact with the api directly, using custom calls without the use of the defined octoposh methods? (Maintaining the authentication)
Dalmiro Granas
@Dalmirog

@jigneshjdesai remove-OctopusResource doesn't currently delete releases. I'm on a bus right now so can't get into the specifics of why, but the recommendation would be to use octo.exe delete-release.

I can give you the full explanation later tonight :)

Dalmiro Granas
@Dalmirog

@ConwayO

New-OctopusAPIKey - I simply didn't port this cmdlet after porting things to C#. I have #259 open for it. I'll do it this week as I've been asked about it quite enough :)

Environment question - Not sure Im following this one. Which cmdlet are you running and what you mean by "skip 10"

calling API directly - Yes you can run $c = new-Octopusconnection. Then you could do $c.repository.projects.findall() for example to get all the projects. $c will be an object that holds an authenticated connection with your Octopus instance. Is this what you needed?

@jigneshjdesai about using Octo.exe delete-releases, here's do documentation for it: https://octopus.com/docs/api-and-integration/octo.exe-command-line/deleting-releases

Remember that you can download Octo.exe using Octoposh as explained here: http://octoposh.readthedocs.io/en/latest/advancedexamples/running-deployments-with-octoposh/

ConwayO
@ConwayO
image.png
@Dalmirog Thank you for your Speedy response, New-OctopusKey would be awesome! , In terms of the environment question, please see image attached
On a side note, is there any way you know of to Use the AD Credentials for User / Password Login, instead of having to prompt the user continuously.
Below is a link that someone had used integrated-Challange (Cookies) to get the login information
Many thanks for your assistance
Dalmiro Granas
@Dalmirog
@conwayo what was the full scripts you ran when you were getting all those release calls?
ConwayO
@ConwayO
Hi @Dalmirog , I am using the Get-OctopusEnvironment Command. It does a recursive 302 Object Moved Response, which intern will go through each and every page of Environment Results verses the direct API call which will return every environment at once. ($env:OctopusDeploy/api/environments)
Any Feedback on the Cookie AD Credential Method ?
jigneshjdesai
@jigneshjdesai
@Dalmirog Thank a ton!
Dennis Dyallo
@DennisDyallo
Hi guys. I was looking at Octoposh as an alternative to using the REST Api to get the hostname of the machines I'm deploying to.
Something like;
$OctopusParameters['Deployment.Hostnames']
server1.example.com,server2.example.com
For some reason $OctopusParameters doesn't include this.
The closest thing is $OctopusParameters['Octopus.Deployment.Machines']
This returns the internal machine Id's like "machine123,machine124".
I'm not sure what use I would have for these, but I came to Octoposh thinking that something like:
Get-OctopushMachine -Id "machine123"
  • would work. Alas, it does not. Where should I be looking to get these hostnames? Should Octoposh be able to take an Id parameter?
kdiddy82
@kdiddy82
Hello, it looks like with the latest Octopus update there may be an incompatibility with the Octopus.Client.dll version. Here is a link to the breaking change that Octopus has identified. https://octopus.com/downloads/compare?from=4.1.8&to=2018.3.4
The version that comes with the module is 4.22.0 and the latest version they use is 4.31.1 . This appears to be breaking a few functions, such as Get-OctopusTeam . Any plans to upgrade to the latest version of Octopus?
Rob
@ephos
@kdiddy82 We ran into this issue as well. I cloned Octoposh from Github, updated the Octoposh projects packages.config to grab version 4.31.1 of Octopus.Client and recompiled the module. This fixed the problem for us. @Dalmirog do you have plans to make this change to the module?
danielgovier
@danielgovier

Hello, I need some help with Get-OctopusDeployment. I am using Octopus 3.4.13 and Octoposh 0.6.11.
I have a project and environment that have 34 deployments listed in the DeploymentHistory table in the database. Get-OctopusDeployment throws this error when I try

PS C:\WINDOWS\system32> Get-OctopusDeployment -ProjectName Myproject -EnvironmentName Myproject_prod
Get-OctopusDeployment : Nullable object must have a value.
At line:1 char:1

  • Get-OctopusDeployment -ProjectName Myproject -EnvironmentName Myproject_prod ...
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusDeployment], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusDeployment

Get-OctopusDeployment works fine for other projects with either more or fewer deployments. The project with errors has Successful, Failed and Cancelled deployments. That is also the case with projects that do not have errors.

KellyR-STCU
@KellyR-STCU
Is there a main OctopusDeploy channel? Can't seem to find one
danielgovier
@danielgovier
@KellyR-STCU there is an Octopus Deploy forum here: https://help.octopus.com/
Woffenden
@mwoffenden
We're holding our installation at v2018.2.8 after seeing this thread. Anyone know if a perm fix is in the works?
KellyR-STCU
@KellyR-STCU
@danielgovier Thanks. It is unfortunate that there is no real time discussion for the main product :)
Rob
@ephos
@Dalmirog I submitted a PR #316 which should fix the issue folks are seeing with the Octopus.Client version after upgrading. I wasn't sure if you were able to take a look or if you need anything else from me for it. Let me know! :smile:
wurzeldub
@wurzeldub
Hi folks - I am wondering if anyone knows of any sample code that can be used to set octopus project variables from code.
Our product has 50 projects and I would love to be able to automate the process of setting up new customers.
I am tired of doing this manually.
Any help greatfully received. Thanks
Neil
@ITGuyOU
Could you fix the "EmailAddress" property in OutputOctopusUser.cs that is misspelled "EmailAdress"?
Rob
@ephos
@Dalmirog The project has been quiet for awhile, I wasn't sure if you were able to review my PR #316 yet? We (and I am assuming others) are having to clone and recompile the module internally for updated versions of Octopus Deploy Server which requires the newer Octopus.Client library. This isn't ideal as our preference would be to pull it from the PS Gallery. Is there anything I can do to help?
Stephen Shamakian
@StephenShamakian
@Dalmirog Any update to this? We upgraded our Octopus Server and were forced to upgrade OctoPosh to get Latest Deployments working again but now we can't clone projects anymore.
Stephen Shamakian
@StephenShamakian
@Dalmirog Also when performing a "Get-OctopusProject" to get all projects I keep getting this error "Sequence contains no elements"
KSchiss
@KSchiss
Hi all - I was recently observing a colleague adding environments to a Lifecycle phase - he has a lot of envs to add, and I was wondering if Octoposh would be able to do this for us, instead of adding them all in via the GUI? Thanks.
mkvideodj
@mkvideodj
Hello - can anyone advise me on how to use the OctoPosh Update-OctopusVariableSet function? I've imported the OctoPosh module and this function isn't listed. I'm trying to import the JSON export of a variable set from another Octopus instance. Thanks in advance
Rob
@ephos
@StephenShamakian I have a pending PR waiting review which updates the Octopus.Client dependency. At this point you can grab that code and compile it and it should work (far from ideal, I know). We're maintaining it this way internally since we use this module extensively in our CICD pipelines. I am wondering if this project is dead as there hasn't been any activity and none of the pending PR's are being reviewed and merged. I think soon we should look at possibly forking it and maintaining an updated version. I am not a C# developer primarily but given how useful this module is I would be willing to give it a try. Any input from @Dalmirog would be great though!
rickjuryxero
@rickjuryxero

getting Sequence contains no elements error. I have been trying to use octoposh after a long break doing other things. I installed latest module but have errors on both windows and pwsh that are same with some commandlet vs 2018.4.1 version such as get-octopusenvironment (Get-OctopusProject | select -First 2).Count
Get-OctopusProject : Sequence contains no elements
At line:1 char:2

  • (Get-OctopusProject | select -First 2).Count
  • ~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusProject], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusProject

(Get-OctopusMachine | select -First 2).Count
2

(Get-OctopusEnvironment | select -First 2).Count
Get-OctopusEnvironment : Sequence contains no elements
At line:1 char:2

  • (Get-OctopusEnvironment | select -First 2).Count
  • ~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusEnvironment], InvalidOperationException
    • FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusEnvironment

(Get-OctopusUser | select -First 2).Count
2

CialUnity
@CialUnity
hi
i am getting this error:

$VariableSets = Get-OctopusVariableSet -LibrarySetName * -IncludeUsage

OctopusUrl OctopusApiKey


http://octopus.xxx.io API-Dxxxxxxxxxxxxxxxxxxx
Get-OctopusVariableSet : Unable to process response from server: Error converting value "AmazonWebServicesAccount" to type 'Octopus.Client.Model.VariableType'. Path 'Variables[0].Type', line 22, position
40.. Response content: {
"Id": "variableset-LibraryVariableSets-522",
"OwnerId": "LibraryVariableSets-522",
"Versi
At line:6 char:17

  • ... VariableSets = Get-OctopusVariableSet -LibrarySetName * -IncludeUsage
  • ~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-OctopusVariableSet], OctopusDeserializationException
    • FullyQualifiedErrorId : Octopus.Client.Exceptions.OctopusDeserializationException,Octoposh.Cmdlets.GetOctopusVariableSet

PS C:\WINDOWS\system32>

any ideas?