示例#1
0
        protected override void ExecuteTask()
        {
            Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
            _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl);

            _cruiseManager.Start(this.ProjectName);
        }
示例#2
0
        protected override void ExecuteTask()
        {
            Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
            _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl);

            _cruiseManager.Start(this.ProjectName);
        }
示例#3
0
        public bool ForceBuild(IProjectSpecifier projectSpecifier)
        {
            bool           clientInfoRequired = false;
            ArrayList      clientInfoList     = new ArrayList();
            ICruiseManager manager            = GetCruiseManager(projectSpecifier.ServerSpecifier);

            IForceFilter[] forceFilters = this.GetProject(manager, projectSpecifier.ProjectName).ForceFilters;

            if (forceFilters != null && forceFilters.Length != 0)
            {
                foreach (IForceFilter forceFilter in forceFilters)
                {
                    if (forceFilter.RequiresClientInformation)
                    {
                        clientInfoRequired = true;
                        ForceFilterClientInfo info = forceFilter.GetClientInfo();
                        clientInfoList.Add(info);
                    }
                }
            }
            if (clientInfoRequired)
            {
                ForceFilterClientInfo[] clientInfo;
                clientInfo = (ForceFilterClientInfo[])clientInfoList.ToArray(typeof(ForceFilterClientInfo));
                return(manager.ForceBuild(projectSpecifier.ProjectName, clientInfo));
            }
            else
            {
                return(manager.ForceBuild(projectSpecifier.ProjectName));
            }
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CruiseServer" /> class.	
        /// </summary>
        /// <param name="configurationService">The configuration service.</param>
        /// <param name="projectIntegratorListFactory">The project integrator list factory.</param>
        /// <param name="projectSerializer">The project serializer.</param>
        /// <param name="stateManager">The state manager.</param>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="executionEnvironment">The execution environment.</param>
        /// <param name="extensionList">The extension list.</param>
        /// <remarks></remarks>
        public CruiseServer(IConfigurationService configurationService,
                            IProjectIntegratorListFactory projectIntegratorListFactory,
                            IProjectSerializer projectSerializer,
                            IProjectStateManager stateManager,
                            IFileSystem fileSystem,
                            IExecutionEnvironment executionEnvironment,
                            List<ExtensionConfiguration> extensionList)
        {
            this.configurationService = configurationService;
            this.projectSerializer = projectSerializer;
            this.fileSystem = fileSystem;
            this.executionEnvironment = executionEnvironment;

            // Leave the manager for backwards compatability - it is marked as obsolete
#pragma warning disable 0618
            manager = new CruiseManager(this);
#pragma warning restore 0618
            serverClient = new CruiseServerClient(this);
            InitializeServerThread();

            // Initialise the configuration
            configuration = configurationService.Load();

            // Initialise the queue manager
            integrationQueueManager = IntegrationQueueManagerFactory.CreateManager(projectIntegratorListFactory, configuration, stateManager);
            integrationQueueManager.AssociateIntegrationEvents(OnIntegrationStarted, OnIntegrationCompleted);
            securityManager = configuration.SecurityManager;

            // Load the extensions
            if (extensionList != null)
            {
                InitialiseExtensions(extensionList);
            }

            this.configurationService.AddConfigurationUpdateHandler(Restart);
            programmDataFolder = this.executionEnvironment.GetDefaultProgramDataFolder(ApplicationType.Server);

            // Initialise the cache time
            var cacheTimeInConfig = ConfigurationManager.AppSettings["cacheTime"];
            if (string.IsNullOrEmpty(cacheTimeInConfig))
            {
                // Set the default cache time to five minutes
                this.cacheTime = new TimeSpan(0, 5, 0);
                Log.Info("Log cache time set to 5 minutes");
            }
            else
            {
                this.cacheTime = TimeSpan.FromSeconds(Convert.ToDouble(cacheTimeInConfig, CultureInfo.CurrentCulture));
                if (this.cacheTime.TotalSeconds < 5)
                {
                    // If the cache time is less then 5s then turn off caching
                    this.cacheTime = TimeSpan.MinValue;
                    Log.Info("Log cache has been turned off");
                }
                else
                {
                    Log.Info("Log cache time set to " + this.cacheTime.TotalSeconds.ToString(CultureInfo.CurrentCulture) + " seconds");
                }
            }
        }
示例#5
0
        private void RetrieveListOfProjects(Project server)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                lbProject.Items.Clear();

                RemoteCruiseManagerFactory factory         = new RemoteCruiseManagerFactory();
                ICruiseManager             manager         = factory.GetCruiseManager(server.ServerUrl);
                ProjectStatus[]            projectStatuses = manager.GetProjectStatus();

                foreach (ProjectStatus status in projectStatuses)
                {
                    lbProject.Items.Add(status.Name);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Unable to connect to server " + server.ServerDisplayName + ": " + ex.Message, "Error");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
示例#6
0
        private ProjectStatus GetCurrentProjectStatus()
        {
            Log.Debug("Retrieving ProjectStatus from server: " + ServerUri);
            ProjectStatus[] currentStatuses = null;
            try
            {
                ICruiseManager cruiseManager = (ICruiseManager)remoteService.Connect(typeof(ICruiseManager), ServerUri);
                currentStatuses = cruiseManager.GetProjectStatus();
            }
            catch (Exception ex)
            {
                Log.Debug("Error connecting to server: " + ServerUri);
                Log.Debug(ex.ToString());
                throw;
            }

            foreach (ProjectStatus currentStatus in currentStatuses)
            {
                if (currentStatus.Name == Project)
                {
                    return(currentStatus);
                }
            }
            Log.Error(String.Format("The project {0} does not exist to be triggered from...", Project));
            throw new NoSuchProjectException(Project);
        }
示例#7
0
        public void SetupAndTeardownRemotingInfrastructure()
        {
            string configFile = CreateTemporaryConfigurationFile();

            IMock mockCruiseManager = new RemotingMock(typeof(ICruiseManager));
            IMock mockCruiseServer  = new DynamicMock(typeof(ICruiseServer));

            mockCruiseServer.ExpectAndReturn("CruiseManager", mockCruiseManager.MockInstance);
            mockCruiseServer.ExpectAndReturn("CruiseManager", mockCruiseManager.MockInstance);
            mockCruiseServer.Expect("Dispose");

            using (new RemoteCruiseServer((ICruiseServer)mockCruiseServer.MockInstance, configFile))
            {
                Assert.AreEqual(2, ChannelServices.RegisteredChannels.Length);
                Assert.IsNotNull(ChannelServices.GetChannel("ccnet"), "ccnet channel is missing");
                Assert.IsNotNull(ChannelServices.GetChannel("ccnet2"), "ccnet2 channel is missing");

                ICruiseManager remoteManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), "tcp://localhost:35354/" + RemoteCruiseServer.ManagerUri);
                Assert.IsNotNull(remoteManager, "cruiseserver should be registered on tcp channel");

                remoteManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), "http://localhost:35355/" + RemoteCruiseServer.ManagerUri);
                Assert.IsNotNull(remoteManager, "cruiseserver should be registered on http channel");
            }
            Assert.AreEqual(0, ChannelServices.RegisteredChannels.Length, "all registered channels should be closed.");
            mockCruiseServer.Verify();
            mockCruiseManager.Verify();
        }
 /// <summary>
 /// Initialises a new <see cref="CruiseServerRemotingClient"/>.
 /// </summary>
 /// <param name="serverAddress">The address of the server.</param>
 public CruiseServerRemotingClient(string serverAddress)
 {
     UriBuilder builder = new UriBuilder(serverAddress);
     if (builder.Port == -1) builder.Port = 21234;
     var uri = new Uri(builder.Uri, "/CruiseManager.rem");
     this.serverUri = uri.AbsoluteUri;
     this.manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUri);
 }
		protected override void ExecuteTask()
		{
			Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
			_cruiseManager = (ICruiseManager) RemotingServices.Connect(typeof (ICruiseManager), ServerUrl);

			IntegrationStatus status = LaunchBuild(_cruiseManager, ProjectName, PollingInterval, TimeOut);
			if (status != IntegrationStatus.Success)
				throw new BuildException(string.Format("Project '{0}' failed : {1}", ProjectName, status));
		}
		/// <summary>
		/// Return the current status of the project. Return null if the project does not exist.
		/// </summary>
		private ProjectStatus GetCurrentProjectStatus(ICruiseManager cruiseManager, string name)
		{
			ProjectStatus[] allStatus = cruiseManager.GetProjectStatus();
			foreach (ProjectStatus status in allStatus)
			{
				if (status.Name == name)
					return status;
			}
			return null;
		}
        public void Run(IIntegrationResult result)
        {
            if (IntegrationStatus != result.Status)
            {
                return;
            }

            ICruiseManager manager = (ICruiseManager)remotingService.Connect(typeof(ICruiseManager), ServerUri);

            manager.ForceBuild(Project);
        }
        public void ReadCCNetStatisticsTest()
        {
            RemoteCruiseManagerFactory factory = new RemoteCruiseManagerFactory();
            Uri            url         = new Uri(string.Format(CultureInfo.InvariantCulture, "tcp://firefly:21234/CruiseManager.rem"));
            string         projectName = "ProjectPilot";
            ICruiseManager mgr         = factory.GetCruiseManager(url.ToString());

            string proj = mgr.GetProject(projectName);
            string stat = mgr.GetStatisticsDocument(projectName);
            //File.WriteAllText("ccnet.stats.xml", stat);
        }
