now sorting Dockerfiles correctly

This commit is contained in:
Philipp Kunz 2016-06-05 10:11:01 +02:00
parent 61720f47be
commit cb7cb852ea
4 changed files with 30 additions and 63 deletions

File diff suppressed because one or more lines are too long

4
dist/npmci.env.js vendored
View File

@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLDRCQUFzQixhQUFhLENBQUMsQ0FBQTtBQUd6QixZQUFJLEdBQUcsSUFBSSxxQkFBTyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDLENBQUM7QUFDekQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQyxDQUFDO0FBQ3ZDLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBSSxDQUFDLENBQUM7QUFLUCx3QkFBZ0IsR0FBZ0IsRUFBRSxDQUFDO0FBQ25DLG1CQUFXLEdBQWdCLEVBQUUsQ0FBQyIsImZpbGUiOiJucG1jaS5lbnYuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiO1xuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9ucG1jaS5wbHVnaW5zXCI7XG5pbXBvcnQge0dpdFJlcG99IGZyb20gXCJzbWFydHN0cmluZ1wiO1xuaW1wb3J0IHtEb2NrZXJmaWxlfSBmcm9tIFwiLi9ucG1jaS5idWlsZC5kb2NrZXJcIlxuXG5leH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4vbnBtY2kuYnVpbGQuZG9ja2VyXCJcblxuZXhwb3J0IGxldCByZXBvID0gbmV3IEdpdFJlcG8ocHJvY2Vzcy5lbnYuQ0lfQlVJTERfUkVQTyk7XG5leHBvcnQgbGV0IGRvY2tlclRlc3RUYWc6c3RyaW5nO1xuZXhwb3J0IGxldCBkb2NrZXJSZWxlYXNlVGFnOnN0cmluZztcblxuZXhwb3J0IGxldCBkb2NrZXJSZWdpc3RyeTsgLy8gd2lsbCBiZSBzZXQgYnkgbnBtY2kucHJlcGFyZVxuZXhwb3J0IGxldCBkb2NrZXJGaWxlc0J1aWx0OkRvY2tlcmZpbGVbXSA9IFtdO1xuZXhwb3J0IGxldCBkb2NrZXJGaWxlczpEb2NrZXJmaWxlW10gPSBbXTtcblxuIl19

View File

@ -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){
console.log("iteration: " + sortCounter.toString());
console.log(notYetBuiltImages)
let cleanTags = [];
NpmciEnv.dockerFiles.forEach(function(dockerfileArg){
cleanTags.push(dockerfileArg.cleanTag);
});
let aIndex = cleanTags.indexOf(a.cleanTag);
let bIndex = cleanTags.indexOf(b.baseImage);
console.log(cleanTags);
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;
console.log(b.cleanTag);
if(bIndex < aIndex && bIndex != -1){
return -1;
} else {
return 0
}
});
if(redoSort && sortCounter <= 50){
sortCounter++;
sortFunction();
} else {
done.resolve();
}
};
sortFunction();
return done.promise;
}

View File

@ -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;