-
Notifications
You must be signed in to change notification settings - Fork 11
Advanced Usage
Colin Svingen edited this page Apr 2, 2015
·
6 revisions
Copy/Clone an existing project:
Copy-OctoProject [-Name] <string> [-Destination] <string> [-ProjectGroup] <string> [<CommonParameters>]
Copy a step in a project's deployment process:
Copy-OctoStep [-Project] <string> [-Name] <string> [[-Destination] <string>] [<CommonParameters>]
Find variables with a specific name:
Get-OctoVariable -Project MyProject | Where-Object { $_.Name -like "Basic*" }
Find variables with a particular value:
Get-OctoVariable -Project MyProject | Where-Object { $_.Value -like "http://*" }
Get variables for a specific environment:
Get-OctoVariable -Project MyProject | Where-Object { $_.Environment -eq "MyProject_PROD" }
Export variables to a CSV file:
Get-OctoVariable -Project MyProject | Export-Csv -Path myproject.csv
Remove variables with a certain name:
Get-OctoVariable -Project MyProject | Where-Object { $_.Name -like "Basic*" } | Remove-OctoVariable -Project MyProject
Copy variables from one project to another:
Get-OctoVariable -Project MyProject | Where-Object { $_.Name -like "Basic*" } | Add-OctoVariable -Project MyOtherProject
Move variables from a project to a library variable set:
Add-OctoVariableSet -Name Database -Description "A variable set to hold connection strings"
Get-OctoVariable -Project MyProject | Where-Object { $_.Name -like "Database.*" } | % {
Add-OctoLibraryVariable -VariableSet Database -InputObject $_; Remove-OctoVariable -Project MyProject -InputObject $_
}
Find where a value of a variable comes from:
function Find-VariableSource([string]$project, [string]$value) {
Get-OctoVariable -Project $project | Where-Object { $_.Value -eq $value } | Foreach-Object {
[PSCustomObject]@{ Name = $_.Name; SourceType = "Project"; SourceName = $project }
}
Get-OctoProject $project | select -ExpandProperty IncludedLibraryVariableSetIds | Foreach-Object {
$name = (Get-OctoVariableSet -Id $_).Name;
Get-OctoVariable -VariableSet $name |
Where-Object { $_.Value -eq $value } | Foreach-Object {
[PSCustomObject]@{ Name = $_.Name; SourceType = "VariableSet"; SourceName = $name }
}
}
}
> Find-VariableSource MyProject "somevalue"
Name SourceType SourceName
---- ---------- ----------
SomeVariable VariableSet SomeVariableSet