Parcourir la source

Fixed Pull tasks for whole instance cases

master
AkshaThomas il y a 3 ans
Parent
révision
06cd7b6d43
1 fichiers modifiés avec 40 ajouts et 12 suppressions
  1. 40
    12
      index.js

+ 40
- 12
index.js Voir le fichier

@@ -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)
}
}

Chargement…
Annuler
Enregistrer