Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Octopus.Client;
  6. using Octopus.Platform;
  7.  
  8. namespace OctopusConsole
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. string baseUri = ""; // Octopus URL
  15. string apiKey = ""; // Octopus API Key
  16.  
  17. var endpoint = new Octopus.Client.OctopusServerEndpoint(baseUri, apiKey);
  18. var repository = new Octopus.Client.OctopusRepository(endpoint);
  19.  
  20. string projectName = ""; // Project NAme
  21. string variablesetname = ""; //variable set name
  22.  
  23. var project = repository.Projects.FindByName(projectName);
  24.  
  25. var lifecylcle = repository.Lifecycles.Get(project.LifecycleId);
  26.  
  27. var newSet = repository.LibraryVariableSets.FindOne(x => x.Name.Equals(variablesetname, StringComparison.InvariantCultureIgnoreCase));
  28.  
  29. Console.WriteLine("--Project Details--\nProjectName: {0}\nProjectID:{1}\nLifecycleID:{2}\n", project.Name, project.Id ,project.LifecycleId);
  30.  
  31. Console.WriteLine("--Variable Set Details--\nName: {0}\nID:{1}\n", newSet.Name, newSet.Id);
  32.  
  33. Console.WriteLine("--Lifecycle Details--\nName:{0}\nID{1}\n", lifecylcle.Name ,lifecylcle.Id);
  34.  
  35. project.IncludedLibraryVariableSetIds.Add(newSet.Id);
  36.  
  37. repository.Projects.Modify(project);
  38.  
  39. Console.Read();
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement