Esempio n. 1
0
        internal ApplicationManager(ISiteManager siteManager, Site site, string appName)
        {
            _siteManager = siteManager;
            _site        = site;
            _appName     = appName;

            // 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 + "api", credentials);
            SettingsManager       = new RemoteDeploymentSettingsManager(site.ServiceUrl + "api/settings", credentials);
            LegacySettingsManager = new RemoteDeploymentLegacySettingsManager(site.ServiceUrl + "settings", credentials);
            LogStreamManager      = new RemoteLogStreamManager(site.ServiceUrl + "api/logstream", credentials);
            SSHKeyManager         = new RemoteSSHKeyManager(site.ServiceUrl + "api/sshkey", credentials);
            VfsManager            = new RemoteVfsManager(site.ServiceUrl + "api/vfs", credentials);
            VfsWebRootManager     = new RemoteVfsManager(site.ServiceUrl + "api/vfs/site/wwwroot", credentials);
            LiveScmVfsManager     = new RemoteVfsManager(site.ServiceUrl + "api/scmvfs", credentials);
            ZipManager            = new RemoteZipManager(site.ServiceUrl + "api/zip", credentials);
            RuntimeManager        = new RemoteRuntimeManager(site.ServiceUrl + "api/diagnostics/runtime", credentials);
            CommandExecutor       = new RemoteCommandExecutor(site.ServiceUrl + "api/command", credentials);
            ProcessManager        = new RemoteProcessManager(site.ServiceUrl + "api/processes", credentials);
            WebHooksManager       = new RemoteWebHooksManager(site.ServiceUrl + "api/hooks", credentials);
            RepositoryManager     = new RemoteRepositoryManager(site.ServiceUrl + "api/scm", credentials);
            JobsManager           = new RemoteJobsManager(site.ServiceUrl + "api", credentials);
            LogFilesManager       = new RemoteLogFilesManager(site.ServiceUrl + "api/logs", credentials);
            SiteExtensionManager  = new RemoteSiteExtensionManager(site.ServiceUrl + "api", credentials);
            PushDeploymentManager = new RemotePushDeploymentManager(site.ServiceUrl + "api/zipdeploy", credentials);

            var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result;

            GitUrl = repositoryInfo.GitUrl.OriginalString;
        }
Esempio n. 2
0
        private static async Task DeployZippedArtifact(ApplicationManager applicationManager,
                                                       RemotePushDeploymentManager deploymentManager,
                                                       TestFile[] files,
                                                       string type,
                                                       string path,
                                                       bool isAsync,
                                                       bool?isClean         = null,
                                                       bool expectedSuccess = true)
        {
            TestTracer.Trace($"Deploying zip type={type} path={path} isAsync={isAsync} isClean={isClean} expectedSuccess={expectedSuccess}");
            using (var zipStream = DeploymentTestHelper.CreateZipStream(files))
            {
                IList <KeyValuePair <string, string> > queryParams = GetOneDeployQueryParams(type, path, isAsync, isClean);

                var response = await deploymentManager.PushDeployFromStream(zipStream, new ZipDeployMetadata(), queryParams);

                TestTracer.Trace($"Response code={response.StatusCode}");
                if (expectedSuccess)
                {
                    response.EnsureSuccessStatusCode();
                }
                else
                {
                    Assert.True(response.StatusCode == System.Net.HttpStatusCode.BadRequest, $"This test is expected to fail with status code == 400. Observed status code == {response.StatusCode}");
                }

                if (isAsync)
                {
                    await DeploymentTestHelper.WaitForDeploymentCompletionAsync(applicationManager, deployer);
                }
            }
            TestTracer.Trace($"Validation successful!");
        }
Esempio n. 3
0
        private static async Task DeployZippedArtifact(ApplicationManager applicationManager,
                                                                            RemotePushDeploymentManager deploymentManager,
                                                                            TestFile[] files,
                                                                            string type,
                                                                            string path,
                                                                            bool isAsync)
        {
            TestTracer.Trace("Deploying zip");
            using (var zipStream = DeploymentTestHelper.CreateZipStream(files))
            {
                IList<KeyValuePair<string, string>> queryParams = GetOneDeployQueryParams(type, path, isAsync);

                var response = await deploymentManager.PushDeployFromStream(zipStream, new ZipDeployMetadata(), queryParams);
                response.EnsureSuccessStatusCode();

                if (isAsync)
                {
                    await DeploymentTestHelper.WaitForDeploymentCompletionAsync(applicationManager, deployer);
                }
            }
        }