fix(core): update

This commit is contained in:
2021-11-07 04:20:14 +01:00
parent b8a2df66fe
commit 858d97cb5c
12 changed files with 88 additions and 100 deletions

View File

@ -14,7 +14,7 @@ export class CloudlyConnector {
}
public async announceDockerContainer(
optionsArg: plugins.servezoneInterfaces.version.IVersionData
optionsArg: plugins.tsclass.container.IContainer
) {
const cloudlyUrl = this.npmciRef.npmciConfig.getConfig().urlCloudly;
if (!cloudlyUrl) {
@ -25,11 +25,14 @@ export class CloudlyConnector {
return;
}
const typedrequest = new plugins.typedrequest.TypedRequest<plugins.servezoneInterfaces.request.version.IRequest_Any_Cloudly_VersionManager_Update>(
`https://${cloudlyUrl}/versionmanager`,
'update'
);
const typedrequest =
new plugins.typedrequest.TypedRequest<plugins.servezoneInterfaces.requests.IRequest_InformAboutNewContainerImage>(
`https://${cloudlyUrl}/versionmanager`,
'servezonestandard_InformAboutNewContainerVersion'
);
const response = await typedrequest.fire(optionsArg);
const response = await typedrequest.fire({
containerImageInfo: optionsArg
});
}
}

View File

@ -134,7 +134,9 @@ export class NpmciDockerManager {
const dockerfileArray = await Dockerfile.readDockerfiles(this)
.then(Dockerfile.sortDockerfiles)
.then(Dockerfile.mapDockerfiles);
const dockerRegistryToPushTo = await this.npmciRegistryStorage.getRegistryByUrl(dockerRegistryUrl);
const dockerRegistryToPushTo = await this.npmciRegistryStorage.getRegistryByUrl(
dockerRegistryUrl
);
if (!dockerRegistryToPushTo) {
logger.log(
'error',

View File

@ -152,9 +152,8 @@ export class Dockerfile {
suffixArg?: string
): string {
// determine wether the repo should be mapped accordingly to the registry
const mappedRepo = npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().dockerRegistryRepoMap[
registryArg
];
const mappedRepo =
npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().dockerRegistryRepoMap[registryArg];
const repo = (() => {
if (mappedRepo) {
return mappedRepo;
@ -274,9 +273,11 @@ export class Dockerfile {
).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,
registryUrl: this.pushTag,
tag: this.buildTag,
labels: [],
version:
this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version,
});
}

View File

@ -54,17 +54,21 @@ export class NpmciNpmManager {
public async prepare() {
const config = this.npmciRef.npmciConfig.getConfig();
let npmrcFileString: string = '';
await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TOKEN_NPM*', (npmEnvArg: string) => {
const npmRegistryUrl = npmEnvArg.split('|')[0];
let npmToken = npmEnvArg.split('|')[1];
if (npmEnvArg.split('|')[2] && npmEnvArg.split('|')[2] === 'plain') {
logger.log('ok', 'npm token not base64 encoded.');
} else {
logger.log('ok', 'npm token base64 encoded.');
npmToken = plugins.smartstring.base64.decode(npmToken);
await plugins.smartparam.forEachMinimatch(
process.env,
'NPMCI_TOKEN_NPM*',
(npmEnvArg: string) => {
const npmRegistryUrl = npmEnvArg.split('|')[0];
let npmToken = npmEnvArg.split('|')[1];
if (npmEnvArg.split('|')[2] && npmEnvArg.split('|')[2] === 'plain') {
logger.log('ok', 'npm token not base64 encoded.');
} else {
logger.log('ok', 'npm token base64 encoded.');
npmToken = plugins.smartstring.base64.decode(npmToken);
}
npmrcFileString += `//${npmRegistryUrl}/:_authToken="${npmToken}"\n`;
}
npmrcFileString += `//${npmRegistryUrl}/:_authToken="${npmToken}"\n`;
});
);
logger.log('info', `setting default npm registry to ${config.npmRegistryUrl}`);
npmrcFileString += `registry=https://${config.npmRegistryUrl}\n`;
@ -95,9 +99,13 @@ export class NpmciNpmManager {
let publishVerdaccioAsWell = false;
const config = this.npmciRef.npmciConfig.getConfig();
const availableRegistries: string[] = [];
await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TOKEN_NPM*', (npmEnvArg: string) => {
availableRegistries.push(npmEnvArg.split('|')[0]);
});
await plugins.smartparam.forEachMinimatch(
process.env,
'NPMCI_TOKEN_NPM*',
(npmEnvArg: string) => {
availableRegistries.push(npmEnvArg.split('|')[0]);
}
);
// -> configure package access level
if (config.npmAccessLevel) {

View File

@ -2,7 +2,8 @@ import * as plugins from './mod.plugins';
import { bash } from '../npmci.bash';
import { logger } from '../npmci.logging';
const triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
const triggerValueRegex =
/^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
export let trigger = async () => {
logger.log('info', 'now running triggers');

View File

@ -9,7 +9,7 @@ import * as typedrequest from '@apiglobal/typedrequest';
export { typedrequest };
// @servezone
import * as servezoneInterfaces from '@servezone/servezone-interfaces';
import * as servezoneInterfaces from '@servezone/interfaces';
export { servezoneInterfaces };
@ -51,6 +51,14 @@ export {
smartstring,
};
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
tsclass
}
// third party
import * as through2 from 'through2';
export { through2 };