Compare commits

...

19 Commits

Author SHA1 Message Date
6c58864fcf 3.1.52 2019-09-01 13:44:22 +02:00
7ea3ac182d fix(core): update 2019-09-01 13:44:21 +02:00
8979d26005 3.1.51 2019-09-01 13:41:04 +02:00
c8876dac88 fix(core): update 2019-09-01 13:41:03 +02:00
9c8a257c2a 3.1.50 2019-08-30 18:40:00 +02:00
8b77930ece fix(core): update 2019-08-30 18:39:59 +02:00
ba672d030f 3.1.49 2019-08-30 14:51:04 +02:00
8ad7e016e7 fix(core): update 2019-08-30 14:51:03 +02:00
d843311d7b 3.1.48 2019-08-30 13:30:16 +02:00
14ef2cfa9b 3.1.47 2019-08-30 12:24:01 +02:00
648effcf86 fix(core): update 2019-08-30 12:24:00 +02:00
572738e88f 3.1.46 2019-08-30 10:40:38 +02:00
129ae93044 fix(core): update 2019-08-30 10:40:38 +02:00
e910892231 3.1.45 2019-08-30 10:38:48 +02:00
6d9cabf7ee fix(core): update 2019-08-30 10:38:47 +02:00
7c7787e811 3.1.44 2019-08-29 20:56:03 +02:00
bde26cc312 fix(core): update 2019-08-29 20:56:02 +02:00
29e81f3ae7 3.1.43 2019-08-29 20:38:45 +02:00
6337b20d62 fix(core): update 2019-08-29 20:38:44 +02:00
13 changed files with 126 additions and 55 deletions

View File

@@ -1,7 +1,5 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
variables:
GIT_STRATEGY: clone
cache:
paths:
@@ -102,7 +100,7 @@ trigger:
pages:
image: hosttoday/ht-docker-dbase:npmci
services:
- docker:18-dind
- docker:stable-dind
stage: metadata
script:
- npmci command npm install -g @gitzone/tsdoc

54
package-lock.json generated
View File

