public PackageFromBuiltInFeedResource PushPackage(string fileName, Stream contents, bool replaceExisting = false) { try { var deltaResult = AttemptDeltaPush(fileName, contents, replaceExisting); if (deltaResult != null) { return(deltaResult); } } catch (Exception ex) when(!(ex is OctopusValidationException)) { Logger.Info("Something went wrong while performing a delta transfer: " + ex.Message); } Logger.Info("Falling back to pushing the complete package to the server"); contents.Seek(0, SeekOrigin.Begin); var result = client.Post <FileUpload, PackageFromBuiltInFeedResource>( client.RootDocument.Link("PackageUpload"), new FileUpload() { Contents = contents, FileName = fileName }, new { replace = replaceExisting }); Logger.Info("Package transfer completed"); return(result); }
public PackageFromBuiltInFeedResource PushPackage(string fileName, Stream contents, bool replaceExisting = false) { return(client.Post <FileUpload, PackageFromBuiltInFeedResource>( client.RootDocument.Link("PackageUpload"), new FileUpload() { Contents = contents, FileName = fileName }, new { replace = replaceExisting })); }
/// <summary> /// Clones one project from another. /// </summary> /// <param name="client">The Repository this is tacked on to.</param> /// <param name="newProjectName">The new project's name.</param> /// <param name="newProjectDescription">The new project's description,</param> /// <param name="projectToClone">The project to clone from.</param> /// <param name="projectGroupIdForNewProject">The group the project will be placed into [null will copy the group from the projectToClone].</param> /// <param name="lifcycleId">The life cycle of the new project [null will copy the lifecycle from the projectToClone].</param> internal static void CloneProject(this IOctopusClient client, string newProjectName, string newProjectDescription, ProjectResource projectToClone, string projectGroupIdForNewProject, string lifcycleId) { var projectToCreate = new ProjectResource { Name = newProjectName, Description = newProjectDescription, ProjectGroupId = projectGroupIdForNewProject, LifecycleId = lifcycleId }; client.Post(string.Format(ResourceStrings.CloneCommandApiFormat, projectToClone.Id), projectToCreate); }
public ConvertProjectToVersionControlledResponse ConvertToVersionControlled(ProjectResource project, VersionControlSettingsResource versionControlSettings, string commitMessage) { var payload = new ConvertProjectToVersionControlledCommand { VersionControlSettings = versionControlSettings, CommitMessage = commitMessage }; var url = project.Link("ConvertToVcs"); var response = client.Post <ConvertProjectToVersionControlledCommand, ConvertProjectToVersionControlledResponse>(url, payload); return(response); }
public MigrationPartialExportResource PartialExport(MigrationPartialExportResource resource) { return(client.Post <MigrationPartialExportResource, MigrationPartialExportResource>(client.RootDocument.Link("MigrationsPartialExport"), resource)); }