public VfsControllerBaseTest(RemoteVfsManager client, bool testConflictingUpdates) { KuduClient = client; Client = client.Client; BaseAddress = Client.BaseAddress.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped).TrimEnd(_segmentDelimiters); _testConflictingUpdates = testConflictingUpdates; }
internal ApplicationManager(ISiteManager siteManager, Site site, string appName, ISettingsResolver settingsResolver) { _siteManager = siteManager; _site = site; _appName = appName; _settingsResolver = settingsResolver; SiteUrl = site.SiteUrl; ServiceUrl = site.ServiceUrl; DeploymentManager = new RemoteDeploymentManager(site.ServiceUrl + "deployments"); SettingsManager = new RemoteDeploymentSettingsManager(site.ServiceUrl + "settings"); LogStreamManager = new RemoteLogStreamManager(site.ServiceUrl + "logstream"); SSHKeyManager = new RemoteSSHKeyManager(site.ServiceUrl + "sshkey"); VfsManager = new RemoteVfsManager(site.ServiceUrl + "vfs"); VfsWebRootManager = new RemoteVfsManager(site.ServiceUrl + "vfs/site/wwwroot"); LiveScmVfsManager = new RemoteVfsManager(site.ServiceUrl + "scmvfs"); ZipManager = new RemoteZipManager(site.ServiceUrl + "zip"); CommandExecutor = new RemoteCommandExecutor(site.ServiceUrl + "command"); ProcessManager = new RemoteProcessManager(site.ServiceUrl + "diagnostics/processes"); WebHooksManager = new RemoteWebHooksManager(site.ServiceUrl + "hooks"); RepositoryManager = new RemoteRepositoryManager(site.ServiceUrl + "scm"); JobsManager = new RemoteJobsManager(site.ServiceUrl + "jobs"); var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result; GitUrl = repositoryInfo.GitUrl.OriginalString; }
internal ApplicationManager(ISiteManager siteManager, Site site, string appName, ISettingsResolver settingsResolver) { _siteManager = siteManager; _site = site; _appName = appName; _settingsResolver = settingsResolver; // Always null in public Kudu, but makes the code more similar to private Kudu NetworkCredential credentials = null; SiteUrl = site.SiteUrl; ServiceUrl = site.ServiceUrl; DeploymentManager = new RemoteDeploymentManager(site.ServiceUrl + "deployments", credentials); SettingsManager = new RemoteDeploymentSettingsManager(site.ServiceUrl + "settings", credentials); LogStreamManager = new RemoteLogStreamManager(site.ServiceUrl + "logstream", credentials); SSHKeyManager = new RemoteSSHKeyManager(site.ServiceUrl + "sshkey", credentials); VfsManager = new RemoteVfsManager(site.ServiceUrl + "vfs", credentials); VfsWebRootManager = new RemoteVfsManager(site.ServiceUrl + "vfs/site/wwwroot", credentials); LiveScmVfsManager = new RemoteVfsManager(site.ServiceUrl + "scmvfs", credentials); ZipManager = new RemoteZipManager(site.ServiceUrl + "zip", credentials); RuntimeManager = new RemoteRuntimeManager(site.ServiceUrl + "diagnostics/runtime", credentials); CommandExecutor = new RemoteCommandExecutor(site.ServiceUrl + "command", credentials); ProcessManager = new RemoteProcessManager(site.ServiceUrl + "diagnostics/processes", credentials); WebHooksManager = new RemoteWebHooksManager(site.ServiceUrl + "hooks", credentials); RepositoryManager = new RemoteRepositoryManager(site.ServiceUrl + "scm", credentials); JobsManager = new RemoteJobsManager(site.ServiceUrl + "jobs", credentials); LogFilesManager = new RemoteLogFilesManager(site.ServiceUrl + "/api/logs", credentials); SiteExtensionManager = new RemoteSiteExtensionManager(site.ServiceUrl + "api", credentials); var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result; GitUrl = repositoryInfo.GitUrl.OriginalString; }
public VfsControllerBaseTest(RemoteVfsManager client, bool testConflictingUpdates, RemoteVfsManager deploymentClient = null) { KuduClient = client; Client = client.Client; BaseAddress = Client.BaseAddress.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped).TrimEnd(_segmentDelimiters); if (deploymentClient != null) { DeploymentClient = deploymentClient.Client; DeploymentBaseAddress = DeploymentClient.BaseAddress.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped).TrimEnd(_segmentDelimiters); } _testConflictingUpdates = testConflictingUpdates; _isScmEditorTest = deploymentClient != null; }
// ARM public async Task<ResourceGroup> ActivateWebApp(WebsiteTemplate template, TryWebsitesIdentity userIdentity, string anonymousUserName, AppService temp = AppService.Web) { // Start site specific stuff var deploymentType = template != null && template.GithubRepo != null ? DeploymentType.GitWithCsmDeploy : DeploymentType.ZipDeploy; return await ActivateResourceGroup(userIdentity, temp, deploymentType, async (resourceGroup, inProgressOperation) => { SimpleTrace.Analytics.Information(AnalyticsEvents.UserCreatedSiteWithLanguageAndTemplateName, userIdentity, template, resourceGroup.CsmId); SimpleTrace.TraceInformation("{0}; {1}; {2}; {3}; {4}; {5}; {6}", AnalyticsEvents.OldUserCreatedSiteWithLanguageAndTemplateName, userIdentity.Name, template.Language, template.Name, resourceGroup.ResourceUniqueId, temp.ToString(), anonymousUserName); var site = resourceGroup.Sites.First(s => s.IsSimpleWAWSOriginalSite); var rbacTask = resourceGroup.AddResourceGroupRbac(userIdentity.Puid, userIdentity.Email); if (template != null && template.FileName != null) { var credentials = new NetworkCredential(site.PublishingUserName, site.PublishingPassword); var zipManager = new RemoteZipManager(site.ScmUrl + "zip/", credentials, retryCount: 3); Task zipUpload = zipManager.PutZipFileAsync("site/wwwroot", template.GetFullPath()); var vfsManager = new RemoteVfsManager(site.ScmUrl + "vfs/", credentials, retryCount: 3); Task deleteHostingStart = vfsManager.Delete("site/wwwroot/hostingstart.html"); await Task.WhenAll(zipUpload, deleteHostingStart); } else if (template != null && template.GithubRepo != null) { Uri githubRepo; var validUri = Uri.TryCreate(template.GithubRepo, UriKind.Absolute, out githubRepo); if (validUri && (githubRepo.AbsoluteUri.StartsWith("https://github.com/davidebbo-test/") || githubRepo.AbsoluteUri.StartsWith("https://github.com/ahmelsayed-test"))) { //Do CSM template deployment var csmTemplate = new CsmTemplateWrapper { properties = new CsmTemplateProperties { mode = "Incremental", parameters = new { siteName = new CsmTemplateParameter(site.SiteName), hostingPlanName = new CsmTemplateParameter(resourceGroup.ServerFarms.Select(sf => sf.ServerFarmName).FirstOrDefault()), repoUrl = new CsmTemplateParameter(githubRepo.AbsoluteUri) }, templateLink = new CsmTemplateLink { contentVersion = "1.0.0.0", uri = new Uri("https://raw.githubusercontent.com/" + githubRepo.AbsolutePath.Trim('/') + "/master/azuredeploy.json") } } }; await inProgressOperation.CreateDeployment(csmTemplate, block: true); await site.GetKuduDeploymentStatus(block: true); await resourceGroup.Load(); } else if (validUri && githubRepo.AbsoluteUri.StartsWith("https://github.com/")) { //Do Kudu deployment throw new InvalidGithubRepoException(); } else { throw new InvalidGithubRepoException(); } } site.AppSettings["LAST_MODIFIED_TIME_UTC"] = DateTime.UtcNow.ToString("u"); site.AppSettings["SITE_LIFE_TIME_IN_MINUTES"] = SimpleSettings.SiteExpiryMinutes; site.AppSettings["MONACO_EXTENSION_VERSION"] = "beta"; site.AppSettings["WEBSITE_TRY_MODE"] = "1"; if (template.Name.Equals("ASP.NET + Azure Search Site", StringComparison.OrdinalIgnoreCase)) { site.AppSettings["SearchServiceName"] = SimpleSettings.SearchServiceName; site.AppSettings["SearchServiceApiKey"] = AzureSearchHelper.GetApiKey(); } else if (template.Name.Equals("PHP Starter Site", StringComparison.OrdinalIgnoreCase)) { //Enable ZRay await site.EnableZRay(resourceGroup.GeoRegion); } await site.UpdateAppSettings(); if (template.GithubRepo == null) { await site.UpdateConfig(new { properties = new { scmType = "LocalGit", httpLoggingEnabled = true } }); } resourceGroup.IsRbacEnabled = await rbacTask; site.FireAndForget(); return resourceGroup; }); }
public VfsControllerSuite(RemoteVfsManager client, bool testConflictingUpdates, RemoteVfsManager deploymentClient = null) : base(client, testConflictingUpdates, deploymentClient) { }