Exemple #1
0
        // try acquire lock and then execute the operation
        // return true if lock acquired and operation executed
        public static bool TryLockOperation(this IOperationLock lockObj,
                                            Action operation,
                                            TimeSpan timeout)
        {
            var elapsed = TimeSpan.Zero;

            while (!lockObj.Lock())
            {
                if (elapsed >= timeout)
                {
                    return(false);
                }

                Thread.Sleep(_sleepInterval);
                elapsed += _sleepInterval;
            }

            try
            {
                operation();
                return(true);
            }
            finally
            {
                lockObj.Release();
            }
        }
Exemple #2
0
        public static void RemoveAppOfflineIfLeft(IEnvironment environment, IOperationLock deploymentLock, ITracer tracer)
        {
            string appOfflineFile = null;

            try
            {
                appOfflineFile = Path.Combine(environment.WebRootPath, Constants.AppOfflineFileName);
                if (FileSystemHelpers.FileExists(appOfflineFile))
                {
                    var appOfflineContent = OperationManager.Attempt(() => FileSystemHelpers.ReadAllText(appOfflineFile));
                    if (appOfflineContent.Contains(Constants.AppOfflineKuduContent))
                    {
                        if (deploymentLock != null && deploymentLock.IsHeld)
                        {
                            tracer.Trace($"Deployment lock is held, will not remove {appOfflineFile}");
                        }
                        else
                        {
                            tracer.Trace($"Removing leftover {appOfflineFile}");
                            OperationManager.Attempt(() => FileSystemHelpers.DeleteFile(appOfflineFile));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                tracer.TraceError($"Error removing leftover {appOfflineFile} with {ex}");
            }
        }
Exemple #3
0
 public Tracer(IFileSystem fileSystem, string path, TraceLevel level, IOperationLock traceLock)
 {
     _fileSystem = fileSystem;
     _path = path;
     _level = level;
     _traceLock = traceLock;
 }
Exemple #4
0
 public Tracer(IFileSystem fileSystem, string path, TraceLevel level, IOperationLock traceLock)
 {
     _fileSystem = fileSystem;
     _path       = path;
     _level      = level;
     _traceLock  = traceLock;
 }
 public DeploymentStatusManager(IEnvironment environment,
                                IOperationLock statusLock)
 {
     _environment = environment;
     _statusLock  = statusLock;
     _activeFile  = Path.Combine(environment.DeploymentsPath, Constants.ActiveDeploymentFile);
 }
        public static DeploymentStatusFile Open(string id, IEnvironment environment, IAnalytics analytics, IOperationLock statusLock)
        {
            return statusLock.LockOperation(() =>
            {
                string path = Path.Combine(environment.DeploymentsPath, id, StatusFile);

                if (!FileSystemHelpers.FileExists(path))
                {
                    return null;
                }

                try
                {
                    XDocument document = null;
                    using (var stream = FileSystemHelpers.OpenRead(path))
                    {
                        document = XDocument.Load(stream);
                    }

                    return new DeploymentStatusFile(id, environment, statusLock, document);
                }
                catch (Exception ex)
                {
                    // in the scenario where w3wp is abruptly terminated while xml is being written,
                    // we may end up with corrupted xml.  we will handle the error and remove the problematic directory.
                    analytics.UnexpectedException(ex);

                    FileSystemHelpers.DeleteDirectorySafe(Path.GetDirectoryName(path), ignoreErrors: true);

                    // it is ok to return null as callers already handle null.
                    return null;
                }
            }, DeploymentStatusManager.LockTimeout);
        }
 public SettingsController(
     IDeploymentSettingsManager settingsManager,
     IDictionary <string, IOperationLock> namedLocks)
 {
     _settingsManager = settingsManager;
     _deploymentLock  = namedLocks["deployment"];
 }
Exemple #8
0
        public FetchHandler(ITracer tracer,
                            IDeploymentManager deploymentManager,
                            IDeploymentSettingsManager settings,
                            IDeploymentStatusManager status,
                            IOperationLock deploymentLock,
                            IEnvironment environment,
                            IEnumerable <IServiceHookHandler> serviceHookHandlers,
                            IRepositoryFactory repositoryFactory,
                            IFileSystem fileSystem)
        {
            _tracer              = tracer;
            _deploymentLock      = deploymentLock;
            _deploymentManager   = deploymentManager;
            _settings            = settings;
            _status              = status;
            _serviceHookHandlers = serviceHookHandlers;
            _repositoryFactory   = repositoryFactory;
            _fileSystem          = fileSystem;
            _markerFilePath      = Path.Combine(environment.DeploymentsPath, "pending");

            // Prefer marker creation in ctor to delay create when needed.
            // This is to keep the code simple and avoid creation synchronization.
            if (!_fileSystem.File.Exists(_markerFilePath))
            {
                try
                {
                    _fileSystem.File.WriteAllText(_markerFilePath, String.Empty);
                }
                catch (Exception ex)
                {
                    tracer.TraceError(ex);
                }
            }
        }
Exemple #9
0
 public SSHKeyController(ITracer tracer, ISSHKeyManager sshKeyManager, IFileSystem fileSystem, IOperationLock sshKeyLock)
 {
     _tracer        = tracer;
     _sshKeyManager = sshKeyManager;
     _fileSystem    = fileSystem;
     _sshKeyLock    = sshKeyLock;
 }
        private DeploymentStatusFile(string id, IEnvironment environment, IOperationLock statusLock, XDocument document = null)
        {
            _activeFile = Path.Combine(environment.DeploymentsPath, Constants.ActiveDeploymentFile);
            _statusFile = Path.Combine(environment.DeploymentsPath, id, StatusFile);
            _statusLock = statusLock;

            Id = id;

            SiteName = GetSiteName(environment);
            HostName = System.Environment.GetEnvironmentVariable("HTTP_HOST");

            if (document != null)
            {
                Initialize(document);
            }

            // Ensure that the status file is created before we enter this code block
            Task ensureLogFileExists = Task.Run(() =>
                                                OperationManager.Attempt(() =>
            {
                if (!FileSystemHelpers.FileExists(_statusFile))
                {
                    throw new FileNotFoundException("Status file doesn't exist. Will wait for 1 second and retry");
                }
            }, 2, 250));
        }
 public GitServerHttpHandler(ITracer tracer, IGitServer gitServer, IOperationLock deploymentLock, IDeploymentManager deploymentManager)
 {
     _gitServer         = gitServer;
     _tracer            = tracer;
     _deploymentLock    = deploymentLock;
     _deploymentManager = deploymentManager;
 }
Exemple #12
0
        public FetchDeploymentManager(
            IDeploymentSettingsManager settings,
            IEnvironment environment,
            ITracer tracer,
            IOperationLock deploymentLock,
            IDeploymentManager deploymentManager,
            IDeploymentStatusManager status)
        {
            _settings          = settings;
            _environment       = environment;
            _tracer            = tracer;
            _deploymentLock    = deploymentLock;
            _deploymentManager = deploymentManager;
            _status            = status;

            _markerFilePath = Path.Combine(environment.DeploymentsPath, "pending");

            // Prefer marker creation in ctor to delay create when needed.
            // This is to keep the code simple and avoid creation synchronization.
            if (!FileSystemHelpers.FileExists(_markerFilePath))
            {
                try
                {
                    FileSystemHelpers.WriteAllText(_markerFilePath, String.Empty);
                }
                catch (Exception ex)
                {
                    tracer.TraceError(ex);
                }
            }
        }
Exemple #13
0
 public UploadPackHandler(ITracer tracer,
                          IGitServer gitServer,
                          IOperationLock deploymentLock,
                          IDeploymentManager deploymentManager)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
 }
Exemple #14
0
        public static async Task <bool> TryLockOperationAsync(this IOperationLock lockObj,
                                                              Func <Task> operation,
                                                              TimeSpan timeout)
        {
            var interval = TimeSpan.FromMilliseconds(250);
            var elapsed  = TimeSpan.Zero;

            while (!lockObj.Lock())
            {
                if (elapsed >= timeout)
                {
                    return(false);
                }

                await Task.Delay(_sleepInterval);

                elapsed += _sleepInterval;
            }

            try
            {
                await operation();

                return(true);
            }
            finally
            {
                lockObj.Release();
            }
        }
Exemple #15
0
 public ReceivePackHandler(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock,
                           IDeploymentManager deploymentManager,
                           IDeploymentSettingsManager settings)
     : base(tracer, gitServer, deploymentLock, deploymentManager, settings)
 {
 }
Exemple #16
0
 public RpcService(ITracer tracer,
                   IGitServer gitServer,
                   IOperationLock deploymentLock)
 {
     _gitServer      = gitServer;
     _tracer         = tracer;
     _deploymentLock = deploymentLock;
 }
 public LiveScmEditorController(ITracer tracer,
                                IDeploymentManager deploymentManager,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepository repository)
     : this(tracer, deploymentManager, operationLock, environment, repository, new FileSystem())
 {
 }
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IOperationLock deploymentLock)
 {
     _tracer = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock = deploymentLock;
 }
Exemple #19
0
 public RpcController(ITracer tracer,
                   IGitServer gitServer,
                   IOperationLock deploymentLock)
 {
     _gitServer = gitServer;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
 }
Exemple #20
0
 public ReceivePackService(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock)
 {
     _gitServer = gitServer;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
 }
Exemple #21
0
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IOperationLock deploymentLock)
 {
     _tracer            = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock    = deploymentLock;
 }
