update commnts

This commit is contained in:
Philipp Kunz 2016-09-04 16:05:47 +02:00
parent f0e62c06e8
commit c4aa3a8926
12 changed files with 160 additions and 27 deletions

View File

@ -61,6 +61,7 @@ pages:
image: hosttoday/ht-docker-node:npmpage
stage: page
script:
- npmci command npmts
- npmci command npmpage --host gitlab
only:
- tags

View File

@ -1,4 +1,11 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
/**
* defines possible build services
*/
export declare type TBuildService = "docker";
/**
* builds for a specific service
*/
export declare let build: (commandArg: any) => plugins.q.Promise<{}>;

5
dist/npmci.build.js vendored
View File

@ -2,6 +2,9 @@
require("typings-global");
const plugins = require("./npmci.plugins");
const buildDocker = require("./npmci.build.docker");
/**
* builds for a specific service
*/
exports.build = function (commandArg) {
switch (commandArg) {
case "docker":
@ -10,4 +13,4 @@ exports.build = function (commandArg) {
plugins.beautylog.log("build target " + commandArg + " not recognised!");
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5idWlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLE1BQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFHM0MsTUFBWSxXQUFXLFdBQU0sc0JBRTdCLENBQUMsQ0FGa0Q7QUFFeEMsYUFBSyxHQUFHLFVBQVMsVUFBVTtJQUNsQyxNQUFNLENBQUEsQ0FBQyxVQUFVLENBQUMsQ0FBQSxDQUFDO1FBQ2YsS0FBSyxRQUFRO1lBQ1QsTUFBTSxDQUFDLFdBQVcsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUMvQjtZQUNJLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLGVBQWUsR0FBRyxVQUFVLEdBQUcsa0JBQWtCLENBQUMsQ0FBQztJQUNqRixDQUFDO0FBQ0wsQ0FBQyxDQUFBIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5idWlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLE1BQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFHM0MsTUFBWSxXQUFXLFdBQU0sc0JBSzdCLENBQUMsQ0FMa0Q7QUFPbkQ7O0dBRUc7QUFDUSxhQUFLLEdBQUcsVUFBUyxVQUFVO0lBQ2xDLE1BQU0sQ0FBQSxDQUFDLFVBQVUsQ0FBQyxDQUFBLENBQUM7UUFDZixLQUFLLFFBQVE7WUFDVCxNQUFNLENBQUMsV0FBVyxDQUFDLEtBQUssRUFBRSxDQUFDO1FBQy9CO1lBQ0ksT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsZUFBZSxHQUFHLFVBQVUsR0FBRyxrQkFBa0IsQ0FBQyxDQUFDO0lBQ2pGLENBQUM7QUFDTCxDQUFDLENBQUEifQ==

View File

@ -1,4 +1,12 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
export declare let prepare: (serviceArg: string) => plugins.q.Promise<{}>;
/**
* defines possible prepare services
*/
export declare type TPrepService = "npm" | "docker" | "docker-gitlab" | "ssh";
/**
* the main exported prepare function
* @param servieArg describes the service to prepare
*/
export declare let prepare: (serviceArg: TPrepService) => plugins.q.Promise<{}>;

18
dist/npmci.prepare.js vendored
View File

@ -3,6 +3,9 @@ require("typings-global");
const plugins = require("./npmci.plugins");
const env = require("./npmci.env");
const sshModule = require("./npmci.ssh");
/**
* authenticates npm with token from env var
*/
let npm = function () {
let done = plugins.q.defer();
let npmrcPrefix = "//registry.npmjs.org/:_authToken=";
@ -19,6 +22,9 @@ let npm = function () {
done.resolve();
return done.promise;
};
/**
* logs in docker
*/
let docker = function () {
let done = plugins.q.defer();
env.setDockerRegistry("docker.io");
@ -35,6 +41,9 @@ let docker = function () {
done.resolve();
return done.promise;
};
/**
* prepare docker for gitlab registry
*/
let dockerGitlab = function () {
let done = plugins.q.defer();
env.setDockerRegistry("registry.gitlab.com");
@ -42,12 +51,19 @@ let dockerGitlab = function () {
done.resolve();
return done.promise;
};
/**
* prepare ssh
*/
let ssh = function () {
let done = plugins.q.defer();
sshModule.ssh()
.then(done.resolve);
return done.promise;
};
/**
* the main exported prepare function
* @param servieArg describes the service to prepare
*/
exports.prepare = function (serviceArg) {
switch (serviceArg) {
case "npm":
@ -62,4 +78,4 @@ exports.prepare = function (serviceArg) {
break;
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHJlcGFyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnByZXBhcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRTNDLE1BQVksR0FBRyxXQUFNLGFBQ3JCLENBQUMsQ0FEaUM7QUFDbEMsTUFBWSxTQUFTLFdBQU0sYUFFM0IsQ0FBQyxDQUZ1QztBQUV4QyxJQUFJLEdBQUcsR0FBRztJQUNOLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFFN0IsSUFBSSxXQUFXLEdBQVUsbUNBQW1DLENBQUM7SUFDN0QsSUFBSSxRQUFRLEdBQVUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUM7SUFDbEQsSUFBSSxlQU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FNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUE7QUFFRDs7R0FFRztBQUNILElBQUksR0FBRyxHQUFHO0lBQ04sSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixTQUFTLENBQUMsR0FBRyxFQUFFO1NBQ1YsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUN4QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUM7QUFFRjs7O0dBR0c7QUFDUSxlQUFPLEdBQUcsVUFBUyxVQUF1QjtJQUNqRCxNQUFNLENBQUMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDO1FBQ2pCLEtBQUssS0FBSztZQUNOLE1BQU0sQ0FBQyxHQUFHLEVBQUUsQ0FBQztRQUNqQixLQUFLLFFBQVE7WUFDVCxNQUFNLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDcEIsS0FBSyxlQUFlO1lBQ2hCLE1BQU0sQ0FBQyxZQUFZLEVBQUUsQ0FBQztRQUMxQixLQUFLLEtBQUs7WUFDTixNQUFNLENBQUMsR0FBRyxFQUFFLENBQUM7UUFDakI7WUFDSSxLQUFLLENBQUM7SUFDZCxDQUFDO0FBQ0wsQ0FBQyxDQUFBIn0=

View File

@ -4,9 +4,9 @@ import * as plugins from "./npmci.plugins";
/**
* type of supported services
*/
export declare type registryService = "npm" | "docker";
export declare type TPubService = "npm" | "docker";
/**
* the main exported publish function.
* @param registryServiceArg the serviceArg
* @param pubServiceArg references targeted service to publish to
*/
export declare let publish: (registryServiceArg?: registryService) => plugins.q.Promise<{}>;
export declare let publish: (pubServiceArg?: TPubService) => plugins.q.Promise<{}>;

10
dist/npmci.publish.js vendored
View File

@ -6,10 +6,10 @@ const npmci_bash_1 = require("./npmci.bash");
const NpmciBuildDocker = require("./npmci.build.docker");
/**
* the main exported publish function.
* @param registryServiceArg the serviceArg
* @param pubServiceArg references targeted service to publish to
*/
exports.publish = (registryServiceArg = "npm") => {
switch (registryServiceArg) {
exports.publish = (pubServiceArg = "npm") => {
switch (pubServiceArg) {
case "npm":
return publishNpm();
case "docker":
@ -17,7 +17,7 @@ exports.publish = (registryServiceArg = "npm") => {
}
};
/**
* tries to publish project at cwd to npm
* tries to publish current cwd to NPM registry
*/
let publishNpm = function () {
let done = plugins.q.defer();
@ -40,4 +40,4 @@ let publishDocker = function () {
.then(done.resolve);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLGdDQUFzQixpQkFBaUIsQ0FBQyxDQUFBO0FBQ3hDLDZCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUVsQyxNQUFZLGdCQUFnQixXQUFNLHNCQUtsQyxDQUFDLENBTHVEO0FBT3hEOzs7R0FHRztBQUNRLGVBQU8sR0FBRyxDQUFDLGtCQUFrQixHQUFtQixLQUFLO0lBQzVELE1BQU0sQ0FBQyxDQUFDLGtCQUFrQixDQUFDLENBQUEsQ0FBQztRQUN4QixLQUFLLEtBQUs7WUFDTixNQUFNLENBQUMsVUFBVSxFQUFFLENBQUM7UUFDeEIsS0FBSyxRQUFRO1lBQ1QsTUFBTSxDQUFDLGFBQWEsRUFBRSxDQUFDO0lBQy9CLENBQUM7QUFDTCxDQUFDLENBQUM7QUFFRjs7R0FFRztBQUNILElBQUksVUFBVSxHQUFJO0lBQ2QsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQ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FDdEMsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUN4QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUMifQ==

View File

@ -6,6 +6,7 @@ npmci is your friend when it comes to handling npm packages during CI builds. It
[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmci)
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmci)
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmci/docs)
[![docs](https://push.rocks/assets/repo-button-api.svg)](https://pushrocks.gitlab.io/npmci/api)
## Status for master
[![build status](https://gitlab.com/pushrocks/npmci/badges/master/build.svg)](https://gitlab.com/pushrocks/npmci/commits/master)

View File

@ -3,6 +3,9 @@ import * as paths from "./npmci.paths";
import * as NpmciEnv from "./npmci.env";
import {bashBare} from "./npmci.bash";
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
export let build = function(){
let done = plugins.q.defer();
readDockerfiles()
@ -16,8 +19,12 @@ export let build = function(){
return done.promise;
}
export let readDockerfiles = function(){
let done = plugins.q.defer();
/**
* creates instance of class Dockerfile for all Dockerfiles in cwd
* @returns Promise<Dockerfile[]>
*/
export let readDockerfiles = function():plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>();
let readDockerfilesArray:Dockerfile[] = []
plugins.gulp.src("./Dockerfile*")
.pipe(plugins.through2.obj(function(file,enc,cb){
@ -33,8 +40,13 @@ export let readDockerfiles = function(){
return done.promise;
}
export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]){
let done = plugins.q.defer();
/**
* sorts Dockerfiles into a dependency chain
* @param sortableArrayArg an array of instances of class Dockerfile
* @returns Promise<Dockerfile[]>
*/
export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]):plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>();
let sortedArray:Dockerfile[] = [];
let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg,sortedArray);
let sorterFunctionCounter:number = 0;
@ -59,8 +71,11 @@ export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]){
return done.promise;
};
export let mapDockerfiles = function(sortedArray:Dockerfile[]){
let done = plugins.q.defer();
/**
* maps local Dockerfiles dependencies to the correspoding Dockerfile class instances
*/
export let mapDockerfiles = function(sortedArray:Dockerfile[]):plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>();
sortedArray.forEach((dockerfileArg) => {
if(dockerfileArg.localBaseImageDependent){
sortedArray.forEach((dockfile2:Dockerfile) => {
@ -74,6 +89,9 @@ export let mapDockerfiles = function(sortedArray:Dockerfile[]){
return done.promise;
}
/**
* builds the correspoding real docker image for each Dockerfile class instance
*/
export let buildDockerfiles = (sortedArrayArg:Dockerfile[]) => {
let done = plugins.q.defer();
sortedArrayArg.forEach(function(dockerfileArg){
@ -83,6 +101,9 @@ export let buildDockerfiles = (sortedArrayArg:Dockerfile[]) => {
return done.promise;
}
/**
* pushes the real Dockerfile images to a Docker registry
*/
export let pushDockerfiles = function(sortedArrayArg:Dockerfile[]){
let done = plugins.q.defer();
sortedArrayArg.forEach(function(dockerfileArg){
@ -92,6 +113,10 @@ export let pushDockerfiles = function(sortedArrayArg:Dockerfile[]){
return done.promise;
}
/**
* pulls corresponding real Docker images for instances of Dockerfile from a registry.
* This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages.
*/
export let pullDockerfileImages = (sortableArrayArg:Dockerfile[],registryArg = "registry.gitlab.com") => {
let done = plugins.q.defer();
sortableArrayArg.forEach((dockerfileArg) => {
@ -101,6 +126,10 @@ export let pullDockerfileImages = (sortableArrayArg:Dockerfile[],registryArg = "
return done.promise;
}
/**
* tests all Dockerfiles in by calling class Dockerfile.test();
* @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd
*/
export let testDockerfiles = (sortedArrayArg:Dockerfile[]) => {
let done = plugins.q.defer();
sortedArrayArg.forEach(function(dockerfileArg){
@ -110,6 +139,9 @@ export let testDockerfiles = (sortedArrayArg:Dockerfile[]) => {
return done.promise;
};
/**
* class Dockerfile represents a Dockerfile on disk in npmci
*/
export class Dockerfile {
filePath:string;
repo:string;
@ -138,6 +170,10 @@ export class Dockerfile {
this.baseImage = dockerBaseImage(this.content);
this.localBaseImageDependent = false;
};
/**
* builds the Dockerfile
*/
build(){
let done = plugins.q.defer();
plugins.beautylog.info("now building Dockerfile for " + this.cleanTag);
@ -146,6 +182,10 @@ export class Dockerfile {
done.resolve();
return done.promise;
};
/**
* pushes the Dockerfile to a registry
*/
push(stageArg){
let done = plugins.q.defer();
let pushTag;
@ -162,12 +202,20 @@ export class Dockerfile {
bashBare("docker push " + pushTag);
done.resolve();
return done.promise;
}
};
/**
* pulls the Dockerfile from a registry
*/
pull(registryArg:string){
let pullTag = this.testTag;
bashBare("docker pull " + pullTag);
bashBare("docker tag " + pullTag + " " + this.buildTag);
};
/**
* tests the Dockerfile;
*/
test(){
let testFile:string = plugins.path.join(paths.NpmciTestDir,"test_" + this.version + ".sh");
let testFileExists:boolean = plugins.smartfile.fs.fileExistsSync(testFile);
@ -182,12 +230,19 @@ export class Dockerfile {
plugins.beautylog.warn("skipping tests for " + this.cleanTag + " because no testfile was found!");
}
};
/**
* gets the id of a Dockerfile
*/
getId(){
let containerId = bashBare("docker inspect --type=image --format=\"{{.Id}}\" " + this.buildTag);
return containerId;
};
}
/**
*
*/
export let dockerFileVersion = function(dockerfileNameArg:string):string{
let versionString:string;
let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/;
@ -200,12 +255,18 @@ export let dockerFileVersion = function(dockerfileNameArg:string):string{
return versionString;
}
/**
*
*/
export let dockerBaseImage = function(dockerfileContentArg:string){
let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/
let regexResultArray = baseImageRegex.exec(dockerfileContentArg)
return regexResultArray[1];
}
/**
*
*/
export let dockerTag = function(registryArg:string,repoArg:string,versionArg:string,suffixArg?:string):string{
let tagString:string;
let registry = registryArg;
@ -218,6 +279,9 @@ export let dockerTag = function(registryArg:string,repoArg:string,versionArg:str
return tagString;
};
/**
*
*/
export let cleanTagsArrayFunction = function(dockerfileArrayArg:Dockerfile[],trackingArrayArg:Dockerfile[]):string[]{
let cleanTagsArray:string[] = [];
dockerfileArrayArg.forEach(function(dockerfileArg){

View File

@ -4,13 +4,22 @@ import {bash} from "./npmci.bash";
import * as env from "./npmci.env";
import * as buildDocker from "./npmci.build.docker"
export let build = function(commandArg){
/**
* defines possible build services
*/
export type TBuildService = "docker";
/**
* builds for a specific service
*/
export let build = function(commandArg):plugins.q.Promise<any> {
switch(commandArg){
case "docker":
return buildDocker.build();
default:
plugins.beautylog.log("build target " + commandArg + " not recognised!");
}
};
return;
}

View File

@ -4,6 +4,17 @@ import {bash} from "./npmci.bash";
import * as env from "./npmci.env"
import * as sshModule from "./npmci.ssh"
//types
/**
* defines possible prepare services
*/
export type TPrepService = "npm" | "docker" | "docker-gitlab" | "ssh";
/**
* authenticates npm with token from env var
*/
let npm = function(){
let done = plugins.q.defer();
@ -22,6 +33,9 @@ let npm = function(){
return done.promise;
};
/**
* logs in docker
*/
let docker = function(){
let done = plugins.q.defer();
env.setDockerRegistry("docker.io");
@ -39,6 +53,9 @@ let docker = function(){
return done.promise;
}
/**
* prepare docker for gitlab registry
*/
let dockerGitlab = function(){
let done = plugins.q.defer();
env.setDockerRegistry("registry.gitlab.com");
@ -47,14 +64,21 @@ let dockerGitlab = function(){
return done.promise;
}
/**
* prepare ssh
*/
let ssh = function(){
let done = plugins.q.defer();
sshModule.ssh()
.then(done.resolve);
return done.promise;
}
};
export let prepare = function(serviceArg:string){
/**
* the main exported prepare function
* @param servieArg describes the service to prepare
*/
export let prepare = function(serviceArg:TPrepService){
switch (serviceArg) {
case "npm":
return npm();

View File

@ -8,14 +8,14 @@ import * as NpmciBuildDocker from "./npmci.build.docker"
/**
* type of supported services
*/
export type registryService = "npm" | "docker";
export type TPubService = "npm" | "docker";
/**
* the main exported publish function.
* @param registryServiceArg the serviceArg
* @param pubServiceArg references targeted service to publish to
*/
export let publish = (registryServiceArg:registryService = "npm") => {
switch (registryServiceArg){
export let publish = (pubServiceArg:TPubService = "npm") => {
switch (pubServiceArg){
case "npm":
return publishNpm();
case "docker":
@ -24,7 +24,7 @@ export let publish = (registryServiceArg:registryService = "npm") => {
};
/**
* tries to publish project at cwd to npm
* tries to publish current cwd to NPM registry
*/
let publishNpm = function(){
let done = plugins.q.defer();