Compare commits

...

36 Commits

Author SHA1 Message Date
693bda6a49 3.1.62 2019-10-02 11:56:06 +02:00
bfe3e266ee fix(core): update 2019-10-02 11:56:05 +02:00
5f33ebd8a7 3.1.61 2019-10-02 11:33:52 +02:00
f78c80e100 fix(core): update 2019-10-02 11:33:52 +02:00
f4d8656831 3.1.60 2019-09-01 14:21:30 +02:00
2290081ef0 fix(core): update 2019-09-01 14:21:30 +02:00
189d02a16f 3.1.59 2019-09-01 14:11:35 +02:00
55aee04334 fix(core): update 2019-09-01 14:11:35 +02:00
0e407b9b9d 3.1.58 2019-09-01 13:54:00 +02:00
24095bbd40 fix(core): update 2019-09-01 13:54:00 +02:00
f97ee94b5a 3.1.57 2019-09-01 13:51:12 +02:00
4cf7aea374 fix(core): update 2019-09-01 13:51:11 +02:00
6ab5e9cb30 3.1.56 2019-09-01 13:49:28 +02:00
95c1145bf5 3.1.55 2019-09-01 13:49:12 +02:00
ea04a1b788 fix(core): update 2019-09-01 13:49:11 +02:00
3bc2499d09 3.1.54 2019-09-01 13:46:03 +02:00
1f5967ac45 fix(core): update 2019-09-01 13:46:03 +02:00
fd952f086b 3.1.53 2019-09-01 13:45:19 +02:00
79500cb2c2 fix(core): update 2019-09-01 13:45:18 +02:00
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
8 changed files with 1936 additions and 283 deletions