Exemple #22
0
        public WebHooksManager(ITracer tracer, IEnvironment environment, IOperationLock hooksLock)
        {
            _tracer      = tracer;
            _environment = environment;
            _hooksLock   = hooksLock;

            _hooksFilePath = Path.Combine(_environment.DeploymentsPath, HooksFileName);
        }
Exemple #23
0
 public DeploymentService(ITracer tracer,
                          IDeploymentManager deploymentManager,
                          IOperationLock deploymentLock)
 {
     _tracer            = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock    = deploymentLock;
 }
Exemple #24
0
 public DeploymentService(ITracer tracer, 
                          IDeploymentManager deploymentManager, 
                          IOperationLock deploymentLock)
 {
     _tracer = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock = deploymentLock;
 }
 public LiveScmEditorController(ITracer tracer,
                                IDeploymentManager deploymentManager,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepository repository) 
     : this(tracer, deploymentManager, operationLock, environment, repository, new FileSystem())
 {
 }
Exemple #26
0
        // acquire lock and then execute the operation
        public static void LockOperation(this IOperationLock lockObj, Action operation, TimeSpan timeout)
        {
            bool success = lockObj.TryLockOperation(operation, timeout);

            if (!success)
            {
                throw new InvalidOperationException("Unable to acquire lock within a given time.");
            }
        }
