private static void SwapProductionBackToSlot(IAzure azure, IDeploymentSlot slot)
        {
            var appUrl = slot.Parent.Name + Suffix;

            Utilities.Log("Manually swap production slot back to  " + slot.Name + "...");

            slot.Swap("production");

            Utilities.Log("Swapped production slot back to " + slot.Name);

            Utilities.Log("CURLing " + appUrl + "...");
            Utilities.Log(Utilities.CheckAddress("http://" + appUrl));
        }
Ejemplo n.º 2
0
        private async Task RunCleanupAsync(IWebApp app, IDeploymentSlot slot)
        {
            Console.WriteLine($"Will delete temporary slot {slot.Name} in 2 minutes...");

            await Task.Delay(TimeSpan.FromMinutes(2));

            Console.WriteLine($"Deleting temporary slot {slot.Name}...");

            try
            {
                await app.DeploymentSlots.DeleteByIdAsync(slot.Id);
            }
            catch (CloudException e) when(e.Body.Code == "Conflict")
            {
            }
        }
Ejemplo n.º 3
0
        public IDeploymentSlot GetSlot(IWebApp webApp, string name)
        {
            IDeploymentSlot slot = null;

            try
            {
                slot = ExecuteWithRetry(() => webApp.DeploymentSlots.GetByName(name));
            }
            catch (CloudException cex)
            {
                if (cex.Body.Code != "ResourceNotFound")
                {
                    throw;
                }
            }

            return(slot);
        }
        private static void DeployToStaging(IAzure azure, IDeploymentSlot slot)
        {
            var slotUrl = slot.Parent.Name + "-" + slot.Name + Suffix;
            var appUrl  = slot.Parent.Name + Suffix;

            Utilities.Log("Deploying staging branch to slot " + slot.Name + "...");

            slot.Update()
            .DefineSourceControl()
            .WithPublicGitRepository("https://github.com/jianghaolu/azure-site-test.git")
            .WithBranch("staging")
            .Attach()
            .Apply();

            Utilities.Log("Deployed staging branch to slot " + slot.Name);

            Utilities.Log("CURLing " + slotUrl + "...");
            Utilities.Log(Utilities.CheckAddress("http://" + slotUrl));

            Utilities.Log("CURLing " + appUrl + "...");
            Utilities.Log(Utilities.CheckAddress("http://" + appUrl));
        }
Ejemplo n.º 5
0
 public AzureAppInstance(IWebApp app, IDeploymentSlot slot)
 {
     _app  = app;
     _slot = slot;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Copies the site configurations from a given deployment slot.
 /// </summary>
 /// <param name="deploymentSlot">The deployment slot to copy the configurations from.</param>
 /// <return>The next stage of the definition.</return>
 Microsoft.Azure.Management.AppService.Fluent.DeploymentSlot.Definition.IWithCreate DeploymentSlot.Definition.IWithConfiguration.WithConfigurationFromDeploymentSlot(IDeploymentSlot deploymentSlot)
 {
     return(this.WithConfigurationFromDeploymentSlot(deploymentSlot) as DeploymentSlot.Definition.IWithCreate);
 }