Compare commits
	
		
			14 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 838f2d6959 | |||
| 0d42e5f6eb | |||
| f96de8cdc3 | |||
| 965833916f | |||
| 81ec1391e3 | |||
| bbbca44640 | |||
| 7ba7dc54a1 | |||
| 4f98eeec2a | |||
| 419a6b9e5f | |||
| 9c040c34f5 | |||
| 50d3f2d795 | |||
| 305856b9e1 | |||
| 3683743f3c | |||
| 41237e0e5f | 
| @@ -12,10 +12,10 @@ | ||||
|     "projectType": "npm", | ||||
|     "module": { | ||||
|       "githost": "gitlab.com", | ||||
|       "gitscope": "shipzone", | ||||
|       "gitscope": "ship.zone", | ||||
|       "gitrepo": "npmci", | ||||
|       "description": "node and docker in gitlab ci on steroids", | ||||
|       "npmPackagename": "@shipzone/npmci", | ||||
|       "npmPackagename": "@ship.zone/npmci", | ||||
|       "license": "MIT" | ||||
|     } | ||||
|   } | ||||
|   | ||||
							
								
								
									
										54
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "@shipzone/npmci", | ||||
|   "version": "4.1.20", | ||||
|   "name": "@ship.zone/npmci", | ||||
|   "version": "4.1.27", | ||||
|   "private": false, | ||||
|   "description": "node and docker in gitlab ci on steroids", | ||||
|   "main": "dist_ts/index.js", | ||||
| @@ -27,33 +27,33 @@ | ||||
|   "homepage": "https://gitlab.com/gitzone/npmci#README", | ||||
|   "devDependencies": { | ||||
|     "@gitzone/tsbuild": "^2.1.66", | ||||
|     "@gitzone/tsrun": "^1.2.42", | ||||
|     "@gitzone/tstest": "^1.0.74", | ||||
|     "@pushrocks/tapbundle": "^5.0.8", | ||||
|     "@types/node": "^20.3.1" | ||||
|     "@gitzone/tsrun": "^1.2.44", | ||||
|     "@gitzone/tstest": "^1.0.77", | ||||
|     "@push.rocks/tapbundle": "^5.0.15", | ||||
|     "@types/node": "^20.5.4" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@apiglobal/typedrequest": "^2.0.12", | ||||
|     "@pushrocks/lik": "^6.0.2", | ||||
|     "@pushrocks/npmextra": "^3.0.9", | ||||
|     "@pushrocks/projectinfo": "^5.0.1", | ||||
|     "@pushrocks/qenv": "^5.0.2", | ||||
|     "@pushrocks/smartanalytics": "^2.0.15", | ||||
|     "@pushrocks/smartcli": "^4.0.6", | ||||
|     "@pushrocks/smartdelay": "^3.0.1", | ||||
|     "@pushrocks/smartenv": "^5.0.5", | ||||
|     "@pushrocks/smartfile": "^10.0.25", | ||||
|     "@pushrocks/smartgit": "^3.0.0", | ||||
|     "@pushrocks/smartlog": "^3.0.2", | ||||
|     "@pushrocks/smartlog-destination-local": "^9.0.0", | ||||
|     "@pushrocks/smartparam": "^1.1.6", | ||||
|     "@pushrocks/smartpath": "^5.0.5", | ||||
|     "@pushrocks/smartpromise": "^4.0.2", | ||||
|     "@pushrocks/smartrequest": "^2.0.15", | ||||
|     "@pushrocks/smartshell": "^3.0.3", | ||||
|     "@pushrocks/smartsocket": "^2.0.19", | ||||
|     "@pushrocks/smartssh": "^2.0.0", | ||||
|     "@pushrocks/smartstring": "^4.0.7", | ||||
|     "@api.global/typedrequest": "^3.0.1", | ||||
|     "@push.rocks/lik": "^6.0.5", | ||||
|     "@push.rocks/npmextra": "^4.0.0", | ||||
|     "@push.rocks/projectinfo": "^5.0.2", | ||||
|     "@push.rocks/qenv": "^6.0.2", | ||||
|     "@push.rocks/smartanalytics": "^2.0.15", | ||||
|     "@push.rocks/smartcli": "^4.0.8", | ||||
|     "@push.rocks/smartdelay": "^3.0.5", | ||||
|     "@push.rocks/smartenv": "^5.0.5", | ||||
|     "@push.rocks/smartfile": "^10.0.30", | ||||
|     "@push.rocks/smartgit": "^3.0.1", | ||||
|     "@push.rocks/smartlog": "^3.0.3", | ||||
|     "@push.rocks/smartlog-destination-local": "^9.0.0", | ||||
|     "@push.rocks/smartobject": "^1.0.12", | ||||
|     "@push.rocks/smartpath": "^5.0.11", | ||||
|     "@push.rocks/smartpromise": "^4.0.2", | ||||
|     "@push.rocks/smartrequest": "^2.0.18", | ||||
|     "@push.rocks/smartshell": "^3.0.3", | ||||
|     "@push.rocks/smartsocket": "^2.0.22", | ||||
|     "@push.rocks/smartssh": "^2.0.1", | ||||
|     "@push.rocks/smartstring": "^4.0.8", | ||||
|     "@servezone/interfaces": "^1.0.3", | ||||
|     "@tsclass/tsclass": "^4.0.42", | ||||
|     "@types/through2": "^2.0.38", | ||||
|   | ||||
							
								
								
									
										2292
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2292
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,5 +1,5 @@ | ||||
| process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; | ||||
| import { tap, expect } from '@pushrocks/tapbundle'; | ||||
| import { tap, expect } from '@push.rocks/tapbundle'; | ||||
|  | ||||
| import * as cloudlyConnectorMod from '../ts/connector.cloudly/cloudlyconnector.js'; | ||||
|  | ||||
|   | ||||
							
								
								
									
										12
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| import { tap, expect } from '@pushrocks/tapbundle'; | ||||
| import { tap, expect } from '@push.rocks/tapbundle'; | ||||
| import * as path from 'path'; | ||||
| import * as smartpath from '@pushrocks/smartpath'; | ||||
| import * as smartpath from '@push.rocks/smartpath'; | ||||
|  | ||||
| process.env.NPMTS_TEST = 'true'; | ||||
| process.env.NPMCI_URL_CLOUDLY = 'localhost'; | ||||
| @@ -37,6 +37,8 @@ let sortableArray: npmci.Dockerfile[]; | ||||
|  | ||||
| tap.test('should return valid Dockerfiles', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   await npmciInstance.start(); | ||||
|   dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, { | ||||
|     filePath: './Dockerfile', | ||||
|     read: true, | ||||
| @@ -51,6 +53,7 @@ tap.test('should return valid Dockerfiles', async () => { | ||||
|  | ||||
| tap.test('should read a directory of Dockerfiles', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then( | ||||
|     async (readDockerfilesArrayArg: npmci.Dockerfile[]) => { | ||||
|       sortableArray = readDockerfilesArrayArg; | ||||
| @@ -69,6 +72,7 @@ tap.test('should sort an array of Dockerfiles', async () => { | ||||
|  | ||||
| tap.test('should build all Dockerfiles', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   return npmciInstance.dockerManager.handleCli({ | ||||
|     _: ['docker', 'build'], | ||||
|   }); | ||||
| @@ -76,6 +80,7 @@ tap.test('should build all Dockerfiles', async () => { | ||||
|  | ||||
| tap.test('should test all Dockerfiles', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   return npmciInstance.dockerManager.handleCli({ | ||||
|     _: ['docker', 'test'], | ||||
|   }); | ||||
| @@ -83,6 +88,7 @@ tap.test('should test all Dockerfiles', async () => { | ||||
|  | ||||
| tap.test('should test dockerfiles', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   return npmciInstance.dockerManager.handleCli({ | ||||
|     _: ['docker', 'test'], | ||||
|   }); | ||||
| @@ -90,6 +96,7 @@ tap.test('should test dockerfiles', async () => { | ||||
|  | ||||
| tap.test('should login docker daemon', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   return npmciInstance.dockerManager.handleCli({ | ||||
|     _: ['docker', 'login'], | ||||
|   }); | ||||
| @@ -110,6 +117,7 @@ tap.test('should prepare SSH keys', async () => { | ||||
| // ==== | ||||
| tap.test('should install a certain version of node', async () => { | ||||
|   const npmciInstance = new npmci.Npmci(); | ||||
|   await npmciInstance.start(); | ||||
|   await npmciInstance.nodejsManager.handleCli({ | ||||
|     _: ['node', 'install', 'stable'], | ||||
|   }); | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * autocreated commitinfo by @pushrocks/commitinfo | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@shipzone/npmci', | ||||
|   version: '4.1.20', | ||||
|   name: '@ship.zone/npmci', | ||||
|   version: '4.1.27', | ||||
|   description: 'node and docker in gitlab ci on steroids' | ||||
| } | ||||
|   | ||||
| @@ -6,5 +6,5 @@ export const npmciInstance = new Npmci(); | ||||
| export { Dockerfile, Npmci }; | ||||
|  | ||||
| export const runCli = async () => { | ||||
|   npmciInstance.start(); | ||||
|   await npmciInstance.start(); | ||||
| }; | ||||
|   | ||||
| @@ -93,7 +93,7 @@ export class NpmciDockerManager { | ||||
|     } | ||||
|  | ||||
|     // handle registries | ||||
|     await plugins.smartparam.forEachMinimatch( | ||||
|     await plugins.smartobject.forEachMinimatch( | ||||
|       process.env, | ||||
|       'NPMCI_LOGIN_DOCKER*', | ||||
|       async (envString: string) => { | ||||
|   | ||||
| @@ -1,11 +1,10 @@ | ||||
| import { logger } from '../npmci.logging.js'; | ||||
| import * as plugins from './mod.plugins.js'; | ||||
| import { ObjectMap } from '@pushrocks/lik'; | ||||
|  | ||||
| import { DockerRegistry } from './mod.classes.dockerregistry.js'; | ||||
|  | ||||
| export class RegistryStorage { | ||||
|   objectMap = new ObjectMap<DockerRegistry>(); | ||||
|   objectMap = new plugins.lik.ObjectMap<DockerRegistry>(); | ||||
|   constructor() { | ||||
|     // Nothing here | ||||
|   } | ||||
|   | ||||
| @@ -54,7 +54,7 @@ export class NpmciNpmManager { | ||||
|   public async prepare() { | ||||
|     const config = this.npmciRef.npmciConfig.getConfig(); | ||||
|     let npmrcFileString: string = ''; | ||||
|     await plugins.smartparam.forEachMinimatch( | ||||
|     await plugins.smartobject.forEachMinimatch( | ||||
|       process.env, | ||||
|       'NPMCI_TOKEN_NPM*', | ||||
|       (npmEnvArg: string) => { | ||||
| @@ -100,7 +100,7 @@ export class NpmciNpmManager { | ||||
|       let publishVerdaccioAsWell = false; | ||||
|       const config = this.npmciRef.npmciConfig.getConfig(); | ||||
|       const availableRegistries: string[] = []; | ||||
|       await plugins.smartparam.forEachMinimatch( | ||||
|       await plugins.smartobject.forEachMinimatch( | ||||
|         process.env, | ||||
|         'NPMCI_TOKEN_NPM*', | ||||
|         (npmEnvArg: string) => { | ||||
|   | ||||
| @@ -31,7 +31,7 @@ const notUndefined = (stringArg: string) => { | ||||
|  */ | ||||
| export let prepare = async () => { | ||||
|   sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance | ||||
|   plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv); | ||||
|   plugins.smartobject.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv); | ||||
|   if (!process.env.NPMTS_TEST) { | ||||
|     sshInstance.writeToDisk(); | ||||
|   } else { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ const triggerValueRegex = | ||||
|  | ||||
| export let trigger = async () => { | ||||
|   logger.log('info', 'now running triggers'); | ||||
|   await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger); | ||||
|   await plugins.smartobject.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger); | ||||
| }; | ||||
|  | ||||
| const evaluateTrigger = async (triggerEnvVarArg) => { | ||||
|   | ||||
| @@ -2,12 +2,10 @@ import { logger } from './npmci.logging.js'; | ||||
| import * as plugins from './npmci.plugins.js'; | ||||
| import * as paths from './npmci.paths.js'; | ||||
|  | ||||
| import * as smartpromise from '@pushrocks/smartpromise'; | ||||
|  | ||||
| /** | ||||
|  * wether nvm is available or not | ||||
|  */ | ||||
| export let nvmAvailable = smartpromise.defer<boolean>(); | ||||
| export let nvmAvailable = plugins.smartpromise.defer<boolean>(); | ||||
| /** | ||||
|  * the smartshell instance for npmci | ||||
|  */ | ||||
|   | ||||
| @@ -39,11 +39,16 @@ export class Npmci { | ||||
|       projectId: 'gitzone', | ||||
|       appName: 'npmci', | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   public async start() { | ||||
|     this.cloudlyConnector = new CloudlyConnector(this); | ||||
|     this.npmciEnv = new NpmciEnv(this); | ||||
|     this.npmciInfo = new NpmciInfo(this); | ||||
|     await this.npmciInfo.printToConsole(); | ||||
|     this.npmciCli = new NpmciCli(this); | ||||
|     this.npmciConfig = new NpmciConfig(this); | ||||
|     await this.npmciConfig.init(); | ||||
|  | ||||
|     // managers | ||||
|     this.cloudronManager = new NpmciCloudronManager(this); | ||||
| @@ -51,11 +56,6 @@ export class Npmci { | ||||
|     this.gitManager = new NpmciGitManager(this); | ||||
|     this.nodejsManager = new NpmciNodeJsManager(this); | ||||
|     this.npmManager = new NpmciNpmManager(this); | ||||
|   } | ||||
|  | ||||
|   public async start() { | ||||
|     await this.npmciInfo.printToConsole(); | ||||
|     await this.npmciConfig.init(); | ||||
|     this.npmciCli.startParse(); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -44,10 +44,12 @@ export class NpmciConfig { | ||||
|  | ||||
|   constructor(npmciRefArg: Npmci) { | ||||
|     this.npmciRef = npmciRefArg; | ||||
|   } | ||||
|  | ||||
|   public async init() { | ||||
|     this.npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); | ||||
|     this.kvStorage = new plugins.npmextra.KeyValueStore( | ||||
|       'custom', | ||||
|       'userHomeDir', | ||||
|       `${this.npmciRef.npmciEnv.repo.user}_${this.npmciRef.npmciEnv.repo.repo}` | ||||
|     ); | ||||
|     this.npmciQenv = new plugins.qenv.Qenv( | ||||
| @@ -65,11 +67,8 @@ export class NpmciConfig { | ||||
|       npmRegistryUrl: 'registry.npmjs.org', | ||||
|       gitlabRunnerTags: [], | ||||
|       dockerBuildargEnvMap: {}, | ||||
|       urlCloudly: this.npmciQenv.getEnvVarOnDemand('NPMCI_URL_CLOUDLY'), | ||||
|       urlCloudly: await this.npmciQenv.getEnvVarOnDemand('NPMCI_URL_CLOUDLY'), | ||||
|     }; | ||||
|   } | ||||
|  | ||||
|   public async init() { | ||||
|     this.configObject = this.npmciNpmextra.dataFor<INpmciOptions>('npmci', this.configObject); | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -11,7 +11,7 @@ export class NpmciInfo { | ||||
|     this.npmciRef = npmciArg; | ||||
|   } | ||||
|  | ||||
|   public printToConsole() { | ||||
|     logger.log('info', `npmci version: ${this.projectInfo.version}`); | ||||
|   public async printToConsole() { | ||||
|     await logger.log('info', `npmci version: ${this.projectInfo.version}`); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import * as path from 'path'; | ||||
| export { path }; | ||||
|  | ||||
| // @apiglobal | ||||
| import * as typedrequest from '@apiglobal/typedrequest'; | ||||
| import * as typedrequest from '@api.global/typedrequest'; | ||||
|  | ||||
| export { typedrequest }; | ||||
|  | ||||
| @@ -13,27 +13,29 @@ import * as servezoneInterfaces from '@servezone/interfaces'; | ||||
|  | ||||
| export { servezoneInterfaces }; | ||||
|  | ||||
| // @pushrocks | ||||
| import * as npmextra from '@pushrocks/npmextra'; | ||||
| import * as projectinfo from '@pushrocks/projectinfo'; | ||||
| import * as qenv from '@pushrocks/qenv'; | ||||
| import * as smartanalytics from '@pushrocks/smartanalytics'; | ||||
| import * as smartdelay from '@pushrocks/smartdelay'; | ||||
| import * as smartfile from '@pushrocks/smartfile'; | ||||
| import * as smartcli from '@pushrocks/smartcli'; | ||||
| import * as smartgit from '@pushrocks/smartgit'; | ||||
| import * as smartlog from '@pushrocks/smartlog'; | ||||
| import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local'; | ||||
| import * as smartparam from '@pushrocks/smartparam'; | ||||
| import * as smartpath from '@pushrocks/smartpath'; | ||||
| import * as smartpromise from '@pushrocks/smartpromise'; | ||||
| import * as smartrequest from '@pushrocks/smartrequest'; | ||||
| import * as smartshell from '@pushrocks/smartshell'; | ||||
| import * as smartsocket from '@pushrocks/smartsocket'; | ||||
| import * as smartssh from '@pushrocks/smartssh'; | ||||
| import * as smartstring from '@pushrocks/smartstring'; | ||||
| // @push.rocks | ||||
| import * as lik from '@push.rocks/lik'; | ||||
| import * as npmextra from '@push.rocks/npmextra'; | ||||
| import * as projectinfo from '@push.rocks/projectinfo'; | ||||
| import * as qenv from '@push.rocks/qenv'; | ||||
| import * as smartanalytics from '@push.rocks/smartanalytics'; | ||||
| import * as smartdelay from '@push.rocks/smartdelay'; | ||||
| import * as smartfile from '@push.rocks/smartfile'; | ||||
| import * as smartcli from '@push.rocks/smartcli'; | ||||
| import * as smartgit from '@push.rocks/smartgit'; | ||||
| import * as smartlog from '@push.rocks/smartlog'; | ||||
| import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local'; | ||||
| import * as smartobject from '@push.rocks/smartobject'; | ||||
| import * as smartpath from '@push.rocks/smartpath'; | ||||
| import * as smartpromise from '@push.rocks/smartpromise'; | ||||
| import * as smartrequest from '@push.rocks/smartrequest'; | ||||
| import * as smartshell from '@push.rocks/smartshell'; | ||||
| import * as smartsocket from '@push.rocks/smartsocket'; | ||||
| import * as smartssh from '@push.rocks/smartssh'; | ||||
| import * as smartstring from '@push.rocks/smartstring'; | ||||
|  | ||||
| export { | ||||
|   lik, | ||||
|   npmextra, | ||||
|   projectinfo, | ||||
|   qenv, | ||||
| @@ -44,7 +46,7 @@ export { | ||||
|   smartcli, | ||||
|   smartlog, | ||||
|   smartlogDestinationLocal, | ||||
|   smartparam, | ||||
|   smartobject, | ||||
|   smartpath, | ||||
|   smartpromise, | ||||
|   smartrequest, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user