Exemple #1
0
        public async Task <PackageFromBuiltInFeedResource> PushPackage(string fileName, Stream contents, bool replaceExisting = false)
        {
            try
            {
                var deltaResult = await 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 = await client.Post <FileUpload, PackageFromBuiltInFeedResource>(
                client.RootDocument.Link("PackageUpload"),
                new FileUpload()
            {
                Contents = contents, FileName = fileName
            },
                new { replace = replaceExisting });

            Logger.Info("Package transfer completed");

            return(result);
        }
Exemple #2
0
 public Task <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 }));
 }
Exemple #3
0
        public async Task <ConvertProjectToVersionControlledResponse> ConvertToVersionControlled(ProjectResource project, VersionControlSettingsResource versionControlSettings,
                                                                                                 string commitMessage)
        {
            var payload = new ConvertProjectToVersionControlledCommand
            {
                VersionControlSettings = versionControlSettings,
                CommitMessage          = commitMessage
            };

            var url      = project.Link("ConvertToVcs");
            var response = await client.Post <ConvertProjectToVersionControlledCommand, ConvertProjectToVersionControlledResponse>(url, payload);

            return(response);
        }
Exemple #4
0
        public async Task <ConvertProjectVariablesToGitResponse> MigrateVariablesToGit(ProjectResource projectResource, string branch, string commitMessage)
        {
            if (ProjectHasVariablesInGit(projectResource))
            {
                throw new NotSupportedException("Project variables have already been migrated to Git");
            }

            var command = new ConvertProjectVariablesToGitCommand
            {
                Branch        = branch,
                CommitMessage = commitMessage
            };

            if (!projectResource.HasLink("MigrateVariablesToGit"))
            {
                throw new NotSupportedException("Git variables migration is not available for this project");
            }

            return(await client.Post <ConvertProjectVariablesToGitCommand, ConvertProjectVariablesToGitResponse>(projectResource.Link("MigrateVariablesToGit"), command));
        }
 public async Task <MigrationPartialExportResource> PartialExport(MigrationPartialExportResource resource)
 {
     return(await client.Post <MigrationPartialExportResource, MigrationPartialExportResource>(client.RootDocument.Link("MigrationsPartialExport"), resource).ConfigureAwait(false));
 }