fix async loop execution
This commit is contained in:
@ -72,6 +72,7 @@ export let bash = async (commandArg: string, retryArg: number = 2, bareArg: bool
|
||||
}
|
||||
} else {
|
||||
plugins.beautylog.log('ShellExec would be: ' + commandArg)
|
||||
await plugins.smartdelay.delayFor(100)
|
||||
execResult = {
|
||||
exitCode: 0,
|
||||
stdout: 'testOutput'
|
||||
@ -83,7 +84,7 @@ export let bash = async (commandArg: string, retryArg: number = 2, bareArg: bool
|
||||
/**
|
||||
* bashBare allows usage of bash without sourcing any files like nvm
|
||||
*/
|
||||
export let bashBare = async(commandArg: string, retryArg: number = 2): Promise<string> => {
|
||||
export let bashBare = async (commandArg: string, retryArg: number = 2): Promise<string> => {
|
||||
return await bash(commandArg, retryArg, true)
|
||||
}
|
||||
|
||||
|
@ -86,9 +86,9 @@ export let mapDockerfiles = async (sortedArray: Dockerfile[]): Promise<Dockerfil
|
||||
* builds the correspoding real docker image for each Dockerfile class instance
|
||||
*/
|
||||
export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
sortedArrayArg.forEach(async function (dockerfileArg) {
|
||||
for (let dockerfileArg of sortedArrayArg) {
|
||||
await dockerfileArg.build()
|
||||
})
|
||||
}
|
||||
return sortedArrayArg
|
||||
}
|
||||
|
||||
@ -96,9 +96,9 @@ export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
* pushes the real Dockerfile images to a Docker registry
|
||||
*/
|
||||
export let pushDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
sortedArrayArg.forEach(async (dockerfileArg) => {
|
||||
for (let dockerfileArg of sortedArrayArg) {
|
||||
await dockerfileArg.push(NpmciEnv.buildStage)
|
||||
})
|
||||
}
|
||||
return sortedArrayArg
|
||||
}
|
||||
|
||||
@ -107,9 +107,9 @@ export let pushDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
* This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages.
|
||||
*/
|
||||
export let pullDockerfileImages = async (sortableArrayArg: Dockerfile[], registryArg = 'registry.gitlab.com') => {
|
||||
sortableArrayArg.forEach(async (dockerfileArg) => {
|
||||
for (let dockerfileArg of sortableArrayArg) {
|
||||
await dockerfileArg.pull(registryArg)
|
||||
})
|
||||
}
|
||||
return sortableArrayArg
|
||||
}
|
||||
|
||||
@ -118,9 +118,9 @@ export let pullDockerfileImages = async (sortableArrayArg: Dockerfile[], registr
|
||||
* @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd
|
||||
*/
|
||||
export let testDockerfiles = async (sortedArrayArg: Dockerfile[]) => {
|
||||
sortedArrayArg.forEach(async (dockerfileArg) => {
|
||||
for (let dockerfileArg of sortedArrayArg) {
|
||||
await dockerfileArg.test()
|
||||
})
|
||||
}
|
||||
return sortedArrayArg
|
||||
}
|
||||
|
||||
@ -163,6 +163,7 @@ export class Dockerfile {
|
||||
plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag)
|
||||
await bashBare('docker build -t ' + this.buildTag + ' -f ' + this.filePath + ' .')
|
||||
NpmciEnv.dockerFilesBuilt.push(this)
|
||||
return
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ export import projectinfo = require('projectinfo')
|
||||
export import q = require('smartq')
|
||||
export let request = require('request')
|
||||
export import smartcli = require('smartcli')
|
||||
export import smartdelay = require('smartdelay')
|
||||
export import smartfile = require('smartfile')
|
||||
export import shelljs = require('shelljs')
|
||||
export import smartparam = require('smartparam')
|
||||
|
Reference in New Issue
Block a user