示例#13
0
        static int DoWork(Options options)
        {
            string auxPath  = options.AuxPath;
            string forcer   = options.Forcer;
            string taskname = options.TaskName;

            RemoteCruiseManagerFactory f = new RemoteCruiseManagerFactory();
            ICruiseManager             m = f.GetCruiseManager(auxPath);

            m.ForceBuild(taskname, forcer);
            return(0);
        }
 /// <summary>
 /// Return the current status of the project. Return null if the project does not exist.
 /// </summary>
 private ProjectStatus GetCurrentProjectStatus(ICruiseManager cruiseManager, string name)
 {
     ProjectStatus[] allStatus = cruiseManager.GetProjectStatus();
     foreach (ProjectStatus status in allStatus)
     {
         if (status.Name == name)
         {
             return(status);
         }
     }
     return(null);
 }
        protected override void ExecuteTask()
        {
            Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
            _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl);

            IntegrationStatus status = LaunchBuild(_cruiseManager, ProjectName, PollingInterval, TimeOut);

            if (status != IntegrationStatus.Success)
            {
                throw new BuildException(string.Format("Project '{0}' failed : {1}", ProjectName, status));
            }
        }
示例#16
0
 public string TryGetProjectState(string serverUrl, string projectName)
 {
     try
     {
         ICruiseManager Manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUrl);
         return(Manager.GetProjectStatus(projectName).Status.ToString());
     }
     catch (Exception ex)
     {
         return(string.Empty);
     }
 }
