public void BuildGetGenericTest()
        {
            // Arrange
            JenkinsModelFreeStyleBuild freeStyleBuild = null;
            //JenkinsBuildExternal externalBuild = null;
            JenkinsMatrixMatrixBuild    matrixBuild   = null;
            JenkinsJenkinsciWorkflowRun workflowBuild = null;

            //JenkinsBuildWorkflowMultiBranch multiBranchBuild = null;
            //JenkinsBuildFolder folderBuild = null;
            //JenkinsBuildOrganizationFolder organizationFolderBuild = null;

            // Act
            using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password))
            {
                freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("Freestyle").Result;
                //externalBuild = jenkins.GetBuildAsync("ExternalJob", 1).Result as JenkinsBuildExternal;
                matrixBuild   = jenkins.GetBuildAsync <JenkinsMatrixMatrixBuild>("Multiconfiguration", 1).Result;
                workflowBuild = jenkins.GetBuildAsync <JenkinsJenkinsciWorkflowRun>("Pipeline", 1).Result;
                //multiBranchBuild = jenkins.GetBuildAsync("MultibranchPipeline", 1).Result as JenkinsBuildWorkflowMultiBranch;
                //folderBuild = jenkins.GetBuildAsync("Folder", 1).Result as JenkinsBuildFolder;
                //organizationFolderBuild = jenkins.GetBuildAsync("GitHubOrganization", 1).Result as JenkinsBuildOrganizationFolder;
            }

            // Assert
            Assert.IsNotNull(freeStyleBuild);
            //Assert.IsNotNull(externalBuild);
            Assert.IsNotNull(matrixBuild);
            Assert.IsNotNull(workflowBuild);
            //Assert.IsNotNull(multiBranchBuild);
            //Assert.IsNotNull(folderBuild);
            //Assert.IsNotNull(organizationFolderBuild);
        }
Exemplo n.º 2
0
        public void BuildTest()
        {
            JenkinsModelFreeStyleBuild freeStyleBuild = null;
            //JenkinsBuildExternal externalBuild = null;
            JenkinsMatrixMatrixBuild matrixBuild = null;
            JenkinsOrgJenkinsciPluginsWorkflowJobWorkflowRun workflowBuild = null;

            //JenkinsBuildWorkflowMultiBranch multiBranchBuild = null;
            //JenkinsBuildFolder folderBuild = null;
            //JenkinsBuildOrganizationFolder organizationFolderBuild = null;

            using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password))
            {
                freeStyleBuild = jenkins.GetLastBuildAsync("Freestyle Test Pure").Result as JenkinsModelFreeStyleBuild;
                //externalBuild = jenkins.GetBuildAsync("External Job", 1).Result as JenkinsBuildExternal;
                matrixBuild   = jenkins.GetBuildAsync("Multiconfiguration", 1).Result as JenkinsMatrixMatrixBuild;
                workflowBuild = jenkins.GetBuildAsync("Pipeline", 1).Result as JenkinsOrgJenkinsciPluginsWorkflowJobWorkflowRun;
                //multiBranchBuild = jenkins.GetBuildAsync("Multibranch", 1).Result as JenkinsBuildWorkflowMultiBranch;
                //folderBuild = jenkins.GetBuildAsync("Folder", 1).Result as JenkinsBuildFolder;
                //organizationFolderBuild = jenkins.GetBuildAsync("GitHub", 1).Result as JenkinsBuildOrganizationFolder;
            }

            Assert.IsNotNull(freeStyleBuild);
            //Assert.IsNotNull(externalBuild);
            Assert.IsNotNull(matrixBuild);
            //Assert.IsNotNull(workflowBuild);
            //Assert.IsNotNull(multiBranchBuild);
            //Assert.IsNotNull(folderBuild);
            //Assert.IsNotNull(organizationFolderBuild);
        }
Exemplo n.º 3
0
 internal JenkinsBuild(Jenkins jenkins, JenkinsJob job, int buildNum)
 {
     this.jenkins          = jenkins;
     this.job              = job;
     this.modelRun         = JenkinsRun.Run(() => jenkins.GetBuildAsync <JenkinsModelRun>(this.JobName, buildNum).Result);
     this.isCompleteLoaded = true;
 }
        public void BuildSetInformationTest()
        {
            // Arrange
            JenkinsModelFreeStyleBuild freeStyleBuild = null;

            // Act
            using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password))
            {
                freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("FreeStyle").Result;
                jenkins.SetBuildInformation("FreeStyle", freeStyleBuild.Number, "Build name", "Build description").Wait();
                freeStyleBuild = jenkins.GetBuildAsync <JenkinsModelFreeStyleBuild>("FreeStyle", freeStyleBuild.Number).Result;
                jenkins.SetBuildInformation("FreeStyle", freeStyleBuild.Number, "", "").Wait();
            }

            // Assert
            Assert.IsNotNull(freeStyleBuild, nameof(freeStyleBuild));

            Assert.AreEqual("Build name", freeStyleBuild.DisplayName, nameof(freeStyleBuild.DisplayName));
            Assert.AreEqual("Build description", freeStyleBuild.Description, nameof(freeStyleBuild.Description));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Refresh the properties of the Jenkins build.
 /// </summary>
 public void Update()
 {
     this.modelRun = JenkinsRun.Run(() => jenkins.GetBuildAsync <JenkinsModelRun>(this.JobName, this.modelRun.Number).Result);
 }