From cb7cb852ea1bce254115040a93a98d19eb68d67a Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 5 Jun 2016 10:11:01 +0200 Subject: [PATCH] now sorting Dockerfiles correctly --- dist/npmci.build.docker.js | 46 +++++++++++++------------------------- dist/npmci.env.js | 4 +--- ts/npmci.build.docker.ts | 41 ++++++++++++--------------------- ts/npmci.env.ts | 2 -- 4 files changed, 30 insertions(+), 63 deletions(-) diff --git a/dist/npmci.build.docker.js b/dist/npmci.build.docker.js index 3ece2e3..323d504 100644 --- a/dist/npmci.build.docker.js +++ b/dist/npmci.build.docker.js @@ -24,40 +24,24 @@ var readDockerfiles = function () { }; var sortDockerfiles = function () { var done = plugins.q.defer(); - var redoSort; - var sortCounter = 0; - var sortFunction = function () { - redoSort = false; - var notYetBuiltImages = []; - NpmciEnv.dockerFiles.forEach(function (dockerFileArg) { - notYetBuiltImages.push(dockerFileArg.cleanTag); + NpmciEnv.dockerFiles.sort(function (a, b) { + var cleanTags = []; + NpmciEnv.dockerFiles.forEach(function (dockerfileArg) { + cleanTags.push(dockerfileArg.cleanTag); }); - NpmciEnv.dockerFiles.sort(function (a, b) { - console.log("iteration: " + sortCounter.toString()); - console.log(notYetBuiltImages); - console.log(a.cleanTag); - var aIndex = notYetBuiltImages.indexOf(a.cleanTag); - if (aIndex != -1) { - notYetBuiltImages.splice(aIndex, 1); - } - console.log(notYetBuiltImages); - if (notYetBuiltImages.indexOf(b.baseImage) != -1) { - redoSort = true; - return -1; - } - else { - return 0; - } - }); - if (redoSort && sortCounter <= 50) { - sortCounter++; - sortFunction(); + var aIndex = cleanTags.indexOf(a.cleanTag); + var bIndex = cleanTags.indexOf(b.baseImage); + console.log(cleanTags); + console.log(a.cleanTag); + console.log(b.cleanTag); + if (bIndex < aIndex && bIndex != -1) { + return -1; } else { - done.resolve(); + return 0; } - }; - sortFunction(); + }); + done.resolve(); return done.promise; }; var buildDockerfiles = function () { @@ -136,4 +120,4 @@ exports.dockerTag = function (repoArg, vers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4ICE9IC0xKXtub3RZZXRCdWlsdEltYWdlcy5zcGxpY2UoYUluZGV4LDEpfVxuICAgICAgICAgICAgY29uc29sZS5sb2cobm90WWV0QnVpbHRJbWFnZXMpO1xuICAgICAgICAgICAgaWYobm90WWV0QnVpbHRJbWFnZXMuaW5kZXhPZihiLmJhc2VJbWFnZSkgIT0gLTEpe1xuICAgICAgICAgICAgICAgIHJlZG9Tb3J0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICByZXR1cm4gLTE7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiAwXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBpZihyZWRvU29ydCAmJiBzb3J0Q291bnRlciA8PSA1MCl7XG4gICAgICAgICAgICBzb3J0Q291bnRlcisrO1xuICAgICAgICAgICAgc29ydEZ1bmN0aW9uKCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBkb25lLnJlc29sdmUoKTtcbiAgICAgICAgfVxuICAgIH07XG4gICAgc29ydEZ1bmN0aW9uKCk7XG4gICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbn1cblxubGV0IGJ1aWxkRG9ja2VyZmlsZXMgPSBmdW5jdGlvbigpe1xuICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgTnBtY2lFbnYuZG9ja2VyRmlsZXMuZm9yRWFjaChmdW5jdGlvbihkb2NrZXJmaWxlQXJnKXtcbiAgICAgICAgZG9ja2VyZmlsZUFyZy5idWlsZCgpO1xuICAgIH0pXG4gICAgZG9uZS5yZXNvbHZlKCk7XG4gICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbn1cblxuZXhwb3J0IGNsYXNzIERvY2tlcmZpbGUge1xuICAgIGZpbGVQYXRoOnN0cmluZztcbiAgICByZXBvOnN0cmluZztcbiAgICB2ZXJzaW9uOnN0cmluZztcbiAgICBjbGVhblRhZzpzdHJpbmc7XG4gICAgY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c2VJbWFnZVJlZ2V4ID0gL0ZST01cXHMoW2EtekEtejAtOVxcL1xcLVxcOl0qKVxcbi9cbiAgICBsZXQgcmVnZXhSZXN1bHRBcnJheSA9IGJhc2VJbWFnZVJlZ2V4LmV4ZWMoZG9ja2VyZmlsZUNvbnRlbnRBcmcpXG4gICAgcmV0dXJuIHJlZ2V4UmVzdWx0QXJyYXlbMV07XG59XG5cbmV4cG9ydCBsZXQgZG9ja2VyVGFnID0gZnVuY3Rpb24ocmVwb0FyZzpzdHJpbmcsdmVyc2lvbkFyZzpzdHJpbmcpOnN0cmluZ3tcbiAgICBsZXQgdGFnU3RyaW5nOnN0cmluZztcbiAgICBsZXQgcmVnaXN0cnkgPSBOcG1jaUVudi5kb2NrZXJSZWdpc3RyeTtcbiAgICBpZihwcm9jZXNzLmVudi5DSV9CVUlMRF9TVEFHRSA9PSBcInRlc3RcIil7XG4gICAgICAgIHJlZ2lzdHJ5ID0gXCJyZWdpc3RyeS5naXRsYWIuY29tXCI7XG4gICAgfSBcbiAgICBsZXQgcmVwbyA9IHJlcG9Bcmc7XG4gICAgbGV0IHZlcnNpb24gPSB2ZXJzaW9uQXJnO1xuICAgIGlmKHByb2Nlc3MuZW52LkNJX0JVSUxEX1NUQUdFID09IFwidGVzdFwiIHx8IHByb2Nlc3MuZW52LkNJX0JVSUxEX1NUQUdFID09IFwiYnVpbGRcIil7XG4gICAgICAgIHZlcnNpb24gPSB2ZXJzaW9uICsgXCJfdGVzdFwiO1xuICAgIH1cbiAgICB0YWdTdHJpbmcgPSByZWdpc3RyeSArIFwiL1wiICsgcmVwbyArIFwiOlwiICsgdmVyc2lvbjtcbiAgICByZXR1cm4gdGFnU3RyaW5nO1xufTtcbiJdfQ== diff --git a/dist/npmci.env.js b/dist/npmci.env.js index 8ec086e..0f2ee64 100644 --- a/dist/npmci.env.js +++ b/dist/npmci.env.js @@ -2,9 +2,7 @@ require("typings-global"); var smartstring_1 = require("smartstring"); exports.repo = new smartstring_1.GitRepo(process.env.CI_BUILD_REPO); -console.log(process.env.CI_BUILD_REPO); -console.log(exports.repo); exports.dockerFilesBuilt = []; exports.dockerFiles = []; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLDRCQUFzQixhQUFhLENBQUMsQ0FBQTtBQUd6QixZQUFJLEdBQUcsSUFBSSxxQkFBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDLENBQUM7QUFDekQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQyxDQUFDO0FBQ3ZDLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBSSxDQUFDLENBQUM7QUFLUCx3QkFBZ0IsR0FBZ0IsRUFBRSxDQUFDO0FBQ25DLG1CQUFXLEdBQWdCLEVBQUUsQ0FBQyIsImZpbGUiOiJucG1jaS5lbnYuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiO1xuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9ucG1jaS5wbHVnaW5zXCI7XG5pbXBvcnQge0dpdFJlcG99IGZyb20gXCJzbWFydHN0cmluZ1wiO1xuaW1wb3J0IHtEb2NrZXJmaWxlfSBmcm9tIFwiLi9ucG1jaS5idWlsZC5kb2NrZXJcIlxuXG5leHBvcnQgbGV0IHJlcG8gPSBuZXcgR2l0UmVwbyhwcm9jZXNzLmVudi5DSV9CVUlMRF9SRVBPKTtcbmNvbnNvbGUubG9nKHByb2Nlc3MuZW52LkNJX0JVSUxEX1JFUE8pO1xuY29uc29sZS5sb2cocmVwbyk7XG5leHBvcnQgbGV0IGRvY2tlclRlc3RUYWc6c3RyaW5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OnN0cmluZztcblxuZXhwb3J0IGxldCBkb2NrZXJSZWdpc3RyeTsgLy8gd2lsbCBiZSBzZXQgYnkgbnBtY2kucHJlcGFyZVxuZXhwb3J0IGxldCBkb2NrZXJGaWxlc0J1aWx0OkRvY2tlcmZpbGVbXSA9IFtdO1xuZXhwb3J0IGxldCBkb2NrZXJGaWxlczpEb2NrZXJmaWxlW10gPSBbXTtcblxuIl19 diff --git a/ts/npmci.build.docker.ts b/ts/npmci.build.docker.ts index deb3b4f..dfa0594 100644 --- a/ts/npmci.build.docker.ts +++ b/ts/npmci.build.docker.ts @@ -29,36 +29,23 @@ let readDockerfiles = function(){ let sortDockerfiles = function(){ let done = plugins.q.defer(); - let redoSort:boolean; - let sortCounter:number = 0; - let sortFunction = function(){ - redoSort = false; - let notYetBuiltImages:string[] = []; - NpmciEnv.dockerFiles.forEach((dockerFileArg)=>{ - notYetBuiltImages.push(dockerFileArg.cleanTag); + NpmciEnv.dockerFiles.sort(function(a,b){ + let cleanTags = []; + NpmciEnv.dockerFiles.forEach(function(dockerfileArg){ + cleanTags.push(dockerfileArg.cleanTag); }); - NpmciEnv.dockerFiles.sort(function(a,b){ - console.log("iteration: " + sortCounter.toString()); - console.log(notYetBuiltImages) - console.log(a.cleanTag); - let aIndex = notYetBuiltImages.indexOf(a.cleanTag); - if(aIndex != -1){notYetBuiltImages.splice(aIndex,1)} - console.log(notYetBuiltImages); - if(notYetBuiltImages.indexOf(b.baseImage) != -1){ - redoSort = true; - return -1; - } else { - return 0 - } - }); - if(redoSort && sortCounter <= 50){ - sortCounter++; - sortFunction(); + let aIndex = cleanTags.indexOf(a.cleanTag); + let bIndex = cleanTags.indexOf(b.baseImage); + console.log(cleanTags); + console.log(a.cleanTag); + console.log(b.cleanTag); + if(bIndex < aIndex && bIndex != -1){ + return -1; } else { - done.resolve(); + return 0 } - }; - sortFunction(); + }); + done.resolve(); return done.promise; } diff --git a/ts/npmci.env.ts b/ts/npmci.env.ts index c6f4fc5..c6e7500 100644 --- a/ts/npmci.env.ts +++ b/ts/npmci.env.ts @@ -4,8 +4,6 @@ import {GitRepo} from "smartstring"; import {Dockerfile} from "./npmci.build.docker" export let repo = new GitRepo(process.env.CI_BUILD_REPO); -console.log(process.env.CI_BUILD_REPO); -console.log(repo); export let dockerTestTag:string; export let dockerReleaseTag:string;