Exemple #27
0
        // acquire lock and then execute the operation
        public static void LockOperation(this IOperationLock lockObj, Action operation, TimeSpan timeout)
        {
            bool success = lockObj.TryLockOperation(operation, timeout);

            if (!success)
            {
                throw new LockOperationException(String.Format(CultureInfo.CurrentCulture, Resources.Error_OperationLockTimeout, timeout.TotalSeconds));
            }
        }
Exemple #28
0
 public GitExeServer(string path, IOperationLock initLock, ITraceFactory traceFactory)
 {
     _gitExe = new GitExecutable(path);
     _gitExe.SetTraceLevel(2);
     _traceFactory = traceFactory;
     _repository = new GitExeRepository(path, traceFactory);
     _repository.SetTraceLevel(2);
     _initLock = initLock;
 }
 public ReceivePackHandler(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock,
                           IDeploymentManager deploymentManager,
                           IRepositoryFactory repositoryFactory)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
     _repositoryFactory = repositoryFactory;
 }
Exemple #30
0
 public ReceivePackHandler(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock,
                           IDeploymentManager deploymentManager,
                           IRepositoryFactory repositoryFactory)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
     _repositoryFactory = repositoryFactory;
 }
 public DeploymentStatusManager(IEnvironment environment,
                                IFileSystem fileSystem,
                                IOperationLock statusLock)
 {
     _environment = environment;
     _fileSystem = fileSystem;
     _statusLock = statusLock;
     _activeFile = Path.Combine(environment.DeploymentCachePath, Constants.ActiveDeploymentFile);
 }
 public DeploymentStatusManager(IEnvironment environment,
                                IAnalytics analytics,
                                IOperationLock statusLock)
 {
     _environment = environment;
     _analytics = analytics;
     _statusLock = statusLock;
     _activeFile = Path.Combine(environment.DeploymentsPath, Constants.ActiveDeploymentFile);
 }