示例#17
0
        protected override void ExecuteTask()
        {
            Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
            _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl);

            if (this.CCNetPlugins != null && this.CCNetPlugins.FileNames.Count > 0)
            {
                foreach (string AssemblyPath in this.CCNetPlugins.FileNames)
                {
                    if (!PluginAlreadyLoaded(AssemblyPath))
                    {
                        Assembly LoadedAssembly = Assembly.LoadFile(AssemblyPath);
                        Log(Level.Debug, "Loaded {0}", LoadedAssembly.Location);
                    }
                }
            }

            bool      clientInfoRequired = false;
            ArrayList clientInfoList     = new ArrayList();

            IForceFilter[] forceFilters = this.project.ForceFilters;

            if (forceFilters != null && forceFilters.Length != 0)
            {
                foreach (IForceFilter forceFilter in forceFilters)
                {
                    if (forceFilter.RequiresClientInformation)
                    {
                        clientInfoRequired = true;
                        ForceFilterClientInfo info = forceFilter.GetClientInfo();
                        clientInfoList.Add(info);
                    }
                }
            }
            bool SuccessfullyForced = false;

            if (clientInfoRequired)
            {
                ForceFilterClientInfo[] clientInfo;
                clientInfo         = (ForceFilterClientInfo[])clientInfoList.ToArray(typeof(ForceFilterClientInfo));
                SuccessfullyForced = _cruiseManager.ForceBuild(ProjectName, clientInfo);
            }
            else
            {
                SuccessfullyForced = _cruiseManager.ForceBuild(ProjectName);
            }
            if (!SuccessfullyForced)
            {
                throw new BuildException(string.Format("Unable to force build for {0} on {1}.", this.ProjectName, this.ServerUrl), this.Location);
            }
            Log(Level.Info, "Successfully forced CCNet project " + this.ProjectName);
        }
