fix(core): update

This commit is contained in:
Philipp Kunz 2024-05-23 21:47:06 +02:00
parent 7eeca992b0
commit dc809a6023
4 changed files with 27 additions and 31 deletions

View File

@ -0,0 +1,2 @@
FROM mygroup/myrepo:sometag2
RUN apt-get update

View File

@ -19,26 +19,20 @@ process.cwd = () => {
return path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), 'assets/'); return path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), 'assets/');
}; };
let npmci: typeof import('../ts/index.js'); import type * as npmciTypes from '../ts/index.js';
const npmci = await import('../ts/index.js');
type TNpmciTypes = typeof import('../ts/index.js');
tap.preTask('should import npmci', async () => {
npmci = await import('../ts/index.js');
});
// ====== // ======
// Docker // Docker
// ====== // ======
let dockerfile1: npmci.Dockerfile; let dockerfile1: npmciTypes.Dockerfile;
let dockerfile2: npmci.Dockerfile; let dockerfile2: npmciTypes.Dockerfile;
let sortableArray: npmci.Dockerfile[]; let sortableArray: npmciTypes.Dockerfile[];
tap.test('should return valid Dockerfiles', async () => { tap.test('should return valid Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start(); await npmciInstance.start();
await npmciInstance.start();
dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, { dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, {
filePath: './Dockerfile', filePath: './Dockerfile',
read: true, read: true,
@ -55,7 +49,7 @@ tap.test('should read a directory of Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci(); const npmciInstance = new npmci.Npmci();
await npmciInstance.start(); await npmciInstance.start();
return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then( return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then(
async (readDockerfilesArrayArg: npmci.Dockerfile[]) => { async (readDockerfilesArrayArg: npmciTypes.Dockerfile[]) => {
sortableArray = readDockerfilesArrayArg; sortableArray = readDockerfilesArrayArg;
return expect(readDockerfilesArrayArg[1].version).toEqual('sometag1'); return expect(readDockerfilesArrayArg[1].version).toEqual('sometag1');
} }
@ -64,7 +58,7 @@ tap.test('should read a directory of Dockerfiles', async () => {
tap.test('should sort an array of Dockerfiles', async () => { tap.test('should sort an array of Dockerfiles', async () => {
return npmci.Dockerfile.sortDockerfiles(sortableArray).then( return npmci.Dockerfile.sortDockerfiles(sortableArray).then(
async (sortedArrayArg: npmci.Dockerfile[]) => { async (sortedArrayArg: npmciTypes.Dockerfile[]) => {
console.log(sortedArrayArg); console.log(sortedArrayArg);
} }
); );

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@ship.zone/npmci', name: '@ship.zone/npmci',
version: '4.1.28', version: '4.1.29',
description: 'node and docker in gitlab ci on steroids' description: 'node and docker in gitlab ci on steroids'
} }

View File

@ -120,9 +120,9 @@ export class Dockerfile {
* returns a version for a docker file * returns a version for a docker file
* @execution SYNC * @execution SYNC
*/ */
public static dockerFileVersion(dockerfileInstanceArg: Dockerfile, dockerfileNameArg: string): string { public static dockerFileVersion(dockerfileInstanceArg: Dockerfile, dockerfileNameArg: string): string {
let versionString: string; let versionString: string;
const versionRegex = /Dockerfile_([^:_]*)$/; const versionRegex = /Dockerfile_(.+)$/;
const regexResultArray = versionRegex.exec(dockerfileNameArg); const regexResultArray = versionRegex.exec(dockerfileNameArg);
if (regexResultArray && regexResultArray.length === 2) { if (regexResultArray && regexResultArray.length === 2) {
versionString = regexResultArray[1]; versionString = regexResultArray[1];
@ -134,7 +134,7 @@ export class Dockerfile {
dockerfileInstanceArg.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version dockerfileInstanceArg.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version
); );
return versionString; return versionString;
} }
/** /**
* returns the docker base image for a Dockerfile * returns the docker base image for a Dockerfile