2122
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@shipzone/npmci", "name": "@shipzone/npmci",
"version": "3.1.43", "version": "3.1.62",
"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",
@@ -9,8 +9,8 @@
"npmci": "cli.js" "npmci": "cli.js"
}, },
"scripts": { "scripts": {
"test": "(rm -f config.json) && tstest test/", "test": "tstest test/",
"build": "(rm -f config.json) && tsbuild && (npm run testVersion)", "build": "tsbuild && (npm run testVersion)",
"testVersion": "(cd test/assets/ && node ../../cli.js -v)" "testVersion": "(cd test/assets/ && node ../../cli.js -v)"
}, },
"repository": { "repository": {
@@ -26,32 +26,33 @@
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.17", "@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.6", "@gitzone/tsrun": "^1.2.6",
"@gitzone/tstest": "^1.0.24", "@gitzone/tstest": "^1.0.27",
"@pushrocks/tapbundle": "^3.0.13", "@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.2", "@types/node": "^12.7.9",
"tslint": "^5.19.0", "tslint": "^5.20.0",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.24",
"@pushrocks/lik": "^3.0.11", "@pushrocks/lik": "^3.0.11",
"@pushrocks/npmextra": "^3.0.5", "@pushrocks/npmextra": "^3.0.7",
"@pushrocks/projectinfo": "^4.0.2", "@pushrocks/projectinfo": "^4.0.2",
"@pushrocks/qenv": "^4.0.2", "@pushrocks/qenv": "^4.0.6",
"@pushrocks/smartanalytics": "^2.0.15", "@pushrocks/smartanalytics": "^2.0.15",
"@pushrocks/smartcli": "^3.0.7", "@pushrocks/smartcli": "^3.0.7",
"@pushrocks/smartdelay": "^2.0.3", "@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartfile": "^7.0.2", "@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartgit": "^1.0.13", "@pushrocks/smartgit": "^1.0.13",
"@pushrocks/smartlog": "^2.0.19", "@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartlog-destination-local": "^8.0.2", "@pushrocks/smartlog-destination-local": "^8.0.2",
"@pushrocks/smartparam": "^1.0.4", "@pushrocks/smartparam": "^1.0.4",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrequest": "^1.1.23", "@pushrocks/smartrequest": "^1.1.36",
"@pushrocks/smartshell": "^2.0.23", "@pushrocks/smartshell": "^2.0.25",
"@pushrocks/smartsocket": "^1.1.45", "@pushrocks/smartsocket": "^1.1.49",
"@pushrocks/smartssh": "^1.2.3", "@pushrocks/smartssh": "^1.2.3",
"@pushrocks/smartstring": "^3.0.10", "@pushrocks/smartstring": "^3.0.10",
"@servezone/servezone-interfaces": "^2.0.28", "@servezone/servezone-interfaces": "^2.0.51",
"@types/shelljs": "^0.8.5", "@types/shelljs": "^0.8.5",
"@types/through2": "^2.0.34", "@types/through2": "^2.0.34",
"through2": "^3.0.1" "through2": "^3.0.1"

View File

@@ -1,8 +1,32 @@
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 announceDockerContainer(options: plugins.servezoneInterfaces.IVersionData) {} public npmciRef: Npmci;
constructor(npmciRefArg: Npmci) {
this.npmciRef = npmciRefArg;
}
public async announceDockerContainer(optionsArg: plugins.servezoneInterfaces.version.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.request.version.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 version: string;
public cleanTag: string; public cleanTag: string;
public buildTag: string; public buildTag: string;
public pushTag: string;
public containerName: string; public containerName: string;
public content: string; public content: string;
public baseImage: string; public baseImage: string;
@@ -248,7 +249,9 @@ export class Dockerfile {
public async build() { public async build() {
logger.log('info', 'now building Dockerfile for ' + this.cleanTag); logger.log('info', 'now building Dockerfile for ' + this.cleanTag);
const buildArgsString = await Dockerfile.getDockerBuildArgs(this.npmciDockerManagerRef); 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); await bash(buildCommand);
return; return;
} }
@@ -257,15 +260,24 @@ export class Dockerfile {
* pushes the Dockerfile to a registry * pushes the Dockerfile to a registry
*/ */
public async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) { public async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
const pushTag = Dockerfile.getDockerTagString( this.pushTag = Dockerfile.getDockerTagString(
this.npmciDockerManagerRef, this.npmciDockerManagerRef,
dockerRegistryArg.registryUrl, dockerRegistryArg.registryUrl,
this.repo, this.repo,
this.version, this.version,
versionSuffix versionSuffix
); );
await bash(`docker tag ${this.buildTag} ${pushTag}`); await bash(`docker tag ${this.buildTag} ${this.pushTag}`);
await bash(`docker push ${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

@@ -32,7 +32,7 @@ export class NpmciGitManager {
public mirror = async () => { public mirror = async () => {
const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN; const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN;
const githubUser = process.env.NPMCI_GIT_GITHUBGROUP || this.npmciRef.npmciEnv.repo.user; const githubUser = process.env.NPMCI_GIT_GITHUBGROUP || this.npmciRef.npmciEnv.repo.user;
const githubRepo = process.env.NPMCI_GIT_GITHUB || this.npmciRef.npmciEnv.repo; const githubRepo = process.env.NPMCI_GIT_GITHUB || this.npmciRef.npmciEnv.repo.repo;
if ( if (
this.npmciRef.npmciConfig.getConfig().projectInfo.npm.packageJson.private === true || this.npmciRef.npmciConfig.getConfig().projectInfo.npm.packageJson.private === true ||
this.npmciRef.npmciConfig.getConfig().npmAccessLevel === 'private' this.npmciRef.npmciConfig.getConfig().npmAccessLevel === 'private'

View File

@@ -133,8 +133,8 @@ export class NpmciNpmManager {
await bash(`npm -v`); await bash(`npm -v`);
// -> build it // -> build it
await bash(`npm install`); await this.install();
await bash(`npm run build`); await this.build();
logger.log('success', `Nice!!! The build for the publication was successfull!`); logger.log('success', `Nice!!! The build for the publication was successfull!`);
logger.log('info', `Lets clean up so we don't publish any packages that don't belong to us:`); logger.log('info', `Lets clean up so we don't publish any packages that don't belong to us:`);
@@ -152,7 +152,12 @@ export class NpmciNpmManager {
public async install(): Promise<void> { public async install(): Promise<void> {
logger.log('info', 'now installing dependencies:'); logger.log('info', 'now installing dependencies:');
await bash('npm install'); await bash('npm ci');
}
public async build(): Promise<void> {
logger.log('info', 'now building the project:');
await bash('npm run build');
} }
public async test(): Promise<void> { public async test(): Promise<void> {

View File

@@ -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);

View File

@@ -3,6 +3,11 @@ 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';