示例#18
0
 protected override void ExecuteTask()
 {
     Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
     _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl);
     if (!String.IsNullOrEmpty(this.ProjectName))
     {
         _cruiseManager.Stop(this.ProjectName);
     }
     else
     {
         _cruiseManager.Stop();
     }
 }
示例#19
0
        /// <summary>
        /// Initialises a new <see cref="CruiseServerRemotingClient"/>.
        /// </summary>
        /// <param name="serverAddress">The address of the server.</param>
        public CruiseServerRemotingClient(string serverAddress)
        {
            UriBuilder builder = new UriBuilder(serverAddress);

            if (builder.Port == -1)
            {
                builder.Port = 21234;
            }
            var uri = new Uri(builder.Uri, "/CruiseManager.rem");

            this.serverUri = uri.AbsoluteUri;
            this.manager   = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUri);
        }
示例#20
0
        public CruiseServer(IConfigurationService configurationService, IProjectIntegratorListFactory projectIntegratorListFactory, IProjectSerializer projectSerializer)
        {
            this.configurationService = configurationService;
            this.configurationService.AddConfigurationUpdateHandler(new ConfigurationUpdateHandler(Restart));
            this.projectIntegratorListFactory = projectIntegratorListFactory;

            // ToDo - get rid of manager, maybe
            manager = new CruiseManager(this);

            // By default, no integrators are running
            this.projectSerializer = projectSerializer;

            CreateIntegrators();
        }
示例#21
0
        public CruiseServer(IConfigurationService configurationService, IProjectIntegratorListFactory projectIntegratorListFactory, IProjectSerializer projectSerializer)
        {
            this.configurationService = configurationService;
            this.configurationService.AddConfigurationUpdateHandler(new ConfigurationUpdateHandler(Restart));
            this.projectIntegratorListFactory = projectIntegratorListFactory;

            // ToDo - get rid of manager, maybe
            manager = new CruiseManager(this);

            // By default, no integrators are running
            this.projectSerializer = projectSerializer;

            CreateIntegrators();
        }
        /// <summary>
        /// Generates the specified result.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public override string Generate(IIntegrationResult result)
        {
            ICruiseManager manager = (ICruiseManager)remotingService.Connect(typeof(ICruiseManager), ServerUri);

            ProjectStatus[] statuses = manager.GetProjectStatus();
            foreach (ProjectStatus status in statuses)
            {
                if (status.Name == ProjectName)
                {
                    return(status.LastSuccessfulBuildLabel);
                }
            }
            throw new NoSuchProjectException(ProjectName);
        }
