now using newest npmts and uploading public docker images also to gitlab registry

This commit is contained in:
Philipp Kunz 2017-04-02 22:56:40 +02:00
parent 2525bc1ad4
commit 76530985e7
11 changed files with 972 additions and 161 deletions

1
.gitignore vendored
View File

@ -1,6 +1,5 @@
node_modules/
coverage/
pages/
public/
config.json
.yarn/

2
dist/npmci.bash.js vendored
View File

@ -107,4 +107,4 @@ exports.bashBare = (commandArg, retryArg = 2) => __awaiter(this, void 0, void 0,
exports.bashNoError = (commandArg) => __awaiter(this, void 0, void 0, function* () {
return yield exports.bash(commandArg, -1);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLDJDQUEwQztBQUMxQyx1Q0FBc0M7QUFFdEMsaUNBQWdDO0FBRWhDOztHQUVHO0FBQ1EsUUFBQSxZQUFZLEdBQUcsTUFBTSxDQUFDLEtBQUssRUFBVyxDQUFBO0FBQ3RDLFFBQUEsYUFBYSxHQUFHLE1BQU0sQ0FBQyxLQUFLLEVBQVcsQ0FBQTtBQUNsRDs7R0FFRztBQUNILElBQUksZUFBZSxHQUFHLElBQUksT0FBTyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUM7SUFDdEQsUUFBUSxFQUFFLE1BQU07SUFDaEIsZUFBZSxFQUFFLEVBQUU7Q0FDcEIsQ0FBQyxDQUFBO0FBRUY7O0dBRUc7QUFDSCxJQUFJLG1CQUFtQixHQUFHO0lBQ3hCLGdCQUFnQjtJQUNoQixFQUFFLENBQUMsQ0FDRCxDQUFDLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsd0NBQXdDLENBQUMsQ0FBQyxDQUFDLFFBQVEsS0FBSyxDQUMvRixDQUFDLENBQUMsQ0F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LEdBQUc7WUFDWCxRQUFRLEVBQUUsQ0FBQztZQUNYLE1BQU0sRUFBRSxZQUFZO1NBQ3JCLENBQUE7SUFDSCxDQUFDO0lBQ0QsTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUE7QUFDMUIsQ0FBQyxDQUFBLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsUUFBUSxHQUFHLENBQU8sVUFBa0IsRUFBRSxXQUFtQixDQUFDO0lBQ25FLE1BQU0sQ0FBQyxNQUFNLFlBQUksQ0FBQyxVQUFVLEVBQUUsUUFBUSxFQUFFLElBQUksQ0FBQyxDQUFBO0FBQy9DLENBQUMsQ0FBQSxDQUFBO0FBRUQ7O0dBRUc7QUFDUSxRQUFBLFdBQVcsR0FBRyxDQUFPLFVBQWtCO0lBQ2hELE1BQU0sQ0FBQyxNQUFNLFlBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQTtBQUNuQyxDQUFDLENBQUEsQ0FBQSJ9

View File

@ -45,7 +45,8 @@ export declare class Dockerfile {
version: string;
cleanTag: string;
buildTag: string;
testTag: string;
gitlabTestTag: string;
gitlabReleaseTag: string;
releaseTag: string;
containerName: string;
content: string;

File diff suppressed because one or more lines are too long

90
docs/index.md Normal file
View File

@ -0,0 +1,90 @@
# NPMCI
npmci is your friend when it comes to handling npm packages during CI builds. It is optimized for GitLab CI
## Availabililty
[![npm](https://gitzone.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmci)
[![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://gitlab.com/gitzone/npmci)
[![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/npmci)
[![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/npmci/docs)
## Status for master
[![build status](https://gitlab.com/gitzone/npmci/badges/master/build.svg)](https://gitlab.com/gitzone/npmci/commits/master)
[![coverage report](https://gitlab.com/gitzone/npmci/badges/master/coverage.svg)](https://gitlab.com/gitzone/npmci/commits/master)
[![Dependency Status](https://david-dm.org/gitzonetools/npmci.svg)](https://david-dm.org/gitzonetools/npmci)
[![bitHound Dependencies](https://www.bithound.io/github/gitzonetools/npmci/badges/dependencies.svg)](https://www.bithound.io/github/gitzonetools/npmci/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/gitzonetools/npmci/badges/code.svg)](https://www.bithound.io/github/gitzonetools/npmci)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
## Usage
npmci is designed to work in docker CI environments. The following docker images come with npmci presinstalled:
Docker Hub:
* [hosttoday/ht-docker-node:npmci](https://hub.docker.com/r/hosttoday/ht-docker-node/)
has LTS node version and npmci preinstalled.
* [hosttoday/ht-docker-dbase](https://hub.docker.com/r/hosttoday/ht-docker-dbase/)
based on docker:git, can be used to build docker images in conjunction with docker:dind
npmci can be called from commandline:
```shell
# Install any node version:
npmci install lts # will install latest LTS node version and update PATH for node and npm versions
npmci install stable # will install latest stable node version and update PATH for node and npm
npmci install legacy # will install latest legacy node version and update PATH for node and npm
npmci install x.x.x # will install any specific node version.
# Install any node version, install dependencies and run test in cwd:
npmci test lts # will install latest lts node version and run "npm install" and "npm test".
npmci test stable # will install latest stable node version and run "npm install" and "npm test".
npmci test legacy # will install latest legacy node version and run "npm install" and "npm test".
npmci test x.x.x # will install any specific node version and run "npm install" and "npm test".
npmci test docker # will test any build image with tests defined in ./npmci/dockertest_1.sh to ./npmci/dockertest_100.sh
## npmci test docker will look at all Dockerfiles and look for according tags on GitLab container registry
# prepare tools
npmci prepare npm # will look for $NPMCI_TOKEN_NPM env var and create .npmrc, so npm is authenticated
npmci prepare docker # will look for $NPMCI_LOGIN_DOCKER in form username|password and authenticate docker
npmci prepare docker-gitlab # will authenticate docker for gitlab container registry
# build containers
npmci build docker # will build containers
## all Dockerfiles named Dockerfile* are picked up.
## specify tags like this Dockerfile_[tag]
## uploads all built images as [username]/[reponame]:[tag]_test to GitLab
## then test in next step with "npmci test docker"
# publish npm module
npmci publish npm # will look vor $NPMCI_TOKEN_NPM env var and push any module in cwd to npm
npmci publish docker
# trigger webhooks
npmci trigger # will look for NPMCI_TRIGGER_1 to NPMCI_TRIGGER_100 in form domain|id|token|ref|name
```
## Configuration
npmci supports the use of npmextra.
To configure npmci create a `npmextra.json` file at the root of your project
```json
{
"npmci": {
"globalNpmTools": [
"npm-check-updates",
"protractor",
"npmts",
"gitzone"
]
}
}
```
**Available options**
setting | example | description
--- | --- | ---
globalNpmTools | "globalNpmTools": ["gitbook"] | Will look for the specified package names locally and (if not yet present) install them from npm.
[![npm](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

View File

@ -22,9 +22,8 @@
},
"homepage": "https://gitlab.com/gitzone/npmci#README",
"devDependencies": {
"@types/should": "^8.1.30",
"npmts-g": "^6.0.0",
"should": "^11.2.1",
"tapbundle": "^1.0.5",
"typings-test": "^1.0.3"
},
"dependencies": {

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-test';

View File

@ -1,5 +1,4 @@
import 'typings-test'
import * as should from 'should'
import { tap, expect } from 'tapbundle'
import * as path from 'path'
// set up environment
@ -7,7 +6,7 @@ process.env.CI_BUILD_REPO = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.g
process.env.NPMCI_SSHKEY_1 = 'hostString|somePrivKey|##'
process.env.NPMTS_TEST = 'true'
process.cwd = () => {
return path.join(__dirname,'assets/')
return path.join(__dirname, 'assets/')
}
// require NPMCI files
@ -22,79 +21,57 @@ let dockerfile1: NpmciBuildDocker.Dockerfile
let dockerfile2: NpmciBuildDocker.Dockerfile
let sortableArray: NpmciBuildDocker.Dockerfile[]
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: NpmciBuildDocker.Dockerfile[]){
should(readDockerfilesArrayArg[1].version).equal('sometag1')
sortableArray = readDockerfilesArrayArg
done()
})
})
tap.test('should return valid Dockerfiles', async () => {
dockerfile1 = new NpmciBuildDocker.Dockerfile({ filePath: './Dockerfile', read: true })
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)
it('should sort an array of Dockerfiles',function(done){
NpmciBuildDocker.sortDockerfiles(sortableArray)
.then(function(sortedArrayArg: NpmciBuildDocker.Dockerfile[]){
console.log(sortedArrayArg)
done()
})
})
it('should correctly chain Dockerfile handling', function(done){
NpmciBuildDocker.build()
.then(() => {
done()
})
})
tap.test('should read a directory of Dockerfiles', async () => {
return NpmciBuildDocker.readDockerfiles()
.then(async (readDockerfilesArrayArg: NpmciBuildDocker.Dockerfile[]) => {
sortableArray = readDockerfilesArrayArg
return expect(readDockerfilesArrayArg[ 1 ].version).to.equal('sometag1')
})
}).catch(tap.threw)
describe('.publish.docker',function(){
it('should publish all built Dockerfiles',function(done){
NpmciPublish.publish('docker')
.then(() => {
done()
})
})
tap.test('should sort an array of Dockerfiles', async () => {
return NpmciBuildDocker.sortDockerfiles(sortableArray)
.then(async (sortedArrayArg: NpmciBuildDocker.Dockerfile[]) => {
console.log(sortedArrayArg)
})
}).catch(tap.threw)
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()
})
})
})
tap.test('should correctly chain Dockerfile handling', async () => {
return NpmciBuildDocker.build()
}).catch(tap.threw)
describe('test.docker',function(){
it('should test dockerfiles',function(done){
NpmciTest.test('docker')
.then(() => {
done()
})
})
})
tap.test('should publish all built Dockerfiles', async () => {
return NpmciPublish.publish('docker')
}).catch(tap.threw)
describe('npmci prepare ssh',function(){
it('should pick up SSH keys',function(done){
NpmciSsh.ssh()
.then(() => {
done()
})
})
tap.test('should source nvm using bash and install a specific node version, then test it', async () => {
return NpmciTest.test('legacy')
.then(() => {
return NpmciTest.test('lts')
})
})
.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, '../')
}
})

View File

@ -46,8 +46,6 @@ let checkToolsAvailable = async () => {
}
checkToolsAvailable()
/**
* bash() allows using bash with nvm in path
* @param commandArg - The command to execute

View File

@ -133,7 +133,8 @@ export class Dockerfile {
version: string
cleanTag: string
buildTag: string
testTag: string
gitlabTestTag: string
gitlabReleaseTag: string
releaseTag: string
containerName: string
content: string
@ -146,7 +147,8 @@ export class Dockerfile {
this.version = dockerFileVersion(plugins.path.parse(options.filePath).base)
this.cleanTag = this.repo + ':' + this.version
this.buildTag = this.cleanTag
this.testTag = dockerTag('registry.gitlab.com', this.repo, this.version, 'test')
this.gitlabTestTag = dockerTag('registry.gitlab.com', this.repo, this.version, 'test')
this.gitlabReleaseTag = dockerTag('registry.gitlab.com', this.repo, this.version)
this.releaseTag = dockerTag(NpmciEnv.dockerRegistry, this.repo, this.version)
this.containerName = 'dockerfile-' + this.version
if (options.filePath && options.read) {
@ -170,25 +172,29 @@ export class Dockerfile {
* pushes the Dockerfile to a registry
*/
async push(stageArg) {
let pushTag
switch (stageArg) {
case 'release':
pushTag = this.releaseTag
await bashBare(`docker tag ${this.buildTag} ${this.releaseTag}`)
await bashBare(`docker push ${this.releaseTag}`)
// if release registry is different from gitlab
if (NpmciEnv.dockerRegistry !== 'registry.gitlab.com') {
await bashBare(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`)
await bashBare(`docker push ${this.gitlabReleaseTag}`)
}
break
case 'test':
default:
pushTag = this.testTag
await bashBare(`docker push ${this.gitlabTestTag}`)
break
}
await bashBare('docker tag ' + this.buildTag + ' ' + pushTag)
await bashBare('docker push ' + pushTag)
};
/**
* pulls the Dockerfile from a registry
*/
async pull(registryArg: string) {
let pullTag = this.testTag
let pullTag = this.gitlabTestTag
await bashBare('docker pull ' + pullTag)
await bashBare('docker tag ' + pullTag + ' ' + this.buildTag)
};
@ -230,7 +236,7 @@ export let dockerFileVersion = (dockerfileNameArg: string): string => {
let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/
let regexResultArray = versionRegex.exec(dockerfileNameArg)
if (regexResultArray && regexResultArray.length === 2) {
versionString = regexResultArray[1]
versionString = regexResultArray[ 1 ]
} else {
versionString = 'latest'
}
@ -243,7 +249,7 @@ export let dockerFileVersion = (dockerfileNameArg: string): string => {
export let dockerBaseImage = function (dockerfileContentArg: string) {
let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/
let regexResultArray = baseImageRegex.exec(dockerfileContentArg)
return regexResultArray[1]
return regexResultArray[ 1 ]
}
/**

868
yarn.lock

File diff suppressed because it is too large Load Diff