Beispiel #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();
            }
        }
Beispiel #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}");
            }
        }
Beispiel #3
0
 public Tracer(IFileSystem fileSystem, string path, TraceLevel level, IOperationLock traceLock)
 {
     _fileSystem = fileSystem;
     _path = path;
     _level = level;
     _traceLock = traceLock;
 }
Beispiel #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"];
 }
Beispiel #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);
                }
            }
        }
Beispiel #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));
        }
Beispiel #11
0
 public GitServerHttpHandler(ITracer tracer, IGitServer gitServer, IOperationLock deploymentLock, IDeploymentManager deploymentManager)
 {
     _gitServer         = gitServer;
     _tracer            = tracer;
     _deploymentLock    = deploymentLock;
     _deploymentManager = deploymentManager;
 }
Beispiel #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);
                }
            }
        }
Beispiel #13
0
 public UploadPackHandler(ITracer tracer,
                          IGitServer gitServer,
                          IOperationLock deploymentLock,
                          IDeploymentManager deploymentManager)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
 }
Beispiel #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();
            }
        }
Beispiel #15
0
 public ReceivePackHandler(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock,
                           IDeploymentManager deploymentManager,
                           IDeploymentSettingsManager settings)
     : base(tracer, gitServer, deploymentLock, deploymentManager, settings)
 {
 }
Beispiel #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())
 {
 }
Beispiel #18
0
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IOperationLock deploymentLock)
 {
     _tracer = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock = deploymentLock;
 }
Beispiel #19
0
 public RpcController(ITracer tracer,
                   IGitServer gitServer,
                   IOperationLock deploymentLock)
 {
     _gitServer = gitServer;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
 }
Beispiel #20
0
 public ReceivePackService(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock)
 {
     _gitServer = gitServer;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
 }
Beispiel #21
0
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IOperationLock deploymentLock)
 {
     _tracer            = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock    = deploymentLock;
 }
Beispiel #22
0
        public WebHooksManager(ITracer tracer, IEnvironment environment, IOperationLock hooksLock)
        {
            _tracer      = tracer;
            _environment = environment;
            _hooksLock   = hooksLock;

            _hooksFilePath = Path.Combine(_environment.DeploymentsPath, HooksFileName);
        }
Beispiel #23
0
 public DeploymentService(ITracer tracer,
                          IDeploymentManager deploymentManager,
                          IOperationLock deploymentLock)
 {
     _tracer            = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock    = deploymentLock;
 }
Beispiel #24
0
 public DeploymentService(ITracer tracer, 
                          IDeploymentManager deploymentManager, 
                          IOperationLock deploymentLock)
 {
     _tracer = tracer;
     _deploymentManager = deploymentManager;
     _deploymentLock = deploymentLock;
 }
Beispiel #25
0
 public LiveScmEditorController(ITracer tracer,
                                IDeploymentManager deploymentManager,
                                IOperationLock operationLock,
                                IEnvironment environment,
                                IRepository repository) 
     : this(tracer, deploymentManager, operationLock, environment, repository, new FileSystem())
 {
 }
Beispiel #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.");
            }
        }
Beispiel #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));
            }
        }
Beispiel #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;
 }
Beispiel #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);
 }
Beispiel #32
0
 public DeploymentStatusManager(IEnvironment environment,
                                IAnalytics analytics,
                                IOperationLock statusLock)
 {
     _environment = environment;
     _analytics = analytics;
     _statusLock = statusLock;
     _activeFile = Path.Combine(environment.DeploymentsPath, Constants.ActiveDeploymentFile);
 }
Beispiel #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);
     });
 }
Beispiel #34
0
 public RpcService(ITracer tracer,
                   IGitServer gitServer,
                   IDeploymentManagerFactory deploymentManagerFactory,
                   IOperationLock deploymentLock)
 {
     _gitServer = gitServer;
     _deploymentManagerFactory = deploymentManagerFactory;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
 }
Beispiel #35
0
 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();
 }
Beispiel #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));
            }
        }
Beispiel #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);
            }
        }
Beispiel #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();
 }
Beispiel #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);
     }
 }
Beispiel #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();
 }
Beispiel #45
0
 public LockFile(string path)
 {
     if (!OSDetector.IsOnWindows())
     {
         _lock = new LinuxLockFile(path);
     }
     else
     {
         _lock = new WindowsLockFile(path);
     }
 }
Beispiel #46
0
 public DeploymentController(ITracer tracer,
                             IDeploymentManager deploymentManager,
                             IDeploymentStatusManager status,
                             IOperationLock deploymentLock,
                             IRepositoryFactory repositoryFactory)
 {
     _tracer            = tracer;
     _deploymentManager = deploymentManager;
     _status            = status;
     _deploymentLock    = deploymentLock;
     _repositoryFactory = repositoryFactory;
 }
Beispiel #47
0
 public FetchHandler(ITracer tracer,
                     IGitServer gitServer,
                     IDeploymentManager deploymentManager,
                     IOperationLock deploymentLock,
                     RepositoryConfiguration configuration)
 {
     _gitServer = gitServer;
     _deploymentManager = deploymentManager;
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _configuration = configuration;
 }
Beispiel #48
0
 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;
 }
Beispiel #49
0
 public LiveScmController(ITracer tracer,
                          IOperationLock deploymentLock,
                          IEnvironment environment,
                          IRepository repository,
                          IServerConfiguration serverConfiguration)
 {
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _environment = environment;
     _repository = repository;
     _serverConfiguration = serverConfiguration;
 }
Beispiel #50
0
 public LiveScmController(ITracer tracer,
                          IOperationLock deploymentLock,
                          IEnvironment environment,
                          IServerRepository repository,
                          IServerConfiguration serverConfiguration)
 {
     _tracer              = tracer;
     _deploymentLock      = deploymentLock;
     _environment         = environment;
     _repository          = repository;
     _serverConfiguration = serverConfiguration;
 }
Beispiel #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();
        }
Beispiel #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] = "";
        }
Beispiel #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;
 }
Beispiel #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
            };
        }
Beispiel #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;
 }
Beispiel #57
-1
 public SSHKeyController(ITracer tracer, ISSHKeyManager sshKeyManager, IFileSystem fileSystem, IOperationLock sshKeyLock)
 {
     _tracer = tracer;
     _sshKeyManager = sshKeyManager;
     _fileSystem = fileSystem;
     _sshKeyLock = sshKeyLock;
 }
Beispiel #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);
                }
            }
        }
Beispiel #59
-1
 public UploadPackHandler(ITracer tracer,
                           IGitServer gitServer,
                           IOperationLock deploymentLock,
                           IDeploymentManager deploymentManager)
     : base(tracer, gitServer, deploymentLock, deploymentManager)
 {
 }
Beispiel #60
-1
        public WebHooksManager(ITracer tracer, IEnvironment environment, IOperationLock hooksLock)
        {
            _tracer = tracer;
            _environment = environment;
            _hooksLock = hooksLock;

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