示例#23
0
        protected override void ExecuteTask()
        {
            Log(Level.Info, "Connecting to CCNet server " + ServerUrl);
            _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl);

            if (this.CCNetPlugins != null && this.CCNetPlugins.FileNames.Count > 0)
            {
                foreach (string AssemblyPath in this.CCNetPlugins.FileNames)
                {
                    if (!PluginAlreadyLoaded(AssemblyPath))
                    {
                        Assembly LoadedAssembly = Assembly.LoadFile(AssemblyPath);
                        Log(Level.Debug, "Loaded {0}", LoadedAssembly.Location);
                    }
                }
            }

            bool clientInfoRequired = false;
            ArrayList clientInfoList = new ArrayList();

            IForceFilter[] forceFilters = this.project.ForceFilters;

            if (forceFilters != null && forceFilters.Length != 0)
            {
                foreach (IForceFilter forceFilter in forceFilters)
                {
                    if (forceFilter.RequiresClientInformation)
                    {
                        clientInfoRequired = true;
                        ForceFilterClientInfo info = forceFilter.GetClientInfo();
                        clientInfoList.Add(info);
                    }
                }
            }
            bool SuccessfullyForced = false;
            if (clientInfoRequired)
            {
                ForceFilterClientInfo[] clientInfo;
                clientInfo = (ForceFilterClientInfo[])clientInfoList.ToArray(typeof(ForceFilterClientInfo));
                SuccessfullyForced = _cruiseManager.ForceBuild(ProjectName, clientInfo);
            }
            else
            {
                SuccessfullyForced = _cruiseManager.ForceBuild(ProjectName);
            }
            if (!SuccessfullyForced)
                throw new BuildException(string.Format("Unable to force build for {0} on {1}.", this.ProjectName, this.ServerUrl), this.Location);
            Log(Level.Info, "Successfully forced CCNet project " + this.ProjectName);
        }
        public IntegrationStatus LaunchBuild(ICruiseManager cruiseManager, string projectName, int pollingIntervalInSeconds, int timeOutInSeconds)
        {
            ProjectStatus status = GetCurrentProjectStatus(cruiseManager, projectName);

            if (status == null)
            {
                throw new BuildException(string.Format("Project '{0}' not found on the build server.", projectName));
            }

            if (status.Activity != ProjectActivity.Sleeping)
            {
                throw new BuildException(string.Format("Project '{0}' activity is '{1}' instead of expected '{2}'", projectName, status.Activity, ProjectActivity.Sleeping));
            }

            Log(Level.Info, "Forcing build for project '{0}'", projectName);
            cruiseManager.ForceBuild(projectName);

            DateTime startTime = DateTime.Now;
            TimeSpan timeout   = new TimeSpan(0, 0, timeOutInSeconds);

            while (true)
            {
                TimeSpan elapsed = DateTime.Now - startTime;
                if (elapsed >= timeout)
                {
                    throw new BuildException(string.Format("Project '{0}' build timed-out (lasted more than {1} seconds)", projectName, timeOutInSeconds));
                }
                Thread.Sleep(pollingIntervalInSeconds * 1000);
                // check current integration status to decide what to do
                status = GetCurrentProjectStatus(cruiseManager, projectName);
                switch (status.Activity)
                {
                case ProjectActivity.Building:
                    // fine, keep it rolling
                    break;

                case ProjectActivity.CheckingModifications:
                    // fine
                    break;

                case ProjectActivity.Sleeping:
                    // the build is finished (may be successful or have failed)
                    return(status.BuildStatus);

                default:
                    throw new Exception(string.Format("Unknown ProjectActivity '{0}'", status.Activity));
                }
            }
        }
示例#25
0
        private ProjectStatus GetCurrentProjectStatus()
        {
            Log.Debug("Retrieving ProjectStatus from server: " + ServerUri);
            ICruiseManager cruiseManager = (ICruiseManager)remoteService.Connect(typeof(ICruiseManager), ServerUri);

            ProjectStatus[] currentStatuses = cruiseManager.GetProjectStatus();
            foreach (ProjectStatus currentStatus in currentStatuses)
            {
                if (currentStatus.Name == Project)
                {
                    return(currentStatus);
                }
            }
            throw new NoSuchProjectException(Project);
        }
