Skip to content

Instantly share code, notes, and snippets.


Ross Presser rpresser

View GitHub Profile
View TransformOctopusConfig.ps1
"take in a variable JSON file from a drop target, a web.config, and a transform file and spit out a transformed file with the final substitutions."
This script is for previewing the common workflow of substituting OctopusDeploy variables within a *.foo.config transform file, then applying that transform file
to a *.config file.
Name: Transform-OctopusConfig
rpresser / gist:71b9ee973c946e21f4b3af653cb21cec
Last active Dec 19, 2019
Uniquify Names in a list of objects with a Name property, by appending _2, _3, etc.
View gist:71b9ee973c946e21f4b3af653cb21cec
class foo
public string Name { get; set; }
public string description { get; set; }
void Main()
List<foo> coll = new List<foo>();
coll.Add(new foo() { Name = "ross", description = "me" });
rpresser / gist:eb63b732932a2e9bcbdd0d7c8c7f9eca
Created Dec 18, 2019
Download OctopusDeploy artifacts from a task (C#)
View gist:eb63b732932a2e9bcbdd0d7c8c7f9eca
// This is C# code meant for use in LINQPad.
// Add nuget reference to Octopus.Client.
// Provide your OctopusDeploy server URL and APIKEY in environment variables (see the first line below),
// or hardcode them, or whatever you wish.
var endpoint = new OctopusServerEndpoint(Environment.GetEnvironmentVariable("OCTOPUS_SERVER"),Environment.GetEnvironmentVariable("OCTOPUS_CLI_API_KEY"));
var repository = new OctopusRepository(endpoint);
string taskID = "ServerTasks-104598";
var task = repository.Tasks.Get(taskID);