@@ -1,9 +1,37 @@
{
"name": "@shipzone/npmci",
"version": "3.1.42",
"version": "3.1.52",
"lockfileVersion": 1,
"requires": true,
"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": {
"version": "7.5.5",
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz",
@@ -152,9 +180,9 @@
}
},
"@pushrocks/qenv": {
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fqenv/-/qenv-4.0.2.tgz",
"integrity": "sha512-ip/yN8etdy4lOTeNjU7dyKB8oN9eEZG3P/DhFYXDAgqEo0oDUUckEjGZadTLhjLw4wb/oQZqrZ/RjXwlCrBciQ==",
"version": "4.0.4",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fqenv/-/qenv-4.0.4.tgz",
"integrity": "sha512-nvgiY3u25mvi5wmVbEYfCDuBaz6pogwzKPxGaohMrIcNn/0MlXZ+JvkVHWK6CxExklSDbjSXsD7zfvme4GGA0g==",
"requires": {
"@pushrocks/smartfile": "^7.0.4",
"@pushrocks/smartlog": "^2.0.19"
@@ -405,9 +433,9 @@
}
},
"@pushrocks/smartshell": {
"version": "2.0.23",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartshell/-/smartshell-2.0.23.tgz",
"integrity": "sha512-+YXacX/sp4f+iBYm4vAoxrq/c8WCHnFhMaW66l3R08stl0eezW3SytoSlnr6R+JT1xqnBzIItDfCyyRC3uEVnw==",
"version": "2.0.25",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartshell/-/smartshell-2.0.25.tgz",
"integrity": "sha512-sYVHOhBRdr+CkjS+o1SDtB5058ZYxTPAYuexx2ydl2g+57KNdEcSRWN/2mOv5+NFH+tvvgtnUjC3AclC9CwJ4A==",
"requires": {
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartexit": "^1.0.15",
@@ -529,9 +557,9 @@
}
},
"@servezone/servezone-interfaces": {
"version": "2.0.28",
"resolved": "https://verdaccio.lossless.one/@servezone%2fservezone-interfaces/-/servezone-interfaces-2.0.28.tgz",
"integrity": "sha512-mlXiiLhA8PF+sXczLzuGJSz0iPxdEDkU+hiR/Tw/QfCniLeHdJFgRW8RIJYAV2jhy0JMpHINP5Nqke0tt1lK1Q=="
"version": "2.0.29",
"resolved": "https://verdaccio.lossless.one/@servezone%2fservezone-interfaces/-/servezone-interfaces-2.0.29.tgz",
"integrity": "sha512-alXB2SFD+3tVxfC0Kd8NrHlr4WyB1hSg60ydHUvzJB30fUMKMX71UlWrITxORg8UXQQy1Kw9rhFhCXnq31xxSA=="
},
"@types/body-parser": {
"version": "1.17.1",
@@ -679,9 +707,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "12.7.2",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.2.tgz",
"integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg=="
"version": "12.7.3",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.3.tgz",
"integrity": "sha512-3SiLAIBkDWDg6vFo0+5YJyHPWU9uwu40Qe+v+0MH8wRKYBimHvvAOyk3EzMrD/TrIlLYfXrqDqrg913PynrMJQ=="
},
"@types/nodegit": {
"version": "0.24.10",

View File

@@ -1,6 +1,6 @@
{
"name": "@shipzone/npmci",
"version": "3.1.42",
"version": "3.1.52",
"private": false,
"description": "node and docker in gitlab ci on steroids",
"main": "dist/index.js",
@@ -9,8 +9,8 @@
"npmci": "cli.js"
},
"scripts": {
"test": "(rm -f config.json) && tstest test/",
"build": "(rm -f config.json) && tsbuild && (npm run testVersion)",
"test": "tstest test/",
"build": "tsbuild && (npm run testVersion)",
"testVersion": "(cd test/assets/ && node ../../cli.js -v)"
},
"repository": {
@@ -28,15 +28,16 @@
"@gitzone/tsrun": "^1.2.6",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.2",
"@types/node": "^12.7.3",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@apiglobal/typedrequest": "^1.0.17",
"@pushrocks/lik": "^3.0.11",
"@pushrocks/npmextra": "^3.0.5",
"@pushrocks/projectinfo": "^4.0.2",
"@pushrocks/qenv": "^4.0.2",
"@pushrocks/qenv": "^4.0.4",
"@pushrocks/smartanalytics": "^2.0.15",
"@pushrocks/smartcli": "^3.0.7",
"@pushrocks/smartdelay": "^2.0.3",
@@ -47,11 +48,11 @@
"@pushrocks/smartparam": "^1.0.4",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.23",
"@pushrocks/smartshell": "^2.0.23",
"@pushrocks/smartshell": "^2.0.25",
"@pushrocks/smartsocket": "^1.1.45",
"@pushrocks/smartssh": "^1.2.3",
"@pushrocks/smartstring": "^3.0.10",
"@servezone/servezone-interfaces": "^2.0.28",
"@servezone/servezone-interfaces": "^2.0.29",
"@types/shelljs": "^0.8.5",
"@types/through2": "^2.0.34",
"through2": "^3.0.1"

View File

@@ -29,28 +29,34 @@ let sortableArray: npmci.Dockerfile[];
tap.test('should return valid Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci();
dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, { filePath: './Dockerfile', read: true });
dockerfile2 = new npmci.Dockerfile(npmciInstance.dockerManager, { filePath: './Dockerfile_sometag1', read: true });
dockerfile1 = new npmci.Dockerfile(npmciInstance.dockerManager, {
filePath: './Dockerfile',
read: true
});
dockerfile2 = new npmci.Dockerfile(npmciInstance.dockerManager, {
filePath: './Dockerfile_sometag1',
read: true
});
expect(dockerfile1.version).to.equal('latest');
return expect(dockerfile2.version).to.equal('sometag1');
});
tap.test('should read a directory of Dockerfiles', async () => {
const npmciInstance = new npmci.Npmci();
return npmci.Dockerfile
.readDockerfiles(npmciInstance.dockerManager)
.then(async (readDockerfilesArrayArg: npmci.Dockerfile[]) => {
return npmci.Dockerfile.readDockerfiles(npmciInstance.dockerManager).then(
async (readDockerfilesArrayArg: npmci.Dockerfile[]) => {
sortableArray = readDockerfilesArrayArg;
return expect(readDockerfilesArrayArg[1].version).to.equal('sometag1');
});
}
);
});
tap.test('should sort an array of Dockerfiles', async () => {
return npmci.Dockerfile
.sortDockerfiles(sortableArray)
.then(async (sortedArrayArg: npmci.Dockerfile[]) => {
return npmci.Dockerfile.sortDockerfiles(sortableArray).then(
async (sortedArrayArg: npmci.Dockerfile[]) => {
console.log(sortedArrayArg);
});
}
);
});
tap.test('should build all Dockerfiles', async () => {

View File

@@ -1,8 +1,30 @@
import * as plugins from '../npmci.plugins';
import {Npmci} from '../npmci.classes.npmci';
import { logger } from '../npmci.logging';
/**
*
* connects to cloudly
*/
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));
}
}

