now working correctly and async

This commit is contained in:
2017-08-28 01:35:21 +02:00
parent 71c30e7563
commit 563414882e
9 changed files with 41 additions and 18 deletions

View File

@ -72,7 +72,7 @@ export let prepare = async () => {
// Always login to GitLab Registry
if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
plugins.beautylog.error('No registry token specified by gitlab!')
return
process.exit(1)
}
npmciRegistryStorage.addRegistry(new DockerRegistry({
registryUrl: 'registry.gitlab.com',
@ -81,7 +81,7 @@ export let prepare = async () => {
}))
// handle registries
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => {
await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => {
npmciRegistryStorage.addRegistry(
DockerRegistry.fromEnvString(envString)
)

View File

@ -15,6 +15,7 @@ export class DockerRegistry {
this.registryUrl = optionsArg.registryUrl
this.username = optionsArg.username
this.password = optionsArg.password
plugins.beautylog.info(`created DockerRegistry for ${this.registryUrl}`)
}
static fromEnvString (envString: string): DockerRegistry {
@ -41,6 +42,6 @@ export class DockerRegistry {
} else {
await bash(`docker login -u ${this.username} -p ${this.password} ${this.registryUrl}`)
}
plugins.beautylog.success(`docker authenticated for ${this.registryUrl}!`)
plugins.beautylog.ok(`docker authenticated for ${this.registryUrl}!`)
}
}

View File

@ -23,5 +23,6 @@ export class RegistryStorage {
await this.objectMap.forEach(async registryArg => {
await registryArg.login()
})
plugins.beautylog.success('logged in successfully into all available DockerRegistries!')
}
}