Exemple #33
0
 public static void LockHttpOperation(this IOperationLock lockObj, Action action)
 {
     lockObj.LockOperation(action, () =>
     {
         var response     = new HttpResponseMessage(HttpStatusCode.Conflict);
         response.Content = new StringContent(Resources.Error_DeploymentInProgess);
         throw new HttpResponseException(response);
     });
 }
Exemple #34
0
 public RpcService(ITracer tracer,
                   IGitServer gitServer,
                   IDeploymentManagerFactory deploymentManagerFactory,
                   IOperationLock deploymentLock)
 {
     _gitServer = gitServer;
     _deploymentManagerFactory = deploymentManagerFactory;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
 }
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IOperationLock deploymentLock,
                             RepositoryFactory repositoryFactory)
 {
     _tracer = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock = deploymentLock;
     _repositoryFactory = repositoryFactory;
 }
 protected GitServerHttpHandler(ITracer tracer, 
                             IGitServer gitServer, 
                             IOperationLock deploymentLock, 
                             IDeploymentManager deploymentManager)
 {
     GitServer = gitServer;
     Tracer = tracer;
     DeploymentLock = deploymentLock;
     DeploymentManager = deploymentManager;
 }
 protected GitServerHttpHandler(ITracer tracer,
                                IGitServer gitServer,
                                IOperationLock deploymentLock,
                                IDeploymentManager deploymentManager)
 {
     GitServer         = gitServer;
     Tracer            = tracer;
     DeploymentLock    = deploymentLock;
     DeploymentManager = deploymentManager;
 }
 public LiveScmEditorController(ITracer tracer,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepository repository)
     : base(tracer, environment, environment.RepositoryPath)
 {
     _operationLock = operationLock;
     _repository = repository;
     _currentEtag = GetCurrentEtag();
 }
Exemple #39
0
        // acquire lock and then execute the operation
        public static void LockOperation(this IOperationLock lockObj, Action operation, string operationName, TimeSpan timeout)
        {
            bool success = lockObj.TryLockOperation(operation, operationName, timeout);

            if (!success)
            {
                var lockInfo = lockObj.LockInfo;
                throw new LockOperationException(String.Format(CultureInfo.CurrentCulture, Resources.Error_OperationLockTimeout, operationName, lockInfo.OperationName, lockInfo.AcquiredDateTime));
            }
        }
Exemple #40
0
        public static async Task LockHttpOperationAsync(this IOperationLock lockObj, Func <Task> action)
        {
            bool acquired = await lockObj.TryLockOperationAsync(action, TimeSpan.Zero);

            if (!acquired)
            {
                var response = new HttpResponseMessage(HttpStatusCode.Conflict);
                response.Content = new StringContent(Resources.Error_DeploymentInProgess);
                throw new HttpResponseException(response);
            }
        }
Exemple #41
0
 public static T LockOperationIfNeccessary <T>(this IOperationLock lockObj, Func <T> operation, string operationName, TimeSpan timeout)
 {
     try
     {
         return(operation());
     }
     catch (Exception)
     {
         return(lockObj.LockOperation(operation, operationName, timeout));
     }
 }
 public LiveScmEditorController(ITracer tracer,
                                IDeploymentManager deploymentManager,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepositoryFactory repositoryFactory)
     : base(tracer, environment, environment.RepositoryPath)
 {
     _deploymentManager = deploymentManager;
     _operationLock = operationLock;
     _repository = repositoryFactory.GetGitRepository();
 }
