forked from projectkudu/kudu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zip push-to-deploy feature (projectkudu#2570)
- Loading branch information
1 parent
1d5f917
commit 82791e9
Showing
75 changed files
with
1,680 additions
and
610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.IO; | ||
using System.Net; | ||
using System.Net.Http; | ||
using Kudu.Client.Infrastructure; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Client.Deployment | ||
{ | ||
public class RemotePushDeploymentManager : KuduRemoteClientBase | ||
{ | ||
public RemotePushDeploymentManager(string serviceUrl, ICredentials credentials = null, HttpMessageHandler handler = null) | ||
: base(serviceUrl, credentials, handler) | ||
{ | ||
} | ||
|
||
public async Task<HttpResponseMessage> PushDeployFromStream(Stream zipFile, bool doAsync = false) | ||
{ | ||
using (var request = new HttpRequestMessage()) | ||
{ | ||
if (doAsync) | ||
{ | ||
request.RequestUri = new Uri(Client.BaseAddress + "?isAsync=true"); | ||
} | ||
|
||
request.Method = HttpMethod.Post; | ||
request.Content = new StreamContent(zipFile); | ||
return await Client.SendAsync(request); | ||
} | ||
} | ||
|
||
public async Task<HttpResponseMessage> PushDeployFromFile(string path, bool doAsync = false) | ||
{ | ||
using (var stream = File.OpenRead(path)) | ||
{ | ||
return await PushDeployFromStream(stream, doAsync); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using Kudu.Core.SourceControl; | ||
using Kudu.Contracts.Tracing; | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Core.Deployment | ||
{ | ||
public abstract class DeploymentInfoBase | ||
{ | ||
public delegate Task FetchDelegate(IRepository repository, DeploymentInfoBase deploymentInfo, string targetBranch, ILogger logger, ITracer tracer); | ||
|
||
protected DeploymentInfoBase() | ||
{ | ||
IsReusable = true; | ||
AllowDeferredDeployment = true; | ||
DoFullBuildByDefault = true; | ||
} | ||
|
||
public RepositoryType RepositoryType { get; set; } | ||
public string RepositoryUrl { get; set; } | ||
public string Deployer { get; set; } | ||
public ChangeSet TargetChangeset { get; set; } | ||
public bool IsReusable { get; set; } | ||
// Allow deferred deployment via marker file mechanism. | ||
public bool AllowDeferredDeployment { get; set; } | ||
// indicating that this is a CI triggered by SCM provider | ||
public bool IsContinuous { get; set; } | ||
public FetchDelegate Fetch { get; set; } | ||
public bool AllowDeploymentWhileScmDisabled { get; set; } | ||
|
||
// this is only set by GenericHandler | ||
// the RepositoryUrl can specify specific commitid to deploy | ||
// for instance, http://github.com/kuduapps/hellokudu.git#<commitid> | ||
public string CommitId { get; set; } | ||
|
||
// Can set to false for deployments where we assume that the repository contains the entire | ||
// built site, meaning we can skip app stack detection and simply use BasicBuilder | ||
// (KuduSync only) | ||
public bool DoFullBuildByDefault { get; set; } | ||
|
||
public bool IsValid() | ||
{ | ||
return !String.IsNullOrEmpty(Deployer); | ||
} | ||
|
||
public abstract IRepository GetRepository(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Kudu.Core.Deployment | ||
{ | ||
public enum FetchDeploymentRequestResult | ||
{ | ||
Unknown = 0, | ||
ForbiddenScmDisabled, | ||
RunningAynschronously, | ||
ConflictAutoSwapOngoing, | ||
RanSynchronously, | ||
Pending, | ||
ConflictDeploymentInProgress | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Kudu.Core.Deployment | ||
{ | ||
public interface IFetchDeploymentManager | ||
{ | ||
Task<FetchDeploymentRequestResult> FetchDeploy( | ||
DeploymentInfoBase deployInfo, | ||
bool asyncRequested, | ||
Uri requestUri, | ||
string targetBranch); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.