Skip to content

Commit

Permalink
Typescript support (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
imeredith authored Mar 26, 2018
1 parent 0ffc620 commit 890e3a9
Show file tree
Hide file tree
Showing 36 changed files with 17,168 additions and 6,352 deletions.
35 changes: 18 additions & 17 deletions acceptance-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ParallelNavigationTest {
MultiBranchPipelineFactory mbpFactory;

// Names of the pipelines we'll create
String navTest = "ParallelNavTest_tested";
String navTest = "ParallelNavTest_tested";
String navTestWithInput = "ParallelNavTestWithInput_tested";
String navTestWithFailedInputStep = "ParallelNavigationTest_failed_input";
String navTestWithNoStepsNoStages = "ParallelNavTestWithNoStepsNoStages";
Expand All @@ -58,7 +58,7 @@ public class ParallelNavigationTest {
*/
@Test
@Retry(3)
public void parallelNavigationTest () throws IOException, GitAPIException, InterruptedException {
public void parallelNavigationTest() throws IOException, GitAPIException, InterruptedException {
// Create navTest
logger.info("Creating pipeline " + navTest);
URL navTestJenkinsfile = Resources.getResource(ParallelNavigationTest.class, "ParallelNavigationTest/Jenkinsfile");
Expand Down Expand Up @@ -87,7 +87,7 @@ public void parallelNavigationTest () throws IOException, GitAPIException, Inter
* One at a time, the proceed button will be clicked.
*/
@Test
public void parallelNavigationTestInput () throws IOException, GitAPIException, InterruptedException {
public void parallelNavigationTestInput() throws IOException, GitAPIException, InterruptedException {
// Create navTestWithInput
logger.info("Creating pipeline " + navTestWithInput);
URL navTestInputJenkinsfile = Resources.getResource(ParallelNavigationTest.class, "ParallelNavigationTest/Jenkinsfile.input");
Expand Down Expand Up @@ -117,7 +117,7 @@ public void parallelNavigationTestInput () throws IOException, GitAPIException,
* This checks that an error is shown in the UI for a failed input step
*/
@Test
public void failedInputStep () throws IOException, GitAPIException, InterruptedException {
public void failedInputStep() throws IOException, GitAPIException, InterruptedException {
// Create navTestWithFailedInputStep
logger.info("Creating pipeline " + navTestWithFailedInputStep);
URL navTestWithFailedInputStepJenkinsfile = Resources.getResource(ParallelNavigationTest.class, "ParallelNavigationTest/Jenkinsfile.failed.input");
Expand All @@ -141,7 +141,7 @@ public void failedInputStep () throws IOException, GitAPIException, InterruptedE
* This checks that the log is visible when a run fails with no steps or stages
*/
@Test
public void testLogVisibilityWhenNoStepsOrStages () throws IOException, GitAPIException, InterruptedException {
public void testLogVisibilityWhenNoStepsOrStages() throws IOException, GitAPIException, InterruptedException {
// Create navTestWithNoStepsNoStages
logger.info("Creating pipeline " + navTestWithNoStepsNoStages);
URL navTestWithNoStepsNoStagesJenkinsfile = Resources.getResource(ParallelNavigationTest.class, "ParallelNavigationTest/Jenkinsfile.nosteps.nostages");
Expand All @@ -162,7 +162,7 @@ public void testLogVisibilityWhenNoStepsOrStages () throws IOException, GitAPIEx
* This checks that href attr of the alert error for unsupported inputs leads to the correct classic url
*/
@Test
public void testInputParamGoToClassicLink () throws IOException, GitAPIException, InterruptedException {
public void testInputParamGoToClassicLink() throws IOException, GitAPIException, InterruptedException {
// Create navTestInputParamGoToClassicLink
logger.info("Creating pipeline " + navTestInputParamGoToClassicLink);
URL navTestInputParamGoToClassicLinkJenkinsfile = Resources.getResource(ParallelNavigationTest.class, "ParallelNavigationTest/Jenkinsfile.input.param.classic.link");
Expand All @@ -178,17 +178,4 @@ public void testInputParamGoToClassicLink () throws IOException, GitAPIException
logger.info("Wait for alert error with link to classic input to appear");
wait.until(By.xpath("//*[@class=\"Alert Error\"]//a[@href=\"/job/ParallelNavTestInputParamGoToClassicLink/job/master/1/input\"]"));
}

@AfterClass
public static void deleteTestPipelines() throws IOException, GitAPIException, InterruptedException {
MultiBranchPipeline[] listOfPipelineJobs = {navTestPipeline, navTestWithInputPipeline, navTestWithFailedInputStepPipeline};
for (MultiBranchPipeline pipelineToCleanup:listOfPipelineJobs) {
/*
stopAllRuns and deleteThisPipeline both provide their own
logger messages, no need to create new ones here.
*/
pipelineToCleanup.stopAllRuns();
pipelineToCleanup.deleteThisPipeline(pipelineToCleanup.getName());
}
}
}
95 changes: 95 additions & 0 deletions bin/rebuildShrinkwrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/env node
/**
* This script will install the package and version you want in the directories
* that are defined in below array. It accept a full version string
* e.g. @jenkins-cd/[email protected]
* as input and if you do not provide that it will start a prompt.
*
* We will prune and install BEFORE we install the requested version to make sure that
* shrinkwrap will update correctly everytime. We further do an optional `mvn install`
* to publish the new hpi to the local .m2 repository
*
* Usage: bin/cleanInstall.js [[@scope/]package@version] [dev] [mvn]
*
* dev will install a devDependency
* mvn will run the optional `mvn install` afterwards
*/
const fs = require('fs');
const async = require('async');
const exec = require('child_process').exec;
const prompt = require('prompt');

const start = new Date().getTime();
const directories = ['../blueocean-dashboard', '../blueocean-personalization', '../blueocean-web', '../blueocean-pipeline-editor', '../blueocean-core-js', '../jenkins-design-language'];

var isDevDependency = false; // Set via command line
var shouldRunMaven = false; // Set via command line

function invokeInstall() {
async.map(directories,
function (elem, callback) {
console.log('Current element', elem);
removeAndInstall(elem, callback);
},
function (err, result) {
if (err) {
console.error('Something went wrong! node_modules might now be trashed, sorry.', err);
process.exit(1);
} else {
const ellapsed = new Date().getTime() - start;
console.log(`Install look good! took ${ellapsed}ms`);
process.exit(0);
}
}
);
}


invokeInstall();


function buildPath(path) {
try {
return fs.realpathSync(path);
} catch (error) {
console.error(`ERROR: Could not find ${path}`);
return null;
}
}
function deleteFolderRecursive(path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function (file, index) {
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
function removeAndInstall(pathToProject, callback) {
const resolvedPath = buildPath(`${__dirname}/${pathToProject}`);
const removeDir = buildPath(`${resolvedPath}/node_modules/`);
const shrinkwrap = `${resolvedPath}/npm-shrinkwrap.json`
if (fs.existsSync(shrinkwrap)) {
fs.unlinkSync(shrinkwrap);
}

deleteFolderRecursive(removeDir);

process.chdir(resolvedPath);
console.log('In directory ' + process.cwd());
console.log('installing');
let command = 'npm install && npm shrinkwrap --dev ';
console.log('running ' + command);
const child = exec(command,
function (error, stdout, stderr) {
console.error(`Error in ${resolvedPath}`);
if (error !== null) {
callback(error);
}
callback(error, stdout);
});
}
Loading

0 comments on commit 890e3a9

Please sign in to comment.