Skip to content

Instantly share code, notes, and snippets.

View Dalmirog-zz's full-sized avatar

Dalmiro Granas Dalmirog-zz

View GitHub Profile
@Dalmirog-zz
Dalmirog-zz / AddOctopusMachine.ps1
Created July 14, 2015 04:27
Add Octopus Machine
$OctopusAPIKey = "" #Your Octopus API Key
$OctopusURL = "" #Your Octopus URL
$header = @{ "X-Octopus-ApiKey" = $OctopusAPIKey }
$body = @'
{
"Uri":"https://localhost:10935",
"EnvironmentIds":["Environments-1"],
"Thumbprint":"D0E492C262425473FF69531074CDD77987DBB862",
"CommunicationStyle":"TentaclePassive",
@Dalmirog-zz
Dalmirog-zz / Get-OctopusEvents.ps1
Created July 9, 2015 21:57
Get Octopus events
Function Get-OctopusEvents ([datetime]$From,[datetime]$To,[string]$OctopusAPIKey,[string]$OctopusURL){
$fromStr = ($from).ToString("yyyy-MM-ddTHH:mm:ss")
$toStr = ($to).ToString("yyyy-MM-ddTHH:mm:ss")
$header = @{ "X-Octopus-ApiKey" = $OctopusAPIKey }
$events = @()
$skip = 0
do{
@Dalmirog-zz
Dalmirog-zz / variables.json
Created July 6, 2015 15:24
VariablesExample
{
"Id": "variableset-projects-801",
"OwnerId": "projects-801",
"Version": 9,
"Variables": [
{
"Id": "a40ba9eb-0cd5-46df-ba3a-25a77e69a579",
"Name": "Variable1",
"Value": "Value1",
"Scope": {
@Dalmirog-zz
Dalmirog-zz / file.ps1
Last active April 11, 2016 15:39
Create release passing package version
$apiKey = "" #Octopus API Key
$OctopusURL = "" #Octopus URL
$ProjectName = "" #project name
$Header = @{ "X-Octopus-ApiKey" = $apiKey }
#Getting Project By Name
$Project = Invoke-WebRequest -Uri "$OctopusURL/api/projects/$ProjectName" -Headers $Header| ConvertFrom-Json
#Getting Deployment Template to get next release version
@Dalmirog-zz
Dalmirog-zz / addlibrarytoproject.cs
Last active August 29, 2015 14:22
Add libraryvariableset to project
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Octopus.Client;
using Octopus.Platform;
namespace OctopusConsole
{
class Program
@Dalmirog-zz
Dalmirog-zz / UpdateVariablesSnapshot.cs
Created June 2, 2015 18:53
Update release snapshot variables (c#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Octopus.Client;
using Octopus.Platform;
namespace OctopusConsole
{
class Program
@Dalmirog-zz
Dalmirog-zz / Update-OctopusReleaseVariables.ps1
Created June 1, 2015 18:54
Update release snapshot variables
$apiKey = "" #Octopus API Key
$OctopusURL = "" #Octopus URL
$Header = @{ "X-Octopus-ApiKey" = $apiKey }
$ProjectName = "" #project name
$releaseNumber = "" #Release number
#Getting the project
@Dalmirog-zz
Dalmirog-zz / createvariable.ps1
Last active August 29, 2015 14:22
create a library variable set variable
#Connection variables
$Libraryname = "YOURVARIABLESETNAME"
$OctopusURI = "YOURURL"
$apikey = "YOURAPI"
#Creating a connection
$endpoint = new-object -TypeName Octopus.Client.OctopusClient(New-Object Octopus.Client.OctopusServerEndpoint($OctopusURI,$apikey))
$repository = new-object Octopus.Client.OctopusRepository $endpoint
#Getting the LibraryVariableSet by name
@Dalmirog-zz
Dalmirog-zz / octo.exe.ps1
Created May 28, 2015 17:41
Calling Octo.exe with prompted variables
& C:\tools\octo.exe create-release --server=[MyServerURL] --ApiKey=[MyAPIKey] --Project=[MyProjectName] --deployto=[MyEnvironmentNAme] --variable=Message1:"This is message 1" --variable=Message2:"This is message 2" --progress
@Dalmirog-zz
Dalmirog-zz / Create-GithubRelease.ps1
Created May 27, 2015 06:02
Github - Create release
$versionNumber = ''
$commitId = "" #branch
$gitHubUsername = ''
$gitHubRepository = ''
$gitHubApiKey = ''
$draft = $FALSE
$preRelease = $TRUE
$releaseData = @{
tag_name = [string]::Format("v{0}", $versionNumber);