Compare commits

...

11 Commits

Author SHA1 Message Date
f510277c16 2.1.40 2016-06-07 08:02:15 +02:00
2d61640c91 improve mounting 2016-06-07 08:02:02 +02:00
e4507b7073 update test 2016-06-07 07:54:04 +02:00
0acb6ad351 2.1.39 2016-06-07 06:51:17 +02:00
c33e0c622b fix docker test call 2016-06-07 06:51:05 +02:00
5085e86c9b even better logs 2016-06-07 06:35:10 +02:00
3ea8265a75 now stating local build depdendencies in log 2016-06-07 06:31:53 +02:00
d7e4efc2c0 2.1.38 2016-06-07 06:14:46 +02:00
7ca0171658 fix image id inspection 2016-06-07 06:14:36 +02:00
87d8a4401e 2.1.37 2016-06-07 06:05:17 +02:00
8b5cf3bb5f fix local image dependency detection 2016-06-07 06:05:13 +02:00
4 changed files with 26 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "npmci", "name": "npmci",
"version": "2.1.36", "version": "2.1.40",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {

3
test/assets/test/test_latest.sh Normal file → Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
npm -v
node -v

View File

@@ -35,16 +35,16 @@ export let readDockerfiles = function(){
export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]){ export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]){
let done = plugins.q.defer(); let done = plugins.q.defer();
let sortedArray:Dockerfile[] = []; let sortedArray:Dockerfile[] = [];
let trackingArray:Dockerfile[] = []; let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg,sortedArray);
let sorterFunctionCounter:number = 0; let sorterFunctionCounter:number = 0;
let sorterFunction = function(){ let sorterFunction = function(){
sortableArrayArg.forEach((dockerfileArg)=>{ sortableArrayArg.forEach((dockerfileArg)=>{
let cleanTags = cleanTagsArrayFunction(sortableArrayArg,trackingArray); let cleanTags = cleanTagsArrayFunction(sortableArrayArg,sortedArray);
if(cleanTags.indexOf(dockerfileArg.baseImage) == -1 && trackingArray.indexOf(dockerfileArg) == -1){ if(cleanTags.indexOf(dockerfileArg.baseImage) == -1 && sortedArray.indexOf(dockerfileArg) == -1){
sortedArray.push(dockerfileArg); sortedArray.push(dockerfileArg);
trackingArray.push(dockerfileArg); };
} else if(cleanTags.indexOf(dockerfileArg.baseImage) != -1){ if(cleanTagsOriginal.indexOf(dockerfileArg.baseImage) != -1){
dockerfileArg.localBaseImageDependent = true; dockerfileArg.localBaseImageDependent = true;
}; };
}); });
@@ -147,6 +147,7 @@ export class Dockerfile {
this.localBaseImageDependent = false; this.localBaseImageDependent = false;
}; };
build(){ build(){
plugins.beautylog.info("now building Dockerfile for " + this.cleanTag);
let done = plugins.q.defer(); let done = plugins.q.defer();
this.patchContents(); this.patchContents();
bashBare("docker build -t " + this.buildTag + " -f " + this.filePath + " ."); bashBare("docker build -t " + this.buildTag + " -f " + this.filePath + " .");
@@ -174,8 +175,8 @@ export class Dockerfile {
); );
if(testExists){ if(testExists){
bashBare("docker run -v " + bashBare("docker run -v " +
plugins.path.join(paths.NpmciProjectDir,"./test") + ":/test/ " + plugins.path.join(paths.NpmciProjectDir,"./test/") + ":/test/ " +
"--name " + this.containerName + " /test/" + "test_" + this.version + ".sh"); "--name " + this.containerName + " " + this.buildTag + " /test/" + "test_" + this.version + ".sh");
} else { } else {
plugins.beautylog.warn("skipping tests for " + this.cleanTag + " because no testfile was found!"); plugins.beautylog.warn("skipping tests for " + this.cleanTag + " because no testfile was found!");
} }
@@ -185,12 +186,13 @@ export class Dockerfile {
bashBare("docker push " + this.releaseTag); bashBare("docker push " + this.releaseTag);
} }
getId(){ getId(){
let containerId = bashBare("docker inspect --format=\"{{.Id}}\" " + this.buildTag); let containerId = bashBare("docker inspect --type=image --format=\"{{.Id}}\" " + this.buildTag);
return containerId; return containerId;
}; };
patchContents(){ patchContents(){
let done = plugins.q.defer(); let done = plugins.q.defer();
if(this.localBaseImageDependent == true){ if(this.localBaseImageDependent == true){
plugins.beautylog.info("patching Dockerfile due to local build dependency!");
this.patchedContent = this.content.replace(/FROM\s[a-zA-Z0-9\/\-\:]*/, 'FROM ' + this.localBaseDockerfile.buildTag); this.patchedContent = this.content.replace(/FROM\s[a-zA-Z0-9\/\-\:]*/, 'FROM ' + this.localBaseDockerfile.buildTag);
plugins.smartfile.memory.toFsSync( plugins.smartfile.memory.toFsSync(
this.patchedContent, this.patchedContent,