View File

@@ -214,6 +214,7 @@ export class Dockerfile {
public version: string;
public cleanTag: string;
public buildTag: string;
public pushTag: string;
public containerName: string;
public content: string;
public baseImage: string;
@@ -248,7 +249,9 @@ export class Dockerfile {
public async build() {
logger.log('info', 'now building Dockerfile for ' + this.cleanTag);
const buildArgsString = await Dockerfile.getDockerBuildArgs(this.npmciDockerManagerRef);
const buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`;
const buildCommand = `docker build --label="version=${
this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version
}" -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`;
await bash(buildCommand);
return;
}
@@ -257,15 +260,24 @@ export class Dockerfile {
* pushes the Dockerfile to a registry
*/
public async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
const pushTag = Dockerfile.getDockerTagString(
this.pushTag = Dockerfile.getDockerTagString(
this.npmciDockerManagerRef,
dockerRegistryArg.registryUrl,
this.repo,
this.version,
versionSuffix
);
await bash(`docker tag ${this.buildTag} ${pushTag}`);
await bash(`docker push ${pushTag}`);
await bash(`docker tag ${this.buildTag} ${this.pushTag}`);
await bash(`docker push ${this.pushTag}`);
const imageDigest = (await bash(
`docker inspect --format="{{index .RepoDigests 0}}" ${this.pushTag}`
)).split('@')[1];
console.log(`The image ${this.pushTag} has digest ${imageDigest}`);
await this.npmciDockerManagerRef.npmciRef.cloudlyConnector.announceDockerContainer({
dockerImageUrl: this.pushTag,
dockerImageVersion: this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo
.npm.version
});
}
/**

View File

@@ -3,4 +3,3 @@ import * as plugins from './mod.plugins';
import * as paths from '../npmci.paths';
import { Dockerfile } from './mod.classes.dockerfile';

View File

@@ -27,7 +27,7 @@ export class NpmciGitManager {
} else {
logger.log('info', `npmci git -> cli arguments invalid! Please read the documentation.`);
}
}
};
public mirror = async () => {
const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN;
@@ -50,6 +50,7 @@ export class NpmciGitManager {
// plugins.smartgit.GitRepo;
// add the mirror
console.log(`git remote add mirror https://${githubToken}@github.com/${githubUser}/${githubRepo}.git`);
await bash(
`git remote add mirror https://${githubToken}@github.com/${githubUser}/${githubRepo}.git`
);
@@ -61,5 +62,5 @@ export class NpmciGitManager {
logger.log('error', `cannot find NPMCI_GIT_GITHUBTOKEN env var!`);
process.exit(1);
}
}
};
}

View File

@@ -34,7 +34,7 @@ export class Npmci {
projectId: 'gitzone',
appName: 'npmci'
});
this.cloudlyConnector = new CloudlyConnector();
this.cloudlyConnector = new CloudlyConnector(this);
this.npmciEnv = new NpmciEnv(this);
this.npmciInfo = new NpmciInfo(this);
this.npmciCli = new NpmciCli(this);

View File

@@ -106,5 +106,5 @@ export class NpmciCli {
public startParse = () => {
this.smartcli.startParse();
}
};
}

View File

@@ -51,7 +51,7 @@ export class NpmciConfig {
logger
);
this.configObject = {
this.configObject = {
projectInfo: new plugins.projectinfo.ProjectInfo(paths.cwd),
npmGlobalTools: [],
dockerRegistries: [],

View File

@@ -1,10 +1,9 @@
import * as plugins from './npmci.plugins';
import * as paths from './npmci.paths';
import { logger } from "./npmci.logging";
import { logger } from './npmci.logging';
import { Npmci } from './npmci.classes.npmci';
export class NpmciInfo {
public npmciRef: Npmci;
public projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
@@ -12,7 +11,7 @@ export class NpmciInfo {
this.npmciRef = npmciArg;
}
public printToConsole () {
public printToConsole() {
logger.log('info', `npmci version: ${this.projectInfo.version}`);
}
}

View File

@@ -3,12 +3,17 @@ import * as path from 'path';
export { path };
// @apiglobal
import * as typedrequest from '@apiglobal/typedrequest';
export {
typedrequest
};
// @servezone
import * as servezoneInterfaces from '@servezone/servezone-interfaces';
export {
servezoneInterfaces
};
export { servezoneInterfaces };
// @pushrocks
import * as npmextra from '@pushrocks/npmextra';