diff --git a/dist/npmci.build.docker.d.ts b/dist/npmci.build.docker.d.ts index 58e1106..4d2478a 100644 --- a/dist/npmci.build.docker.d.ts +++ b/dist/npmci.build.docker.d.ts @@ -1,6 +1,6 @@ export declare let build: () => any; export declare let readDockerfiles: () => any; -export declare let cleanTagsArrayFunction: (dockerfileArrayArg: Dockerfile[]) => string[]; +export declare let cleanTagsArrayFunction: (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]) => string[]; export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => any; export declare let buildDockerfiles: () => any; export declare class Dockerfile { diff --git a/dist/npmci.build.docker.js b/dist/npmci.build.docker.js index 07376ab..97a8e94 100644 --- a/dist/npmci.build.docker.js +++ b/dist/npmci.build.docker.js @@ -21,31 +21,39 @@ exports.readDockerfiles = function () { })); return done.promise; }; -exports.cleanTagsArrayFunction = function (dockerfileArrayArg) { +exports.cleanTagsArrayFunction = function (dockerfileArrayArg, trackingArrayArg) { var cleanTagsArray = []; dockerfileArrayArg.forEach(function (dockerfileArg) { - cleanTagsArray.push(dockerfileArg.cleanTag); + if (trackingArrayArg.indexOf(dockerfileArg) == -1) { + cleanTagsArray.push(dockerfileArg.cleanTag); + } }); return cleanTagsArray; }; exports.sortDockerfiles = function (sortableArrayArg) { var done = plugins.q.defer(); var sortedArray = []; + var trackingArray = []; var sorterFunctionCounter = 0; + console.log(sortableArrayArg); + console.log(sortedArray); var sorterFunction = function () { + plugins.beautylog.log("++++++++++++++++++++++++++++++++++++++++++++++"); console.log(sorterFunctionCounter); - var cleanTags = exports.cleanTagsArrayFunction(sortableArrayArg); sortableArrayArg.forEach(function (dockerfileArg) { - if (cleanTags.indexOf(dockerfileArg.baseImage) == -1) { - var dockerfileArgIndex = sortableArrayArg.indexOf(dockerfileArg); - sortableArrayArg.splice(dockerfileArgIndex, 1); + console.log(dockerfileArg); + var cleanTags = exports.cleanTagsArrayFunction(sortableArrayArg, trackingArray); + console.log(cleanTags); + if (cleanTags.indexOf(dockerfileArg.baseImage) == -1 && trackingArray.indexOf(dockerfileArg) == -1) { sortedArray.push(dockerfileArg); + trackingArray.push(dockerfileArg); } }); - if (sortableArrayArg.length == 0) { + plugins.beautylog.info(sortedArray.length.toString()); + if (sortableArrayArg.length == sortedArray.length) { done.resolve(sortedArray); } - else if (sorterFunctionCounter < 100) { + else if (sorterFunctionCounter < 10) { sorterFunctionCounter++; sorterFunction(); } @@ -130,4 +138,4 @@ exports.dockerTag = function (repoArg, versionArg) { return tagString; }; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmJ1aWxkLmRvY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBWSxPQUFPLFdBQU0saUJBQ3pCLENBQUMsQ0FEeUM7QUFDMUMsSUFBWSxRQUFRLFdBQU0sYUFBYSxDQUFDLENBQUE7QUFHN0IsYUFBSyxHQUFHO0lBQ2YsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUU3QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUE7QUFFVSx1QkFBZSxHQUFHO0lBQ3pCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxvQkFBb0IsR0FBZ0IsRUFBRSxDQUFBO0lBQzFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLGVBQWUsQ0FBQztTQUM1QixJQUFJLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsVUFBUyxJQUFJLEVBQUMsR0FBRyxFQUFDLEVBQUU7UUFDM0MsSUFBSSxZQUFZLEdBQUcsSUFBSSxVQUFVLENBQUM7WUFDOUIsUUFBUSxFQUFDLElBQUksQ0FB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XBvID0gcmVwb0FyZztcbiAgICBsZXQgdmVyc2lvbiA9IHZlcnNpb25Bcmc7XG4gICAgaWYocHJvY2Vzcy5lbnYuQ0lfQlVJTERfU1RBR0UgPT0gXCJidWlsZFwiIHx8IHByb2Nlc3MuZW52LkNJX0JVSUxEX1NUQUdFID09IFwidGVzdFwiKXtcbiAgICAgICAgdmVyc2lvbiA9IHZlcnNpb24gKyBcIl90ZXN0XCI7XG4gICAgfVxuICAgIHRhZ1N0cmluZyA9IHJlZ2lzdHJ5ICsgXCIvXCIgKyByZXBvICsgXCI6XCIgKyB2ZXJzaW9uO1xuICAgIHJldHVybiB0YWdTdHJpbmc7XG59O1xuIl19 diff --git a/test/assets/Dockerfile_sometag1 b/test/assets/Dockerfile_sometag1 index 9234e6a..4136814 100644 --- a/test/assets/Dockerfile_sometag1 +++ b/test/assets/Dockerfile_sometag1 @@ -1,2 +1,2 @@ -FROM myrepo/mygroup:sometag2 +FROM mygroup/myrepo:sometag2 RUN apt-get update \ No newline at end of file diff --git a/test/test.js b/test/test.js index 34603b4..327b9e6 100644 --- a/test/test.js +++ b/test/test.js @@ -2,6 +2,7 @@ require("typings-test"); require("should"); var path = require("path"); +var beautylog = require("beautylog"); //set up environment process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git"; process.cwd = function () { @@ -31,6 +32,7 @@ describe("NPMCI", function () { it("should sort an array of Dockerfiles", function (done) { NpmciBuildDocker.sortDockerfiles(sortableArray) .then(function (sortedArrayArg) { + beautylog.success("final result"); console.log(sortedArrayArg); done(); }); @@ -38,4 +40,4 @@ describe("NPMCI", function () { }); }); -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQ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XMoKVxuICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHJlYWREb2NrZXJmaWxlc0FycmF5QXJnOk5wbWNpQnVpbGREb2NrZXIuRG9ja2VyZmlsZVtdKXtcbiAgICAgICAgICAgICAgICAgICAgcmVhZERvY2tlcmZpbGVzQXJyYXlBcmdbMV0udmVyc2lvbi5zaG91bGQuZXF1YWwoXCJzb21ldGFnMVwiKTtcbiAgICAgICAgICAgICAgICAgICAgc29ydGFibGVBcnJheSA9IHJlYWREb2NrZXJmaWxlc0FycmF5QXJnXG4gICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgfSlcbiAgICAgICAgaXQoXCJzaG91bGQgc29ydCBhbiBhcnJheSBvZiBEb2NrZXJmaWxlc1wiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgTnBtY2lCdWlsZERvY2tlci5zb3J0RG9ja2VyZmlsZXMoc29ydGFibGVBcnJheSlcbiAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbihzb3J0ZWRBcnJheUFyZzpOcG1jaUJ1aWxkRG9ja2VyLkRvY2tlcmZpbGVbXSl7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHNvcnRlZEFycmF5QXJnKTtcbiAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgIH0pXG4gICAgfSlcbn0pIl19 +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQixJQUFPLElBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUM5QixJQUFZLFNBQVMsV0FBTSxXQUUzQixDQUFDLENBRnFDO0FB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gICAgICAgICAgICBOcG1jaUJ1aWxkRG9ja2VyLnJlYWREb2NrZXJmaWxlcygpXG4gICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24ocmVhZERvY2tlcmZpbGVzQXJyYXlBcmc6TnBtY2lCdWlsZERvY2tlci5Eb2NrZXJmaWxlW10pe1xuICAgICAgICAgICAgICAgICAgICByZWFkRG9ja2VyZmlsZXNBcnJheUFyZ1sxXS52ZXJzaW9uLnNob3VsZC5lcXVhbChcInNvbWV0YWcxXCIpO1xuICAgICAgICAgICAgICAgICAgICBzb3J0YWJsZUFycmF5ID0gcmVhZERvY2tlcmZpbGVzQXJyYXlBcmdcbiAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICB9KVxuICAgICAgICBpdChcInNob3VsZCBzb3J0IGFuIGFycmF5IG9mIERvY2tlcmZpbGVzXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICBOcG1jaUJ1aWxkRG9ja2VyLnNvcnREb2NrZXJmaWxlcyhzb3J0YWJsZUFycmF5KVxuICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uKHNvcnRlZEFycmF5QXJnOk5wbWNpQnVpbGREb2NrZXIuRG9ja2VyZmlsZVtdKXtcbiAgICAgICAgICAgICAgICAgICAgYmVhdXR5bG9nLnN1Y2Nlc3MoXCJmaW5hbCByZXN1bHRcIik7XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHNvcnRlZEFycmF5QXJnKTtcbiAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgIH0pXG4gICAgICAgIH0pXG4gICAgfSlcbn0pIl19 diff --git a/test/test.ts b/test/test.ts index ebc1f8f..1bfd8c5 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,6 +1,7 @@ import "typings-test"; import "should"; import path = require("path"); +import * as beautylog from "beautylog" //set up environment process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git"; process.cwd = () => { @@ -34,6 +35,7 @@ describe("NPMCI",function(){ it("should sort an array of Dockerfiles",function(done){ NpmciBuildDocker.sortDockerfiles(sortableArray) .then(function(sortedArrayArg:NpmciBuildDocker.Dockerfile[]){ + beautylog.success("final result"); console.log(sortedArrayArg); done(); }) diff --git a/ts/npmci.build.docker.ts b/ts/npmci.build.docker.ts index 2658790..3e412dc 100644 --- a/ts/npmci.build.docker.ts +++ b/ts/npmci.build.docker.ts @@ -1,7 +1,6 @@ import * as plugins from "./npmci.plugins" import * as NpmciEnv from "./npmci.env"; - export let build = function(){ let done = plugins.q.defer(); @@ -25,10 +24,12 @@ export let readDockerfiles = function(){ return done.promise; } -export let cleanTagsArrayFunction = function(dockerfileArrayArg:Dockerfile[]):string[]{ +export let cleanTagsArrayFunction = function(dockerfileArrayArg:Dockerfile[],trackingArrayArg:Dockerfile[]):string[]{ let cleanTagsArray:string[] = []; dockerfileArrayArg.forEach(function(dockerfileArg){ - cleanTagsArray.push(dockerfileArg.cleanTag); + if(trackingArrayArg.indexOf(dockerfileArg) == -1){ + cleanTagsArray.push(dockerfileArg.cleanTag); + } }); return cleanTagsArray; } @@ -36,20 +37,26 @@ export let cleanTagsArrayFunction = function(dockerfileArrayArg:Dockerfile[]):st export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]){ let done = plugins.q.defer(); let sortedArray:Dockerfile[] = []; + let trackingArray:Dockerfile[] = []; let sorterFunctionCounter:number = 0; + console.log(sortableArrayArg); + console.log(sortedArray); let sorterFunction = function(){ + plugins.beautylog.log("++++++++++++++++++++++++++++++++++++++++++++++"); console.log(sorterFunctionCounter); - let cleanTags = cleanTagsArrayFunction(sortableArrayArg); sortableArrayArg.forEach((dockerfileArg)=>{ - if(cleanTags.indexOf(dockerfileArg.baseImage) == -1){ - let dockerfileArgIndex = sortableArrayArg.indexOf(dockerfileArg); - sortableArrayArg.splice(dockerfileArgIndex,1); + console.log(dockerfileArg); + let cleanTags = cleanTagsArrayFunction(sortableArrayArg,trackingArray); + console.log(cleanTags); + if(cleanTags.indexOf(dockerfileArg.baseImage) == -1 && trackingArray.indexOf(dockerfileArg) == -1){ sortedArray.push(dockerfileArg); + trackingArray.push(dockerfileArg); } }); - if(sortableArrayArg.length == 0){ + plugins.beautylog.info(sortedArray.length.toString()); + if(sortableArrayArg.length == sortedArray.length){ done.resolve(sortedArray); - } else if (sorterFunctionCounter < 100) { + } else if (sorterFunctionCounter < 10) { sorterFunctionCounter++; sorterFunction(); };