Ejemplo n.º 1
0
 /// <summary>
 /// The Jenkins constructor
 /// </summary>
 public Jenkins()
 {
     _currentBuild = new Build();
     bw.WorkerSupportsCancellation = true;
     bw.WorkerReportsProgress = true;
     bw.DoWork += bw_DoWork;
     bw.RunWorkerCompleted += bw_RunWorkerCompleted;
     bw.ProgressChanged += bw_ProgressChanged;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Start a new build from the given branch
        /// </summary>
        /// <param name="branch">The branch to build</param>
        /// <returns>Build object with the return</returns>
        public Build NewBuild(string branch)
        {
            if (!String.IsNullOrWhiteSpace(branch))
            {
                SwitchBranch(branch);
            }
            Build previous = GetLatest();

            Build current = new Build();
            current.Number = previous.Number + 1;

            string ret = RunQuery("build");
            if (!String.IsNullOrEmpty(ret))
            {
                throw new FormatException("Jenkins build may be not started correctly.");
            }

            bw.RunWorkerAsync(current);
            FireBuildStateChange(current);
            return current;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Fire the Build state change
 /// </summary>
 /// <param name="build">Build object that just changed its state</param>
 private void FireBuildStateChange(Build build)
 {
     if (BuildStateChange != null)
     {
         BuildStateChange(build);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Get the Jenkins build object for the given build number
 /// </summary>
 /// <param name="buildNo">Build no to query</param>
 /// <returns>Build object</returns>
 public Build GetBuild(int buildNo)
 {
     string retData = RunQuery(buildNo.ToString());
     _currentBuild = new Build(retData);
     return _currentBuild;
 }