now working correctly and async
This commit is contained in:
@ -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)
|
||||
)
|
||||
|
@ -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}!`)
|
||||
}
|
||||
}
|
||||
|
@ -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!')
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user