示例#26
0
        private ProjectStatus GetCurrentProjectStatus()
        {
            //Log.Debug("Retrieving ProjectStatus from server: " + ServerUri);
            ICruiseManager cruiseManager = (ICruiseManager)this.RemoteService.Connect(typeof(ICruiseManager), ServerUri);

            try
            {
                return(cruiseManager.GetProjectStatusLite(Project));
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            return(new ProjectStatus(ProjectIntegratorState.Stopped, IntegrationStatus.Unknown, ProjectActivity.Sleeping, Project, "", new DateTime(), new TimeSpan(), "", "", new DateTime(), "", new Modification[] { }, new DateTime(), BuildCondition.NoBuild));
        }
示例#27
0
        public void GetProjectSomeBuildLabels(string serverUrl, string projectName, int numberToRetrieve, string refID)
        {
            if (!this.Project.DataTypeReferences.Contains(refID))
            {
                throw new BuildException(String.Format("The refid {0} is not defined.", refID));
            }

            StringList RefStringList = (StringList)this.Project.DataTypeReferences[refID];

            ICruiseManager Manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUrl);

            string[] Builds = Manager.GetMostRecentBuildNames(projectName, numberToRetrieve);

            foreach (string BuildName in Builds)
            {
                RefStringList.StringItems.Add(BuildName, new StringItem(BuildName));
            }
        }
        public string Generate(IIntegrationResult currentResult, IIntegrationResult result)
        {
            if (currentResult.IntegrationProperties["Deploy.Version"] != null && currentResult.IntegrationProperties["Deploy.Version"].ToString() != "")
            {
                return(currentResult.IntegrationProperties["Deploy.Version"].ToString());
            }

            ICruiseManager manager = (ICruiseManager)remotingService.Connect(typeof(ICruiseManager), ServerUri);

            ProjectStatus[] statuses = manager.GetProjectStatus();
            foreach (ProjectStatus status in statuses)
            {
                if (status.Name == ProjectName)
                {
                    return(status.LastSuccessfulBuildLabel);
                }
            }
            throw new NoSuchProjectException(ProjectName);
        }
示例#29
0
        private IProject GetProject(ICruiseManager manager, string projectName)
        {
            string serializedProject = string.Empty;

            serializedProject = manager.GetProject(projectName);
            try
            {
                return(this.projectSerializer.Deserialize(serializedProject));
            }
            catch (Exception ex)
            {
                foreach (string filePath in Directory.GetFiles(Path.Combine(System.Web.HttpContext.Current.Request.PhysicalApplicationPath, "bin"), "*plugin*.dll"))
                {
                    System.Reflection.Assembly.LoadFile(filePath);
                }
                serializedProject = manager.GetProject(projectName);
                return(this.projectSerializer.Deserialize(serializedProject));
            }
        }
        public bool ForceBuild(IProjectSpecifier projectSpecifier)
        {
            bool           clientInfoRequired = false;
            ArrayList      clientInfoList     = new ArrayList();
            ICruiseManager manager            = GetCruiseManager(projectSpecifier.ServerSpecifier);

            IForceFilter[] forceFilters = this.GetProject(manager, projectSpecifier.ProjectName).ForceFilters;

            if (forceFilters != null && forceFilters.Length != 0)
            {
                foreach (IForceFilter forceFilter in forceFilters)
                {
                    if (forceFilter.RequiresClientInformation)
                    {
                        clientInfoRequired = true;
                        ForceFilterClientInfo info = forceFilter.GetClientInfo();
                        clientInfoList.Add(info);
                    }
                }
            }

            Dictionary <string, string> webParams = new Dictionary <string, string>();

            foreach (String key in HttpContext.Current.Request.Form.Keys)
            {
                String value = HttpContext.Current.Request.Params[key];
                webParams.Add(key, value);
            }

            if (clientInfoRequired)
            {
                ForceFilterClientInfo[] clientInfo;
                clientInfo = (ForceFilterClientInfo[])clientInfoList.ToArray(typeof(ForceFilterClientInfo));
                return(manager.ForceBuild(projectSpecifier.ProjectName, webParams, clientInfo));
            }
            else
            {
                return(manager.ForceBuild(projectSpecifier.ProjectName, webParams));
            }
        }
        public IntegrationStatus LaunchBuild(ICruiseManager cruiseManager, string projectName, int pollingIntervalInSeconds, int timeOutInSeconds)
        {
            ProjectStatus status = GetCurrentProjectStatus(cruiseManager, projectName);
            if (status == null)
                throw new BuildException(string.Format("Project '{0}' not found on the build server.", projectName));

            if (status.Activity != ProjectActivity.Sleeping)
                throw new BuildException(string.Format("Project '{0}' activity is '{1}' instead of expected '{2}'", projectName, status.Activity, ProjectActivity.Sleeping));

            Log(Level.Info, "Forcing build for project '{0}'", projectName);
            cruiseManager.ForceBuild(projectName);

            DateTime startTime = DateTime.Now;
            TimeSpan timeout = new TimeSpan(0, 0, timeOutInSeconds);
            while (true)
            {
                TimeSpan elapsed = DateTime.Now - startTime;
                if (elapsed >= timeout)
                    throw new BuildException(string.Format("Project '{0}' build timed-out (lasted more than {1} seconds)", projectName, timeOutInSeconds));
                Thread.Sleep(pollingIntervalInSeconds*1000);
                // check current integration status to decide what to do
                status = GetCurrentProjectStatus(cruiseManager, projectName);
                switch (status.Activity)
                {
                    case ProjectActivity.Building:
                        // fine, keep it rolling
                        break;
                    case ProjectActivity.CheckingModifications:
                        // fine
                        break;
                    case ProjectActivity.Sleeping:
                        // the build is finished (may be successful or have failed)
                        return status.BuildStatus;
                    default:
                        throw new Exception(string.Format("Unknown ProjectActivity '{0}'",status.Activity));
                }
            }
        }
