Skip to content

Instantly share code, notes, and snippets.

@janv8000
Created January 29, 2019 13:30
Show Gist options
  • Save janv8000/96a07e89132b42d7b18e8310846df435 to your computer and use it in GitHub Desktop.
Save janv8000/96a07e89132b42d7b18e8310846df435 to your computer and use it in GitHub Desktop.
const string server = "http://srvoctopus";
const string apiKey = "API-keyhier";
var endpoint = new OctopusServerEndpoint(server, apiKey);
using (var client = await OctopusAsyncClient.Create(endpoint))
{
var repository = client.CreateRepository();
var allProjects = await repository.Projects.GetAll();
var variableCombinations = allProjects.SelectMany(
project => repository.VariableSets.Get(project.VariableSetId).Result.Variables,
(project, variable) => new
{
ProjectName = project.Name,
VariableValue = new { variable.Name, variable.Value, variable.IsSensitive, variable.Scope }
});
File.WriteAllText("output.json", JsonConvert.SerializeObject(variableCombinations));
Process.Start("output.json");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment