Compare commits
	
		
			16 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3484575108 | |||
| 7c4890f57a | |||
| 308d969540 | |||
| 5065587275 | |||
| 8f0092b2ef | |||
| e81d001aeb | |||
| 993f6f691e | |||
| 64053de75a | |||
| 1edea1046b | |||
| 0f8a76ca02 | |||
| 7dc76be1bb | |||
| 8920110783 | |||
| 7419ee28e4 | |||
| 1f4ecb6ff6 | |||
| a042674a81 | |||
|  | 764cd8f7ee | 
| @@ -1,4 +1,4 @@ | ||||
| image: node:latest | ||||
| image: hosttoday/ht-docker-node:stable | ||||
|  | ||||
| stages: | ||||
| - test | ||||
|   | ||||
							
								
								
									
										1
									
								
								dist/cli.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/cli.js
									
									
									
									
										vendored
									
									
								
							| @@ -1,2 +1,3 @@ | ||||
| #!/usr/bin/env node | ||||
| process.env.CLI_CALL = 'true' | ||||
| var index = require("../dist/index.js"); | ||||
							
								
								
									
										8
									
								
								dist/npmci.build.docker.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/npmci.build.docker.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										22
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "npmci", | ||||
|   "version": "2.3.54", | ||||
|   "version": "2.3.61", | ||||
|   "description": "", | ||||
|   "main": "dist/index.js", | ||||
|   "typings": "dist/index.d.ts", | ||||
| @@ -22,26 +22,26 @@ | ||||
|   }, | ||||
|   "homepage": "https://gitlab.com/gitzone/npmci#README", | ||||
|   "devDependencies": { | ||||
|     "tapbundle": "^1.0.5", | ||||
|     "tapbundle": "^1.0.12", | ||||
|     "typings-test": "^1.0.3" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@types/lodash": "^4.14.55", | ||||
|     "@types/node": "^7.0.8", | ||||
|     "@types/lodash": "^4.14.64", | ||||
|     "@types/node": "^7.0.18", | ||||
|     "@types/request": "0.x.x", | ||||
|     "@types/shelljs": "^0.7.0", | ||||
|     "@types/shelljs": "^0.7.1", | ||||
|     "@types/through2": "^2.0.32", | ||||
|     "beautylog": "^6.1.5", | ||||
|     "beautylog": "^6.1.10", | ||||
|     "gulp": "^3.9.1", | ||||
|     "gulp-function": "^2.2.3", | ||||
|     "gulp-function": "^2.2.9", | ||||
|     "lodash": "^4.17.4", | ||||
|     "npmextra": "^2.0.3", | ||||
|     "npmextra": "^2.0.5", | ||||
|     "projectinfo": "^3.0.2", | ||||
|     "request": "^2.81.0", | ||||
|     "shelljs": "^0.7.7", | ||||
|     "smartcli": "^2.0.1", | ||||
|     "smartcli": "^2.0.7", | ||||
|     "smartdelay": "^1.0.1", | ||||
|     "smartfile": "^4.1.7", | ||||
|     "smartfile": "^4.2.11", | ||||
|     "smartparam": "^0.1.1", | ||||
|     "smartq": "^1.1.1", | ||||
|     "smartshell": "^1.0.6", | ||||
| @@ -49,6 +49,6 @@ | ||||
|     "smartssh": "^1.2.1", | ||||
|     "smartstring": "^2.0.24", | ||||
|     "through2": "^2.0.3", | ||||
|     "typings-global": "^1.0.14" | ||||
|     "typings-global": "^1.0.16" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,22 +1,26 @@ | ||||
| # NPMCI | ||||
| npmci is your friend when it comes to handling npm packages during CI builds. It is optimized for GitLab CI | ||||
| # npmci | ||||
| helps with pushing to npm registry from any CI | ||||
| 
 | ||||
| ## Availabililty | ||||
| [](https://www.npmjs.com/package/npmci) | ||||
| [](https://gitlab.com/gitzone/npmci) | ||||
| [](https://GitLab.com/gitzone/npmci) | ||||
| [](https://github.com/gitzone/npmci) | ||||
| [](https://gitzone.gitlab.io/npmci/docs) | ||||
| [](https://gitzone.gitlab.io/npmci/) | ||||
| 
 | ||||
| ## Status for master | ||||
| [](https://gitlab.com/gitzone/npmci/commits/master) | ||||
| [](https://gitlab.com/gitzone/npmci/commits/master) | ||||
| [](https://GitLab.com/gitzone/npmci/commits/master) | ||||
| [](https://GitLab.com/gitzone/npmci/commits/master) | ||||
| [](https://www.npmjs.com/package/npmci) | ||||
| [](https://david-dm.org/gitzonetools/npmci) | ||||
| [](https://www.bithound.io/github/gitzonetools/npmci/master/dependencies/npm) | ||||
| [](https://www.bithound.io/github/gitzonetools/npmci) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](http://standardjs.com/) | ||||
| 
 | ||||
| ## Usage | ||||
| Use TypeScript for best in class instellisense. | ||||
| 
 | ||||
| npmci is designed to work in docker CI environments. The following docker images come with npmci presinstalled: | ||||
| 
 | ||||
| Docker Hub: | ||||
| @@ -87,4 +91,9 @@ setting | example | description | ||||
| --- | --- | --- | ||||
| globalNpmTools | "globalNpmTools": ["gitbook"] | Will look for the specified package names locally and (if not yet present) install them from npm.  | ||||
| 
 | ||||
| [](https://push.rocks) | ||||
| For further information read the linked docs at the top of this README. | ||||
| 
 | ||||
| > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | ||||
| | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | ||||
| 
 | ||||
| [](https://push.rocks) | ||||
							
								
								
									
										89
									
								
								test/test.js
									
									
									
									
									
								
							
							
						
						
									
										89
									
								
								test/test.js
									
									
									
									
									
								
							| @@ -1,89 +0,0 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| require("typings-test"); | ||||
| const should = require("should"); | ||||
| const path = require("path"); | ||||
| // set up environment | ||||
| process.env.CI_BUILD_REPO = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git'; | ||||
| process.env.NPMCI_SSHKEY_1 = 'hostString|somePrivKey|##'; | ||||
| process.env.NPMTS_TEST = 'true'; | ||||
| process.cwd = () => { | ||||
|     return path.join(__dirname, 'assets/'); | ||||
| }; | ||||
| const NpmciBuildDocker = require("../dist/npmci.build.docker"); | ||||
| const NpmciPublish = require("../dist/npmci.publish"); | ||||
| const NpmciTest = require("../dist/npmci.test"); | ||||
| const NpmciSsh = require("../dist/npmci.ssh"); | ||||
| let dockerfile1; | ||||
| let dockerfile2; | ||||
| let sortableArray; | ||||
| describe('NPMCI', function () { | ||||
|     describe('build.docker', function () { | ||||
|         it('should return valid Dockerfiles', function () { | ||||
|             dockerfile1 = new NpmciBuildDocker.Dockerfile({ filePath: './Dockerfile', read: true }); | ||||
|             dockerfile2 = new NpmciBuildDocker.Dockerfile({ filePath: './Dockerfile_sometag1', read: true }); | ||||
|             should(dockerfile1.version).equal('latest'); | ||||
|             should(dockerfile2.version).equal('sometag1'); | ||||
|         }); | ||||
|         it('should read a directory of Dockerfiles', function (done) { | ||||
|             NpmciBuildDocker.readDockerfiles() | ||||
|                 .then(function (readDockerfilesArrayArg) { | ||||
|                 should(readDockerfilesArrayArg[1].version).equal('sometag1'); | ||||
|                 sortableArray = readDockerfilesArrayArg; | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|         it('should sort an array of Dockerfiles', function (done) { | ||||
|             NpmciBuildDocker.sortDockerfiles(sortableArray) | ||||
|                 .then(function (sortedArrayArg) { | ||||
|                 console.log(sortedArrayArg); | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|         it('should correctly chain Dockerfile handling', function (done) { | ||||
|             NpmciBuildDocker.build() | ||||
|                 .then(() => { | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|     }); | ||||
|     describe('.publish.docker', function () { | ||||
|         it('should publish all built Dockerfiles', function (done) { | ||||
|             NpmciPublish.publish('docker') | ||||
|                 .then(() => { | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|     }); | ||||
|     describe('.test.npm', function () { | ||||
|         it('should source nvm using bash and install a specific node version, then test it', function (done) { | ||||
|             NpmciTest.test('legacy') | ||||
|                 .then(() => { | ||||
|                 return NpmciTest.test('lts'); | ||||
|             }) | ||||
|                 .then(() => { | ||||
|                 return NpmciTest.test('stable'); | ||||
|             }) | ||||
|                 .then(() => { | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|     }); | ||||
|     describe('test.docker', function () { | ||||
|         it('should test dockerfiles', function (done) { | ||||
|             NpmciTest.test('docker') | ||||
|                 .then(() => { | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|     }); | ||||
|     describe('npmci prepare ssh', function () { | ||||
|         it('should pick up SSH keys', function (done) { | ||||
|             NpmciSsh.ssh() | ||||
|                 .then(() => { | ||||
|                 done(); | ||||
|             }); | ||||
|         }); | ||||
|     }); | ||||
| }); | ||||
| //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3QkFBcUI7QUFDckIsaUNBQWdDO0FBQ2hDLDZCQUE0QjtBQUU1QixxQkFBcUI7QUFDckIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEdBQUcsdURBQXVELENBQUE7QUFDbkYsT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLEdBQUcsMkJBQTJCLENBQUE7QUFDeEQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEdBQUcsTUFBTSxDQUFBO0FBQy9CLE9BQU8sQ0FBQyxHQUFHLEdBQUc7SUFDVixNQUFNLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsU0FBUyxDQUFDLENBQUE7QUFDekMsQ0FBQyxDQUFBO0FBSUQsK0RBQStEO0FBQy9ELHNEQUFzRDtBQUN0RCxnREFBZ0Q7QUFDaEQsOENBQThDO0FBRzlDLElBQUksV0FBd0MsQ0FBQTtBQUM1QyxJQUF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yxDQUFBO1lBQ25DLENBQUMsQ0FBQztpQkFDRCxJQUFJLENBQUM7Z0JBQ0YsSUFBSSxFQUFFLENBQUE7WUFDVixDQUFDLENBQUMsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7SUFFRixRQUFRLENBQUMsYUFBYSxFQUFDO1FBQ25CLEVBQUUsQ0FBQyx5QkFBeUIsRUFBQyxVQUFTLElBQUk7WUFDdEMsU0FBUyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUM7aUJBQ25CLElBQUksQ0FBQztnQkFDRixJQUFJLEVBQUUsQ0FBQTtZQUNWLENBQUMsQ0FBQyxDQUFBO1FBQ1YsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtJQUVGLFFBQVEsQ0FBQyxtQkFBbUIsRUFBQztRQUN6QixFQUFFLENBQUMseUJBQXlCLEVBQUMsVUFBUyxJQUFJO1lBQ3RDLFFBQVEsQ0FBQyxHQUFHLEVBQUU7aUJBQ1QsSUFBSSxDQUFDO2dCQUNGLElBQUksRUFBRSxDQUFBO1lBQ1YsQ0FBQyxDQUFDLENBQUE7UUFDVixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ== | ||||
							
								
								
									
										20
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -27,7 +27,7 @@ tap.test('should return valid Dockerfiles', async () => { | ||||
|   dockerfile2 = new NpmciBuildDocker.Dockerfile({ filePath: './Dockerfile_sometag1', read: true }) | ||||
|   expect(dockerfile1.version).to.equal('latest') | ||||
|   return expect(dockerfile2.version).to.equal('sometag1') | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should read a directory of Dockerfiles', async () => { | ||||
|   return NpmciBuildDocker.readDockerfiles() | ||||
| @@ -35,22 +35,22 @@ tap.test('should read a directory of Dockerfiles', async () => { | ||||
|       sortableArray = readDockerfilesArrayArg | ||||
|       return expect(readDockerfilesArrayArg[ 1 ].version).to.equal('sometag1') | ||||
|     }) | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should sort an array of Dockerfiles', async () => { | ||||
|   return NpmciBuildDocker.sortDockerfiles(sortableArray) | ||||
|     .then(async (sortedArrayArg: NpmciBuildDocker.Dockerfile[]) => { | ||||
|       console.log(sortedArrayArg) | ||||
|     }) | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should correctly chain Dockerfile handling', async () => { | ||||
|   return NpmciBuildDocker.build() | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should publish all built Dockerfiles', async () => { | ||||
|   return NpmciPublish.publish('docker') | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should source nvm using bash and install a specific node version, then test it', async () => { | ||||
|   return NpmciTest.test('legacy') | ||||
| @@ -60,18 +60,20 @@ tap.test('should source nvm using bash and install a specific node version, then | ||||
|     .then(() => { | ||||
|       return NpmciTest.test('stable') | ||||
|     }) | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should test dockerfiles', async () => { | ||||
|   return NpmciTest.test('docker') | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('should pick up SSH keys', async () => { | ||||
|   return NpmciSsh.ssh() | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.test('reset paths', async () => { | ||||
|   process.cwd = () => { | ||||
|     return path.join(__dirname, '../') | ||||
|   } | ||||
| }).catch(tap.threw) | ||||
| }) | ||||
|  | ||||
| tap.start() | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import { bashBare } from './npmci.bash' | ||||
|  * builds a cwd of Dockerfiles by triggering a promisechain | ||||
|  */ | ||||
| export let build = async () => { | ||||
|   plugins.beautylog.log('now building Dockerfiles...') | ||||
|   await readDockerfiles() | ||||
|     .then(sortDockerfiles) | ||||
|     .then(mapDockerfiles) | ||||
| @@ -19,10 +20,12 @@ export let build = async () => { | ||||
|  * @returns Promise<Dockerfile[]> | ||||
|  */ | ||||
| export let readDockerfiles = async (): Promise<Dockerfile[]> => { | ||||
|   let fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, './Dockerfile*') | ||||
|   let fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*') | ||||
|  | ||||
|   // create the Dockerfile array | ||||
|   let readDockerfilesArray: Dockerfile[] = [] | ||||
|   plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`) | ||||
|   console.log(fileTree) | ||||
|   for (let dockerfilePath of fileTree) { | ||||
|     let myDockerfile = new Dockerfile({ | ||||
|       filePath: dockerfilePath, | ||||
| @@ -185,6 +188,7 @@ export class Dockerfile { | ||||
|         break | ||||
|       case 'test': | ||||
|       default: | ||||
|         await bashBare(`docker tag ${this.buildTag} ${this.gitlabTestTag}`) | ||||
|         await bashBare(`docker push ${this.gitlabTestTag}`) | ||||
|         break | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user