@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/
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 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.
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-OctopusMachine | select -First 2).Count
2
(Get-OctopusEnvironment | select -First 2).Count
Get-OctopusEnvironment : Sequence contains no elements
At line:1 char:2
(Get-OctopusUser | select -First 2).Count
2
$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
PS C:\WINDOWS\system32>
Hi all, I'm running into a similar issue as @danielgovier and wondering if anyone else has a workaround?
Get-OctopusDeployment -Environment "Production" returns
Get-OctopusDeployment : Nullable object must have a value.
At line:1 char:1
+ Get-OctopusDeployment -Environment "Production"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-OctopusDeployment], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Octoposh.Cmdlets.GetOctopusDeployment
whereas Get-OctopusDeployment -Environment "QA" works fine, and if I specify specific project(s) in "Production", Get-OctopusDeployment works fine...Any ideas?
I'm having issue removing Library Variable Set. I'm getting below message:
PS C:\projects\Scripts\Octo> $myLVS = Get-OctopusVariableSet -LibrarySetName 'SngTestLibVarSetB'
PS C:\projects\Scripts\Octo> Remove-OctopusResource -Resource $myLVS.Resource
Dunno what to delete
PS C:\projects\Scripts\Octo> $myLVS
ProjectName :
LibraryVariableSetName : SngTestLibVarSetB
ID : variableset-LibraryVariableSets-9
Variables : {}
Usage : {}
LastModifiedOn : 1/01/0001 12:00:00 AM
LastModifiedBy :
Resource : Octopus.Client.Model.VariableSetResource
PS C:\projects\Scripts\Octo> Get-OctopusVariableSet -LibrarySetName 'SngTestLibVarSetB' | Remove-OctopusResource
Dunno what to delete
Reading [https://github.com/Dalmirog/OctoPosh/blob/master/Octoposh/Cmdlets/RemoveOctopusResource.cs], it seems that Remove-OctopusResource supports
case "Octopus.Client.Model.LibraryVariableSetResource":
var libraryVariableSet = (LibraryVariableSetResource)r;
_connection.Repository.LibraryVariableSets.Delete(libraryVariableSet);
WriteObject(true,true);
break;
Where $myLVS.Resource is type Octopus.Client.Model.VariableSetResource
PS C:\projects\Scripts\Octo> $myLVS
ProjectName :
LibraryVariableSetName : SngTestLibVarSetB
ID : variableset-LibraryVariableSets-9
Variables : {}
Usage : {}
LastModifiedOn : 1/01/0001 12:00:00 AM
LastModifiedBy :
Resource : Octopus.Client.Model.VariableSetResource
OctoPosh.dll
- however I think that AWS lambda is running on a linux host that has case sensitive filesystem. Locally I updated the module to use Octoposh.dll
and got further along...
octopus-cmdlets> Find-Module -Name Octoposh
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'Octoposh'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1397 char:3
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
octopus-cmdlets> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
octopus-cmdlets>
Using Octoposh 0.6.11
Want to add a variable to a list of projects:
$variableset = Get-OctopusVariableSet -Projectname $projectName -ResourceOnly
$newvariable = New-Object Octopus.Client.Model.VariableResource
$scope = New-Object Octopus.Platform.Model.ScopeSpecification
New-Object : Cannot find type [Octopus.Platform.Model.ScopeSpecification]: verify that the assembly containing this
type is loaded.
$newvariable.Name = "newVariable"
$newvariable.Value = "Value"
$newvariable.IsEditable = $true
$newvariable.IsSensitive = $false
$newvariable.Prompt = $null # make this = to $null if you dont want a prompt for this variable
$newvariable.Scope = $null
$variableset.Variables.Add($newvariable)
Update-OctopusResource -Resource $variableset -Force