示例#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;
 }