diff --git a/test/test.ts b/test/test.ts index f1b1b32..d4f45c3 100644 --- a/test/test.ts +++ b/test/test.ts @@ -21,6 +21,8 @@ process.cwd = () => { let npmci: typeof import('../ts/index.js'); +type TNpmciTypes = typeof import('../ts/index.js'); + tap.preTask('should import npmci', async () => { npmci = await import('../ts/index.js'); }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 9aa5d10..66f50d0 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@shipzone/npmci', - version: '4.1.9', + version: '4.1.10', description: 'node and docker in gitlab ci on steroids' } diff --git a/ts/manager.docker/index.ts b/ts/manager.docker/index.ts index 0721a4a..34b7510 100644 --- a/ts/manager.docker/index.ts +++ b/ts/manager.docker/index.ts @@ -77,17 +77,20 @@ export class NpmciDockerManager { */ public prepare = async () => { // Always login to GitLab Registry - if (!process.env.CI_JOB_TOKEN || process.env.CI_JOB_TOKEN === '') { - logger.log('error', 'No registry token specified by gitlab!'); - process.exit(1); + if (process.env.GITLAB_CI) { + console.log('gitlab ci detected'); + if (!process.env.CI_JOB_TOKEN || process.env.CI_JOB_TOKEN === '') { + logger.log('error', 'Running in Gitlab CI, but no registry token specified by gitlab!'); + process.exit(1); + } + this.npmciRegistryStorage.addRegistry( + new DockerRegistry({ + registryUrl: 'registry.gitlab.com', + username: 'gitlab-ci-token', + password: process.env.CI_JOB_TOKEN, + }) + ); } - this.npmciRegistryStorage.addRegistry( - new DockerRegistry({ - registryUrl: 'registry.gitlab.com', - username: 'gitlab-ci-token', - password: process.env.CI_JOB_TOKEN, - }) - ); // handle registries await plugins.smartparam.forEachMinimatch(