예제 #1
0
        public override bool Execute()
        {
            if (String.IsNullOrEmpty(PublishIntermediateOutputPath))
            {
                Log.LogError(Resources.KUDUDEPLOY_DeployOutputPathEmpty);
                return(false);
            }

            KuduConnectionInfo connectionInfo = GetConnectionInfo();

            if (String.IsNullOrEmpty(connectionInfo.UserName) || String.IsNullOrEmpty(connectionInfo.Password) || String.IsNullOrEmpty(connectionInfo.DestinationUrl))
            {
                Log.LogError(Resources.KUDUDEPLOY_ConnectionInfoMissing);
                return(false);
            }

            bool publishStatus = DeployFiles(connectionInfo);

            if (publishStatus)
            {
                Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, Resources.KUDUDEPLOY_PublishSucceeded);
            }
            else
            {
                Log.LogError(Resources.KUDUDEPLOY_PublishFailed);
            }

            return(publishStatus);
        }
예제 #2
0
        internal bool DeployZipFile(KuduConnectionInfo connectionInfo)
        {
            bool          success;
            KuduZipDeploy zipDeploy = new KuduZipDeploy(connectionInfo, Log);

            string      zipFileFullPath = CreateZipFile(PublishIntermediateOutputPath);
            Task <bool> zipTask         = zipDeploy.DeployAsync(zipFileFullPath);

            try
            {
                success = zipTask.Wait(TimeoutMilliseconds);
                if (!success)
                {
                    Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout));
                }
            }
            catch (AggregateException ae)
            {
                Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message));
                success = false;
            }

            // Clean up the resources.
            DeleteTempZipFile(zipFileFullPath);

            return(success && zipTask.Result);
        }
예제 #3
0
        internal bool DeployFiles(KuduConnectionInfo connectionInfo)
        {
            KuduVfsDeploy fileDeploy = new KuduVfsDeploy(connectionInfo, Log);

            bool success;

            if (!DeployIndividualFiles)
            {
                success = DeployZipFile(connectionInfo);
                return(success);
            }

            // Deploy the files.
            Task deployTask = fileDeploy.DeployAsync(PublishIntermediateOutputPath);

            try
            {
                success = deployTask.Wait(TimeoutMilliseconds);
                if (!success)
                {
                    Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, Resources.KUDUDEPLOY_OperationTimeout));
                }
            }
            catch (AggregateException ae)
            {
                Log.LogError(String.Format(Resources.KUDUDEPLOY_AzurePublishErrorReason, ae.Flatten().Message));
                success = false;
            }

            return(success);
        }
예제 #4
0
        internal KuduConnectionInfo GetConnectionInfo()
        {
            KuduConnectionInfo connectionInfo = new KuduConnectionInfo();

            connectionInfo.DestinationUrl = PublishUrl;

            connectionInfo.UserName = UserName;
            connectionInfo.Password = Password;
            connectionInfo.SiteName = PublishSiteName;

            return(connectionInfo);
        }
예제 #5
0
 public KuduVfsDeploy(KuduConnectionInfo connectionInfo, TaskLoggingHelper logger)
     : base(connectionInfo, logger)
 {
     _logger    = logger;
     _postTasks = new List <System.Threading.Tasks.Task>();
 }
예제 #6
0
 internal KuduConnect(KuduConnectionInfo connectionInfo, TaskLoggingHelper logger)
 {
     _connectionInfo = connectionInfo;
 }
예제 #7
0
 public KuduZipDeploy(KuduConnectionInfo connectionInfo, TaskLoggingHelper logger)
     : base(connectionInfo, logger)
 {
     _logger = logger;
 }