Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7c7787e811 | |||
| bde26cc312 | |||
| 29e81f3ae7 | |||
| 6337b20d62 | 
| @@ -1,7 +1,5 @@ | |||||||
| # gitzone ci_default | # gitzone ci_default | ||||||
| image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||||
| variables: |  | ||||||
|   GIT_STRATEGY: clone |  | ||||||
|  |  | ||||||
| cache: | cache: | ||||||
|   paths: |   paths: | ||||||
| @@ -102,7 +100,7 @@ trigger: | |||||||
| pages: | pages: | ||||||
|   image: hosttoday/ht-docker-dbase:npmci |   image: hosttoday/ht-docker-dbase:npmci | ||||||
|   services: |   services: | ||||||
|    - docker:18-dind |    - docker:stable-dind | ||||||
|   stage: metadata |   stage: metadata | ||||||
|   script: |   script: | ||||||
|     - npmci command npm install -g @gitzone/tsdoc |     - npmci command npm install -g @gitzone/tsdoc | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										30
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,9 +1,37 @@ | |||||||
| { | { | ||||||
|   "name": "@shipzone/npmci", |   "name": "@shipzone/npmci", | ||||||
|   "version": "3.1.42", |   "version": "3.1.44", | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 1, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|  |     "@apiglobal/typedrequest": { | ||||||
|  |       "version": "1.0.17", | ||||||
|  |       "resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.17.tgz", | ||||||
|  |       "integrity": "sha512-p19ZOROh7+dsA00N3QFHCuyeUWarxpSVZxVJBI59LPnh6JlGE3ixQYpAEi+HJbsGfIEhuOBIJ6upN+0lnjH+fg==", | ||||||
|  |       "requires": { | ||||||
|  |         "@apiglobal/typedrequest-interfaces": "^1.0.7", | ||||||
|  |         "@pushrocks/lik": "^3.0.11", | ||||||
|  |         "@pushrocks/smartjson": "^3.0.8", | ||||||
|  |         "@pushrocks/smartrequest": "^1.1.23" | ||||||
|  |       }, | ||||||
|  |       "dependencies": { | ||||||
|  |         "@pushrocks/smartjson": { | ||||||
|  |           "version": "3.0.8", | ||||||
|  |           "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-3.0.8.tgz", | ||||||
|  |           "integrity": "sha512-EjC3611RSZaZmK+nXxXrYDBxdxYWtrxjOrZtQzbYn0yM33KSCH0sLIAG8B2wYZVAOj4A2pC8mVxFSJ1w3iRFHg==", | ||||||
|  |           "requires": { | ||||||
|  |             "@types/fast-json-stable-stringify": "^2.0.0", | ||||||
|  |             "fast-json-stable-stringify": "^2.0.0", | ||||||
|  |             "lodash.clonedeep": "^4.5.0" | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     "@apiglobal/typedrequest-interfaces": { | ||||||
|  |       "version": "1.0.7", | ||||||
|  |       "resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest-interfaces/-/typedrequest-interfaces-1.0.7.tgz", | ||||||
|  |       "integrity": "sha512-yPl0UcLFMwSQL7bK52wVjkgvadC+x2YS3+7T15V1A1dXNxa96yd4WX1fqcKqwnBrvYexq/8FaxWGi98tZ0oNwg==" | ||||||
|  |     }, | ||||||
|     "@babel/code-frame": { |     "@babel/code-frame": { | ||||||
|       "version": "7.5.5", |       "version": "7.5.5", | ||||||
|       "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz", |       "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz", | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@shipzone/npmci", |   "name": "@shipzone/npmci", | ||||||
|   "version": "3.1.42", |   "version": "3.1.44", | ||||||
|   "private": false, |   "private": false, | ||||||
|   "description": "node and docker in gitlab ci on steroids", |   "description": "node and docker in gitlab ci on steroids", | ||||||
|   "main": "dist/index.js", |   "main": "dist/index.js", | ||||||
| @@ -33,6 +33,7 @@ | |||||||
|     "tslint-config-prettier": "^1.18.0" |     "tslint-config-prettier": "^1.18.0" | ||||||
|   }, |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|  |     "@apiglobal/typedrequest": "^1.0.17", | ||||||
|     "@pushrocks/lik": "^3.0.11", |     "@pushrocks/lik": "^3.0.11", | ||||||
|     "@pushrocks/npmextra": "^3.0.5", |     "@pushrocks/npmextra": "^3.0.5", | ||||||
|     "@pushrocks/projectinfo": "^4.0.2", |     "@pushrocks/projectinfo": "^4.0.2", | ||||||
|   | |||||||
							
								
								
									
										26
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -29,28 +29,34 @@ let sortableArray: npmci.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(); | ||||||
|   dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, { filePath: './Dockerfile', read: true }); |   dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, { | ||||||
|   dockerfile2 = new npmci.Dockerfile(npmciInstance.dockerManager, { filePath: './Dockerfile_sometag1', read: true }); |     filePath: './Dockerfile', | ||||||
|  |     read: true | ||||||
|  |   }); | ||||||
|  |   dockerfile2 = new npmci.Dockerfile(npmciInstance.dockerManager, { | ||||||
|  |     filePath: './Dockerfile_sometag1', | ||||||
|  |     read: true | ||||||
|  |   }); | ||||||
|   expect(dockerfile1.version).to.equal('latest'); |   expect(dockerfile1.version).to.equal('latest'); | ||||||
|   return expect(dockerfile2.version).to.equal('sometag1'); |   return expect(dockerfile2.version).to.equal('sometag1'); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.test('should read a directory of Dockerfiles', async () => { | tap.test('should read a directory of Dockerfiles', async () => { | ||||||
|   const npmciInstance = new npmci.Npmci(); |   const npmciInstance = new npmci.Npmci(); | ||||||
|   return npmci.Dockerfile |   return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then( | ||||||
|     .readDockerfiles(npmciInstance.dockerManager) |     async (readDockerfilesArrayArg: npmci.Dockerfile[]) => { | ||||||
|     .then(async (readDockerfilesArrayArg: npmci.Dockerfile[]) => { |  | ||||||
|       sortableArray = readDockerfilesArrayArg; |       sortableArray = readDockerfilesArrayArg; | ||||||
|       return expect(readDockerfilesArrayArg[1].version).to.equal('sometag1'); |       return expect(readDockerfilesArrayArg[1].version).to.equal('sometag1'); | ||||||
|     }); |     } | ||||||
|  |   ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.test('should sort an array of Dockerfiles', async () => { | tap.test('should sort an array of Dockerfiles', async () => { | ||||||
|   return npmci.Dockerfile |   return npmci.Dockerfile.sortDockerfiles(sortableArray).then( | ||||||
|     .sortDockerfiles(sortableArray) |     async (sortedArrayArg: npmci.Dockerfile[]) => { | ||||||
|     .then(async (sortedArrayArg: npmci.Dockerfile[]) => { |  | ||||||
|       console.log(sortedArrayArg); |       console.log(sortedArrayArg); | ||||||
|     }); |     } | ||||||
|  |   ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.test('should build all Dockerfiles', async () => { | tap.test('should build all Dockerfiles', async () => { | ||||||
|   | |||||||
| @@ -1,8 +1,30 @@ | |||||||
| import * as plugins from '../npmci.plugins'; | import * as plugins from '../npmci.plugins'; | ||||||
|  |  | ||||||
|  | import {Npmci} from '../npmci.classes.npmci'; | ||||||
|  | import { logger } from '../npmci.logging'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  *  |  * connects to cloudly | ||||||
|  */ |  */ | ||||||
| export class CloudlyConnector { | export class CloudlyConnector { | ||||||
|  |   public npmciRef: Npmci; | ||||||
|  |  | ||||||
|  |   constructor(npmciRefArg: Npmci) { | ||||||
|  |     this.npmciRef = npmciRefArg; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |   public async announceDockerContainer(optionsArg: plugins.servezoneInterfaces.IVersionData) { | ||||||
|  |     const cloudlyUrl = this.npmciRef.npmciConfig.getConfig().urlCloudly; | ||||||
|  |     if (!cloudlyUrl) { | ||||||
|  |       logger.log('warn', 'no cloudly url provided. Thus we cannot announce the newly built Dockerimage!'); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     const typedrequest = new plugins.typedrequest.TypedRequest< | ||||||
|  |       plugins.servezoneInterfaces.IRequest_Any_Cloudly_VersionManager_Update | ||||||
|  |     >(`https://${cloudlyUrl}/versionmanager`, 'update'); | ||||||
|  |  | ||||||
|  |     const response = (await typedrequest.fire(optionsArg)); | ||||||
|  |   } | ||||||
| } | } | ||||||
| @@ -266,6 +266,13 @@ export class Dockerfile { | |||||||
|     ); |     ); | ||||||
|     await bash(`docker tag ${this.buildTag} ${pushTag}`); |     await bash(`docker tag ${this.buildTag} ${pushTag}`); | ||||||
|     await bash(`docker push ${pushTag}`); |     await bash(`docker push ${pushTag}`); | ||||||
|  |     const imageDigest = (await bash( | ||||||
|  |       `docker inspect --format='{{index .RepoDigests 0}}' ${pushTag}` | ||||||
|  |     )).split('@')[1]; | ||||||
|  |     await this.npmciDockerManagerRef.npmciRef.cloudlyConnector.announceDockerContainer({ | ||||||
|  |       dockerImageUrl: pushTag, | ||||||
|  |       dockerImageVersion: imageDigest | ||||||
|  |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|   | |||||||
| @@ -3,4 +3,3 @@ import * as plugins from './mod.plugins'; | |||||||
| import * as paths from '../npmci.paths'; | import * as paths from '../npmci.paths'; | ||||||
|  |  | ||||||
| import { Dockerfile } from './mod.classes.dockerfile'; | import { Dockerfile } from './mod.classes.dockerfile'; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ export class NpmciGitManager { | |||||||
|     } else { |     } else { | ||||||
|       logger.log('info', `npmci git -> cli arguments invalid! Please read the documentation.`); |       logger.log('info', `npmci git -> cli arguments invalid! Please read the documentation.`); | ||||||
|     } |     } | ||||||
|   } |   }; | ||||||
|  |  | ||||||
|   public mirror = async () => { |   public mirror = async () => { | ||||||
|     const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN; |     const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN; | ||||||
| @@ -61,5 +61,5 @@ export class NpmciGitManager { | |||||||
|       logger.log('error', `cannot find NPMCI_GIT_GITHUBTOKEN env var!`); |       logger.log('error', `cannot find NPMCI_GIT_GITHUBTOKEN env var!`); | ||||||
|       process.exit(1); |       process.exit(1); | ||||||
|     } |     } | ||||||
|   } |   }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ export class Npmci { | |||||||
|       projectId: 'gitzone', |       projectId: 'gitzone', | ||||||
|       appName: 'npmci' |       appName: 'npmci' | ||||||
|     }); |     }); | ||||||
|     this.cloudlyConnector = new CloudlyConnector(); |     this.cloudlyConnector = new CloudlyConnector(this); | ||||||
|     this.npmciEnv = new NpmciEnv(this); |     this.npmciEnv = new NpmciEnv(this); | ||||||
|     this.npmciInfo = new NpmciInfo(this); |     this.npmciInfo = new NpmciInfo(this); | ||||||
|     this.npmciCli = new NpmciCli(this); |     this.npmciCli = new NpmciCli(this); | ||||||
|   | |||||||
| @@ -106,5 +106,5 @@ export class NpmciCli { | |||||||
|  |  | ||||||
|   public startParse = () => { |   public startParse = () => { | ||||||
|     this.smartcli.startParse(); |     this.smartcli.startParse(); | ||||||
|   } |   }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,10 +1,9 @@ | |||||||
| import * as plugins from './npmci.plugins'; | import * as plugins from './npmci.plugins'; | ||||||
| import * as paths from './npmci.paths'; | import * as paths from './npmci.paths'; | ||||||
| import { logger } from "./npmci.logging"; | import { logger } from './npmci.logging'; | ||||||
| import { Npmci } from './npmci.classes.npmci'; | import { Npmci } from './npmci.classes.npmci'; | ||||||
|  |  | ||||||
| export class NpmciInfo { | export class NpmciInfo { | ||||||
|  |  | ||||||
|   public npmciRef: Npmci; |   public npmciRef: Npmci; | ||||||
|   public projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot); |   public projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,12 +3,17 @@ import * as path from 'path'; | |||||||
|  |  | ||||||
| export { path }; | export { path }; | ||||||
|  |  | ||||||
|  | // @apiglobal | ||||||
|  | import * as typedrequest from '@apiglobal/typedrequest'; | ||||||
|  |  | ||||||
|  | export { | ||||||
|  |   typedrequest | ||||||
|  | }; | ||||||
|  |  | ||||||
| // @servezone | // @servezone | ||||||
| import * as servezoneInterfaces from '@servezone/servezone-interfaces'; | import * as servezoneInterfaces from '@servezone/servezone-interfaces'; | ||||||
|  |  | ||||||
| export { | export { servezoneInterfaces }; | ||||||
|   servezoneInterfaces |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| // @pushrocks | // @pushrocks | ||||||
| import * as npmextra from '@pushrocks/npmextra'; | import * as npmextra from '@pushrocks/npmextra'; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user