Explorar el Código

Fixed Pull tasks for whole instance cases

master
AkshaThomas hace 3 años
padre
commit
06cd7b6d43
Se han modificado 1 ficheros con 40 adiciones y 12 borrados
  1. 40
    12
      index.js

+ 40
- 12
index.js Ver fichero

@@ -1693,19 +1693,47 @@ var elxr = {
}
, getpulltask(def){

// def can be an instance config
// Or an object with many repos and elevated repos
// Or a single repo ( Either Elevated or normal. )


def = (def ? (
def.requiresElevation = true,
def.reqularRepos = def.repos,
def.elevatedRepos = def.elevatedRunasRepos
// def.requiresElevation = true,
// def.repos = def.repos,
// def.elevatedRepos = def.elevatedRunasRepos,
def

) : false) || {
requiresElevation : true,
reqularRepos : gitRepos,
elevatedRepos : elevatedRunasRepos
repos : repomanifest.repos,
elevatedRepos : repomanifest.elevated
}

var elevatedpulltasks = null;
if(def.repo) {
// Single repo case.
if(def.repo.requiresElevation) {
elevatedpulltasks = function() {
return performPull(def.repo).then(() => {
return true;
}).catch((e) => {
console.error(e)
})
}
return
}
else {
var regularpulltasks = function(){
var pendingpulls = [];
pendingpulls.push(performPull(def.repo))
return Promise.all(pendingpulls).finally(Traq.finally)
}
}
if(elevatedpulltasks) return getTaskWithElevation( { elevatedpulltasks, regularpulltasks} )
else return getTaskWithoutElevation({ regularpulltasks})
}
console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`)
// console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`)
console.dir(def)

var env = Object.assign({}, process.env); // Shallow clone it.
@@ -1713,16 +1741,16 @@ var elxr = {

var useGitPull = processedArgs.useGitPull || false;

if(def.elevatedRepos || def.reqularRepos) {
if(def.elevatedRepos || def.repos) {
if(def.elevatedRepos) def.requiresElevation = true;
else delete def.requiresElevation;
}
else {
if(def.requiresElevation) def.elevatedRepos = [def]
else def.reqularRepos = [def]
else def.repos = [def]
}

var elevatedpulltasks = null;
var regularpulltasks = function(){ return Promise.resolve(true) }
if(def.elevatedRepos){
elevatedpulltasks = function() {
@@ -1733,10 +1761,10 @@ var elxr = {
})
}
}
if(def.reqularRepos) {
if(def.repos) {
var regularpulltasks = function(){
var pendingpulls = [];
def.reqularRepos.forEach((def) => { pendingpulls.push(performPull(def.repo)) })
def.repos.forEach((def) => { pendingpulls.push(performPull(def.repo)) })
return Promise.all(pendingpulls).finally(Traq.finally)
}
}

Cargando…
Cancelar
Guardar