Exemple #43
0
 public LockFile(string path, ITraceFactory traceFactory, bool ensureLock = false)
 {
     if (!OSDetector.IsOnWindows())
     {
         _lock = new LinuxLockFile(path, traceFactory, ensureLock);
     }
     else
     {
         _lock = new WindowsLockFile(path, traceFactory, ensureLock);
     }
 }
Exemple #44
0
 public LiveScmEditorController(ITracer tracer,
                                IDeploymentManager deploymentManager,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepositoryFactory repositoryFactory)
     : base(tracer, environment, environment.RepositoryPath)
 {
     _deploymentManager = deploymentManager;
     _operationLock     = operationLock;
     _repository        = repositoryFactory.GetGitRepository();
 }
Exemple #45
0
 public LockFile(string path)
 {
     if (!OSDetector.IsOnWindows())
     {
         _lock = new LinuxLockFile(path);
     }
     else
     {
         _lock = new WindowsLockFile(path);
     }
 }
Exemple #46
0
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IDeploymentStatusManager status,
                             IOperationLock deploymentLock,
                             IRepositoryFactory repositoryFactory)
 {
     _tracer            = tracer;
     _deploymentManager = deploymentManager;
     _status            = status;
     _deploymentLock    = deploymentLock;
     _repositoryFactory = repositoryFactory;
 }
Exemple #47
0
 public FetchHandler(ITracer tracer,
                     IGitServer gitServer,
                     IDeploymentManager deploymentManager,
                     IOperationLock deploymentLock,
                     RepositoryConfiguration configuration)
 {
     _gitServer = gitServer;
     _deploymentManager = deploymentManager;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _configuration = configuration;
 }
 public LiveScmEditorController(ITracer tracer,
                                IDeploymentManager deploymentManager,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepository repository,
                                IFileSystem fileSystem)
     : base(tracer, environment, fileSystem, environment.RepositoryPath)
 {
     _deploymentManager = deploymentManager;
     _operationLock = operationLock;
     _repository = repository;
 }
 public LiveScmController(ITracer tracer,
                          IOperationLock deploymentLock,
                          IEnvironment environment,
                          IRepository repository,
                          IServerConfiguration serverConfiguration)
 {
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _environment = environment;
     _repository = repository;
     _serverConfiguration = serverConfiguration;
 }
Exemple #50
0
 public LiveScmController(ITracer tracer,
                          IOperationLock deploymentLock,
                          IEnvironment environment,
                          IServerRepository repository,
                          IServerConfiguration serverConfiguration)
 {
     _tracer              = tracer;
     _deploymentLock      = deploymentLock;
     _environment         = environment;
     _repository          = repository;
     _serverConfiguration = serverConfiguration;
 }
Exemple #51
0
        public GitExeServer(string path, IOperationLock initLock, IDeploymentCommandGenerator deploymentCommandGenerator, ITraceFactory traceFactory)
        {
            _gitExe = new GitExecutable(path);
            _gitExe.SetTraceLevel(2);
            _traceFactory = traceFactory;
            _repository = new GitExeRepository(path, traceFactory);
            _repository.SetTraceLevel(2);
            _initLock = initLock;
            _deploymentCommandGenerator = deploymentCommandGenerator;

            // Setup the deployment environment variable to be used by the post receive hook
            _gitExe.EnvironmentVariables[_deploymentCommandGenerator.DeploymentEnvironmentVariable] = _deploymentCommandGenerator.GetDeploymentExePath();
        }
Exemple #52
0
        public GitExeServer(string path, IOperationLock initLock, IDeploymentEnvironment deploymentEnvironment, ITraceFactory traceFactory)
        {
            _gitExe = new GitExecutable(path);
            _traceFactory = traceFactory;
            _repository = new GitExeRepository(path, traceFactory);
            _initLock = initLock;

            // Setup the deployment environment variable to be used by the post receive hook
            _gitExe.EnvironmentVariables[KnownEnviornment.EXEPATH] = deploymentEnvironment.ExePath;
            _gitExe.EnvironmentVariables[KnownEnviornment.APPPATH] = deploymentEnvironment.ApplicationPath;
            _gitExe.EnvironmentVariables[KnownEnviornment.MSBUILD] = deploymentEnvironment.MSBuildExtensionsPath;
            _gitExe.EnvironmentVariables[KnownEnviornment.DEPLOYER] = "";
        }
