swoogan / octopus-cmdlets Goto Github PK
View Code? Open in Web Editor NEWA suite of PowerShell cmdlets that enable you to simplify and automate your interactions with an Octopus Deploy server.
A suite of PowerShell cmdlets that enable you to simplify and automate your interactions with an Octopus Deploy server.
Hello,
I need to get all the variables from a project.
Get-OctoVariable returns me just Project-Variables, no Templates, no Sets.
I use this command: Get-OctoVariable -Project ProjectName
Is there a way to get all the variables from a project?
Hi Swoogan.
Sorry for writing you here, but can you hint me - is there any way to get only variable value using Get-OctoVariable from particular environment?
I used command:
Get-OctoVariable myproject myvarAPIJson | Where-Object { $_.Environment -eq "DEV" } | Export-Csv -Path c:\DataAPIJson.csv
But it grabs all, including variable name, value and a bunch of parameters.
Can I get only value to JSON file?
Hi
These cmdlets are great but I'm having troubles with add-octomachine.
I’m running this line
Add-octoMachine -environment $environment -Name $Server -endpoint TentacleActive -Roles $roles
And getting this error
Add-OctoMachine : Cannot bind parameter 'Endpoint'. Cannot convert the "TentacleActive" value of type "System.String"
to type "Octopus.Client.Model.Endpoints.EndpointResource".
At C:\serverbuilds\OCTAddEnvironments.ps1:45 char:69
... ironment $environment -Name $Server -endpoint TentacleActive -Roles ...
CategoryInfo : InvalidArgument: (:) [Add-OctoMachine], ParameterBindingException
FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Octopus_Cmdlets.AddMachine
Any Ideas?
Cheers
PS C:\Windows\system32> Import-Module Octopus-Cmdlets
Import-Module : Could not load file or assembly
'file:///C:\Users\mukhin_s\Documents\WindowsPowerShell\Modules\Octopus-Cmdlets\Octopus-Cmdlets.dll' or one of its
dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
- CategoryInfo : NotSpecified: (:) [Import-Module], FileLoadException
- FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
Tried with both 0.1.0 and 0.2.24 versions.
PS C:\Windows\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
4 0 -1 -1
I get the following error when using Get-Machine (I import using an 'Octo-' prefix) using MachineName. Using an Id works fine.
Get-OctoMachine -Id Machines-82 works fine.
Get-OctoMachine -Name 'Server1' gives:
Get-OctoMachine : Error converting value "CalamariNeedsUpgrade" to type
'Octopus.Client.Model.MachineModelStatus'. Path 'Items[0].Status', line 22, position 39.
At line:1 char:1
+ Get-OctoMachine Server1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-OctoMachine], JsonSerializationException
+ FullyQualifiedErrorId : Newtonsoft.Json.JsonSerializationException,Octopus_Cmdlets.GetMachine
Ps: The PowerShell Gallery version is still 0.1.0
There are two Add-OctoLibraryVariable
commands that this project supports:
# Method 1
Add-OctoLibraryVariable [-VariableSet] <string> [-InputObject] <VariableResource[]> [<CommonParameters>]
# Method 2
Add-OctoLibraryVariable [-VariableSet] <string> [-Name] <string> [[-Value] <string>] [-Environments <string[]>] [-Roles <string[]>] [-Machines <string[]>] [-Sensitive] [<CommonParameters>]
I am trying to bulk copy variables (including sensitive ones) from a project to a variable set. For this purpose I am using Method 1 above, however, it doesn't currently support the -Sensitive
flag.
Just raising it as a feature request to add to this project.
I've probed with somenthing like that...
Get-OctoVariable -Project
Hey
Thanks, Helps a lot !!!
Wondering if there is possibility to copy step between Projects
Many Thanks
I'm wondering if you have any idea why I would see this error below. I've been using Get-Variable all day, but Update-Variable hasn't ever worked. (Started using these cmdlets today for the first time!)
Any thoughts would be appreciated. Maybe I'm doing something wrong here!
Thanks a lot for your submission. I have used this to automate synchronization between two Octopus instances (along with using Octopus Tools).
Add-OctoVariable throws an error when Steps parameter is not specified: null reference exception. Here is an example of my powershell script:
Add-OctoVariable -Project "Trend Reporting" -Name "TestVariable" -Value "TestValue"
I believe this is caused by the LINQ statement in file 'AddVariable.cs' on line 174 in the 'AddSteps' method.
Adding a one line 'guard' to this method resolves the problem:
if (Steps == null){ return; }
Note: I have also locally applied this change to the 'AddMachines' and 'AddEnvironments' methods.
Hope that helps -
The module should support some basic certificate oprations like:
Add-OctoCertificate
Get-OctoCertificate
Remove-OctoCertificate
Looks like “Connect-OctoServer” does not work if calls are done between ps1 file and psm1 module, is that expected?
Using Octopus-CmdLets 0.4.4 and Powershell 5.1
Test.psm1
function Get-EnvironmentViaModule()
{
"getting all environments..."
Get-OctoEnvironment
}
Test.ps1
Import-Module .\Test.psm1
$ApiKey = "API-xxxx"
$Url = "https://octopus.xxx.com"
Connect-OctoServer -Server $Url -ApiKey $ApiKey
"connected..."
Get-EnvironmentViaModule # this fails - but a direct "Get-OctoEnvironment" works
Execution:
> .\Test.ps1
connected...
getting all environments...
Get-OctoEnvironment : Connection not established. Please connect to your Octopus Deploy instance with
Connect-OctoServer
At C:\Users\andrew\Test.psm1:4 char:5
+ Get-OctoEnvironment
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-OctoEnvironment], Exception
+ FullyQualifiedErrorId : System.Exception,Octopus_Cmdlets.GetEnvironment
Get-OctoVariable "project" | ? {$_.Name -like "IIS.AppPool*"} | Add-OctoLibraryVariable "variableset"
Add-OctoLibraryVariable : Octopus Server returned an error: String reference not set to an instance of a String. Parameter name: s Server exception: System.ArgumentNullException: String reference not set to an instance of a String. Parameter name: s at System.Text.Encoding.GetBytes(String s) at Octopus.Platform.Security.MasterKey.MasterKeyEncryptionExtensions.StringToCiphertext(IMasterKeyEncryption encryption, String plaintext) in y:\work\refs\heads\release\source\Octopus.Platform\Security\MasterKey\MasterKeyEncryptionExtensions.cs:line 13 at Octopus.Server.Web.Api.Actions.VariableSetUpdateAction.Execute() in y:\work\refs\heads\release\source\Octopus.Server\Web\Api\Actions\VariableSetUpdateAction.cs:line 100 at Octopus.Platform.Web.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in y:\work\refs\heads\release\source\Octopus.Platform.Web\Api\Responder.cs:line 163 at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at CallSite.Target(Closure , CallSite , Object , Object , NancyContext ) at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass5.<.ctor>b__2(Object o) in y:\work\refs\heads\release\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 47 at CallSite.Target(Closure , CallSite , Func`2 , Object ) at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context) ----------------------- At line:1 char:69 + Get-OctoVariable "d2d server" | ? {$_.Name -like "IIS.AppPool*"} | Add-OctoLibr ... + ~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Add-OctoLibraryVariable], OctopusServerException + FullyQualifiedErrorId : Octopus.Client.Exceptions.OctopusServerException,Octopus.Cmdlets.AddLibraryVariable
Hi,
I am getting the following error when installing Octopus-Cmdlets.
PackageManagement\Install-Package : A command with name 'Get-Variable' is already available on this
system. This module 'Octopus-Cmdlets' may override the existing commands. If you still want to install
this module 'Octopus-Cmdlets', use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Octopus Server version: 3.5.2
Example command:
Add-OctoVariable -Project API -Name TEST -Value TEST -Steps Deploy -Environments QA
This is creating a variable named TEST, with the value TEST in the QA environment. However, it's not being scoped to the step named 'Deploy'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.