示例#32
0
 public CruiseProjectManager(ICruiseManager server, string projectName)
 {
     this.manager = server;
     this.projectName = projectName;
 }
示例#33
0
		public ContentTransformation(ICruiseManager cruiseManager, IBuildLogTransformer logTransformer)
		{
			this.logTransformer = logTransformer;
			this.cruiseManager = cruiseManager;
		}
 private IProject GetProject(ICruiseManager manager, string projectName)
 {
     string serializedProject = string.Empty;
     serializedProject = manager.GetProject(projectName);
     try
     {
         return this.projectSerializer.Deserialize(serializedProject);
     }
     catch (Exception ex)
     {
         foreach (string filePath in Directory.GetFiles(Path.Combine(System.Web.HttpContext.Current.Request.PhysicalApplicationPath, "bin"), "*plugin*.dll"))
         {
             System.Reflection.Assembly.LoadFile(filePath);
         }
         serializedProject = manager.GetProject(projectName);
         return this.projectSerializer.Deserialize(serializedProject);
     }
 }
示例#35
0
        public string GetProjectLastBuildLog(string serverUrl, string projectName)
        {
            ICruiseManager Manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUrl);

            return(Manager.GetLatestBuildName(projectName));
        }
示例#36
0
		public BaseController(ICruiseManager server)
		{
			this.cruise = server;
		}
示例#37
0
 public CruiseProjectManager(ICruiseManager server, string projectName)
 {
     this.manager     = server;
     this.projectName = projectName;
 }
示例#38
0
        public string GetProjectLastBuildLabel(string serverUrl, string projectName)
        {
            ICruiseManager Manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUrl);

            return(Manager.GetProjectStatus(projectName).LastBuildLabel);
        }
示例#39
0
        public string GetProjectLastBuildDate(string serverUrl, string projectName)
        {
            ICruiseManager Manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUrl);

            return(Manager.GetProjectStatus(projectName).LastBuildDate.ToString(ThoughtWorks.CruiseControl.Core.LogFile.FilenameDateFormat));
        }
        public void Kill(IProjectSpecifier projectSpecifier)
        {
            ICruiseManager manager = GetCruiseManager(projectSpecifier.ServerSpecifier);

            manager.Kill(projectSpecifier.ProjectName);
        }
示例#41
0
 public CruiseController(ICruiseManager server, ContentTransformation contentTransformation) : base(server)
 {
     this.contentTransformation = contentTransformation;
 }
示例#42
0
        public string GetProjectState(string serverUrl, string projectName)
        {
            ICruiseManager Manager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), serverUrl);

            return(Manager.GetProjectStatus(projectName).Status.ToString());
        }
示例#43
0
		public CruiseController(ICruiseManager server, ContentTransformation contentTransformation) : base(server)
		{
			this.contentTransformation = contentTransformation;
		}