Exemple #53
0
 public FetchHandler(ITracer tracer,
                     IGitServer gitServer,
                     IDeploymentManager deploymentManager,
                     IDeploymentSettingsManager settings,
                     IOperationLock deploymentLock,
                     RepositoryConfiguration configuration,
                     IEnvironment environment)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
     _settings = settings;
     _configuration = configuration;
     _environment = environment;
 }
Exemple #54
0
        public static DeploymentStatusFile Create(string id, IFileSystem fileSystem, IEnvironment environment, IOperationLock statusLock)
        {
            string path = Path.Combine(environment.DeploymentsPath, id);

            FileSystemHelpers.EnsureDirectory(fileSystem, path);

            DateTime utcNow = DateTime.UtcNow;
            return new DeploymentStatusFile(id, environment, fileSystem, statusLock)
            {
                StartTime = utcNow,
                ReceivedTime = utcNow
            };
        }
Exemple #55
0
        private DeploymentStatusFile(string id, IEnvironment environment, IFileSystem fileSystem, IOperationLock statusLock, XDocument document = null)
        {
            _activeFile = Path.Combine(environment.DeploymentCachePath, Constants.ActiveDeploymentFile);
            _statusFile = Path.Combine(environment.DeploymentCachePath, id, StatusFile);
            _fileSystem = fileSystem;
            _statusLock = statusLock;

            Id = id;

            if (document != null)
            {
                Initialize(document);
            }
        }
 public GitServerHttpHandler(ITracer tracer, IGitServer gitServer, IOperationLock deploymentLock, IDeploymentManager deploymentManager)
 {
     _gitServer = gitServer;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _deploymentManager = deploymentManager;
 }
Exemple #57
-1
 public SSHKeyController(ITracer tracer, ISSHKeyManager sshKeyManager, IFileSystem fileSystem, IOperationLock sshKeyLock)
 {
     _tracer = tracer;
     _sshKeyManager = sshKeyManager;
     _fileSystem = fileSystem;
     _sshKeyLock = sshKeyLock;
 }
Exemple #58
-1
        public FetchHandler(ITracer tracer,
                            IDeploymentManager deploymentManager,
                            IDeploymentSettingsManager settings,
                            IDeploymentStatusManager status,
                            IOperationLock deploymentLock,
                            IEnvironment environment,
                            IEnumerable<IServiceHookHandler> serviceHookHandlers,
                            IRepositoryFactory repositoryFactory,
                            IAutoSwapHandler autoSwapHandler)
        {
            _tracer = tracer;
            _deploymentLock = deploymentLock;
            _environment = environment;
            _deploymentManager = deploymentManager;
            _settings = settings;
            _status = status;
            _serviceHookHandlers = serviceHookHandlers;
            _repositoryFactory = repositoryFactory;
            _autoSwapHandler = autoSwapHandler;
            _markerFilePath = Path.Combine(environment.DeploymentsPath, "pending");

            // Prefer marker creation in ctor to delay create when needed.
            // This is to keep the code simple and avoid creation synchronization.
            if (!FileSystemHelpers.FileExists(_markerFilePath))
            {
                try
                {
                    FileSystemHelpers.WriteAllText(_markerFilePath, String.Empty);
                }
                catch (Exception ex)
                {
                    tracer.TraceError(ex);
                }
            }
        }
Exemple #59
-1
 public UploadPackHandler(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock,
                           IDeploymentManager deploymentManager)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
 }
Exemple #60
-1
        public WebHooksManager(ITracer tracer, IEnvironment environment, IOperationLock hooksLock)
        {
            _tracer = tracer;
            _environment = environment;
            _hooksLock = hooksLock;

            _hooksFilePath = Path.Combine(_environment.DeploymentsPath, HooksFileName);
        }