use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class GitCreationPage method createPipeline.
public MultiBranchPipeline createPipeline(SSEClientRule sseCLient, String pipelineName, String url, String sshPrivateKey, String user, String pass) throws IOException {
jobApi.deletePipeline(pipelineName);
dashboardPage.clickNewPipelineBtn();
clickGitCreationOption();
wait.until(By.cssSelector("div.text-repository-url input")).sendKeys(url);
wait.until(By.cssSelector("button.button-create-credential")).click();
if (!Strings.isNullOrEmpty(sshPrivateKey)) {
wait.until(By.xpath("//span[text()='SSH Key']")).click();
wait.until(By.cssSelector("textarea.TextArea-control")).sendKeys(sshPrivateKey);
wait.until(By.cssSelector(".Dialog-button-bar button.button-create-credental")).click();
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(".create-credential-dialog")));
logger.info("Created credential");
} else if (!Strings.isNullOrEmpty(user) && !Strings.isNullOrEmpty(pass)) {
wait.until(By.xpath("//span[text()='Username & Password']")).click();
wait.until(By.cssSelector("div.text-username input")).sendKeys(user);
wait.until(By.cssSelector("div.text-password input")).sendKeys(pass);
wait.until(By.cssSelector(".Dialog-button-bar button.button-create-credental")).click();
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(".create-credential-dialog")));
logger.info("Created user/pass credential");
}
wait.until(By.cssSelector(".button-create-pipeline")).click();
logger.info("Click create pipeline button");
MultiBranchPipeline pipeline = multiBranchPipelineFactory.pipeline(pipelineName);
wait.until(ExpectedConditions.urlContains(pipeline.getUrl() + "/activity"), 30000);
sseCLient.untilEvents(SSEEvents.activityComplete(pipeline.getName()));
driver.navigate().refresh();
pipeline.getActivityPage().checkUrl();
return pipeline;
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class GithubCreationTest method testCreatePullRequest.
/**
* This test walks through a simple Pull Request flow..
*
* -Creates a github repo with a sample Jenkinsfile and follows
* the typical create flow
* -Navigates back to the top level Dashboard page
* -Creates a PR in the GH repo
* -Triggers a rescan of the multibranch pipeline
* -Opens the PR tab to verify that we actually have something there.
*/
@Test
@Retry(3)
public void testCreatePullRequest() throws IOException {
String branchToCreate = "new-branch";
String commitMessage = "Add new-file to our repo";
MultiBranchPipeline pipeline = mbpFactory.pipeline(repo);
byte[] firstJenkinsfile = "stage('first-build') { echo 'first-build' }".getBytes("UTF-8");
GHContentUpdateResponse initialUpdateResponse = ghRepository.createContent(firstJenkinsfile, "firstJenkinsfile", "Jenkinsfile", "master");
ghRepository.createRef(("refs/heads/" + branchToCreate), initialUpdateResponse.getCommit().getSHA1());
logger.info("Created master and " + branchToCreate + " branches in " + repo);
ghRepository.createContent("hi there", "newfile", "new-file", branchToCreate);
creationPage.createPipeline(token, organization, repo);
dashboardPage.open();
ghRepository.createPullRequest(commitMessage, branchToCreate, "master", "My first pull request is very exciting.");
// Fire the rescan.
pipeline.rescanThisPipeline();
dashboardPage.clickPipeline(repo);
ActivityPage activityPage = pipeline.getActivityPage().checkUrl();
PullRequestsPage pullRequestsPage = activityPage.clickPullRequestsTab();
pullRequestsPage.clickRunButton("1");
pullRequestsPage.clickHistoryButton("1");
// We'll be on the activity page now, pre-filtered to PR-1.
// Go to the Pull Requests tab one last time.
activityPage.clickPullRequestsTab();
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class GitCreationTest method testSSHPrivateRepository.
@Ignore
@Test
public void testSSHPrivateRepository() throws IOException, GitAPIException, URISyntaxException {
String gitUrl = liveProperties.getProperty("git.ssh.repository");
String privateKeyFile = liveProperties.getProperty("git.ssh.keyfile");
String pipelineName = liveProperties.getProperty("git.ssh.pipelineName");
Assert.assertNotNull(gitUrl);
Assert.assertNotNull(privateKeyFile);
Assert.assertNotNull(pipelineName);
logger.info("PipelineName: " + pipelineName);
logger.info("git repo - " + gitUrl);
String key = IOUtils.toString(new FileInputStream(privateKeyFile));
MultiBranchPipeline pipeline = gitCreationPage.createPipeline(sseClient, pipelineName, gitUrl, key, null, null);
pipeline.getActivityPage().testNumberRunsComplete(1);
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class FolderTest method multiBranchFolderTest.
/**
* Tests that the activity page works when there are multiple layers of folders, and with funky characters.
*
* As long as activity loads run, any other page for this pipeline should load as it uses a shared router.
*/
@Test
public void multiBranchFolderTest() throws GitAPIException, IOException {
String pipelineName = "FolderTest_multiBranchFolderTest";
git.writeJenkinsFile(loadJenkinsFile());
git.addAll();
git.commit("First");
git.createBranch("feature/1");
MultiBranchPipeline p = mbpFactory.pipeline(folder, pipelineName).createPipeline(git);
client.untilEvents(p.buildsFinished);
p.getActivityPage().open();
}
use of io.blueocean.ath.model.MultiBranchPipeline in project blueocean-plugin by jenkinsci.
the class NavigationTest method testBranchHistory.
/**
* This test clicks on the history button on a branch, and makes sure that it navigates to the activity page
* on the correct url.
*/
@Test
public void testBranchHistory() throws IOException, GitAPIException {
git.writeJenkinsFile(loadJenkinsFile());
git.addAll();
git.commit("Added Jenkinsfile");
git.createBranch("feature/1");
git.createBranch("feature@2");
MultiBranchPipeline pipeline = multiBranchPipelineFactory.pipeline(Folder.folders("a folder", "bfolder", "folder"), "NavigationTest_testNavigation");
pipeline.createPipeline(git);
dashboardPage.open();
dashboardPage.clickPipeline(pipeline.getName());
ActivityPage activityPage = pipeline.getActivityPage().checkUrl();
BranchPage branchPage = activityPage.clickBranchTab();
branchPage.clickHistoryButton("feature/1");
activityPage.open();
activityPage.getRunRowForBranch("feature@2").click();
pipeline.getRunDetailsPipelinePage().checkUrl("feature%402", 1);
pipeline.getRunDetailsPipelinePage().checkBasicDomElements();
}
Aggregations