fix(core): update

This commit is contained in:
Philipp Kunz 2019-08-29 20:56:02 +02:00
parent 29e81f3ae7
commit bde26cc312
7 changed files with 75 additions and 10 deletions

28
package-lock.json generated
View File

@ -4,6 +4,34 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "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": { "@babel/code-frame": {
"version": "7.5.5", "version": "7.5.5",
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz", "resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.5.5.tgz",

View File

@ -33,6 +33,7 @@
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.17",
"@pushrocks/lik": "^3.0.11", "@pushrocks/lik": "^3.0.11",
"@pushrocks/npmextra": "^3.0.5", "@pushrocks/npmextra": "^3.0.5",
"@pushrocks/projectinfo": "^4.0.2", "@pushrocks/projectinfo": "^4.0.2",

View File

@ -1,8 +1,30 @@
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.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

@ -50,7 +50,7 @@ export class NpmciDockerManager {
`>>npmci docker ...<< cli arguments invalid... Please read the documentation.` `>>npmci docker ...<< cli arguments invalid... Please read the documentation.`
); );
} }
}; }
/** /**
* builds a cwd of Dockerfiles by triggering a promisechain * builds a cwd of Dockerfiles by triggering a promisechain
@ -62,7 +62,7 @@ export class NpmciDockerManager {
.then(Dockerfile.sortDockerfiles) .then(Dockerfile.sortDockerfiles)
.then(Dockerfile.mapDockerfiles) .then(Dockerfile.mapDockerfiles)
.then(Dockerfile.buildDockerfiles); .then(Dockerfile.buildDockerfiles);
}; }
/** /**
* login to the DockerRegistries * login to the DockerRegistries
@ -70,7 +70,7 @@ export class NpmciDockerManager {
public login = async () => { public login = async () => {
await this.prepare(); await this.prepare();
await this.npmciRegistryStorage.loginAll(); await this.npmciRegistryStorage.loginAll();
}; }
/** /**
* logs in docker * logs in docker
@ -98,7 +98,7 @@ export class NpmciDockerManager {
} }
); );
return; return;
}; }
/** /**
* pushes an image towards a registry * pushes an image towards a registry
@ -146,7 +146,7 @@ export class NpmciDockerManager {
await dockerfile.push(dockerRegistryToPushTo, suffix); await dockerfile.push(dockerRegistryToPushTo, suffix);
} }
} }
}; }
/** /**
* pulls an image * pulls an image
@ -165,7 +165,7 @@ export class NpmciDockerManager {
for (const dockerfile of dockerfileArray) { for (const dockerfile of dockerfileArray) {
await dockerfile.pull(localDockerRegistry, suffix); await dockerfile.pull(localDockerRegistry, suffix);
} }
}; }
/** /**
* tests docker files * tests docker files
@ -173,5 +173,5 @@ export class NpmciDockerManager {
public test = async () => { public test = async () => {
await this.prepare(); await this.prepare();
return await Dockerfile.readDockerfiles(this).then(Dockerfile.testDockerfiles); return await Dockerfile.readDockerfiles(this).then(Dockerfile.testDockerfiles);
}; }
} }

View File

@ -266,6 +266,13 @@ export class Dockerfile {
); );
await bash(`docker tag ${this.buildTag} ${pushTag}`); await bash(`docker tag ${this.buildTag} ${pushTag}`);
await bash(`docker push ${pushTag}`); await bash(`docker push ${pushTag}`);
const imageDigest = (await bash(
`docker inspect --format='{{index .RepoDigests 0}}' ${pushTag}`
)).split('@')[1];
await this.npmciDockerManagerRef.npmciRef.cloudlyConnector.announceDockerContainer({
dockerImageUrl: pushTag,
dockerImageVersion: imageDigest
});
} }
/** /**

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,13 @@ 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';