fix(ci): Fix Docker images and npm registry URL in CI workflows

This commit is contained in:
2024-10-27 19:50:39 +01:00
parent 320b3ed9eb
commit 8f49f0cb4f
79 changed files with 2052 additions and 823 deletions

View File

@ -0,0 +1,16 @@
import * as plugins from '../plugins.js';
export interface ICloudlyConfig {
cfToken?: string;
hetznerToken?: string;
environment?: 'production' | 'integration';
letsEncryptEmail?: string;
letsEncryptPrivateKey?: string;
jwtKeypair?: plugins.tsclass.network.IJwtKeypair;
mongoDescriptor?: plugins.tsclass.database.IMongoDescriptor;
s3Descriptor?: plugins.tsclass.storage.IS3Descriptor;
publicUrl?: string;
publicPort?: string;
sslMode?: 'none' | 'letsencrypt' | 'external';
servezoneAdminaccount?: string;
}

View File

@ -0,0 +1,36 @@
import * as plugins from '../plugins.js';
import { type IDockerRegistryInfo } from '../data/docker.js';
import type { IServer } from './server.js';
export interface ICluster {
id: string;
data: {
name: string;
/**
* a cluster has a machine user that governs access rights.
*/
userId: string;
/**
* how can the cluster reach cloudly
*/
cloudlyUrl?: string;
/**
* what servers are expected to be part of the cluster
*/
servers: IServer[];
/**
* ACME info. This is used to get SSL certificates.
*/
acmeInfo: {
serverAddress: string;
serverSecret: string;
};
sshKeys: plugins.tsclass.network.ISshKey[];
};
}

View File

@ -0,0 +1 @@
export type TConfigType = 'server' | 'cluster' | 'coreflow' | 'service';

View File

@ -0,0 +1,14 @@
import * as plugins from '../plugins.js';
/**
* results from a DeploymentDirective
* tracks the status of a deployment
*/
export interface IDeployment {
id: string;
deploymentDirectiveId: string;
affectedServiceIds: string[];
usedImageId: string;
deploymentLog: string[];
status: 'scheduled' | 'running' | 'deployed' | 'failed';
}

View File

@ -0,0 +1,14 @@
import type { IServiceRessources } from "./docker.js";
/**
* used for tellilng a cluster about a disired deployment
* and specifies its configuration
*/
export interface IDeploymentDirective {
id: string;
name: string;
imageClaim: string;
ports: { hostPort: number; containerPort: number }[];
environment: { [key: string]: string };
resources?: IServiceRessources;
}

View File

@ -0,0 +1,15 @@
import * as plugins from '../plugins.js';
export interface IDockerRegistryInfo {
serveraddress: string;
username: string;
password: string;
}
export interface IServiceRessources {
cpuLimit?: number;
cpuReservation?: number;
memorySizeLimitMB?: number;
memorySizeReservationMB?: number;
volumeMounts?: plugins.tsclass.container.IVolumeMount[];
}

View File

@ -0,0 +1,6 @@
export interface IEnvBundle {
environment: string;
timeSensitive: boolean;
configKeyValueObject: {[key: string]: string};
}

View File

@ -0,0 +1,11 @@
import * as plugins from '../plugins.js';
export interface IEvent_Cloudly_ContainerVersionNotification
extends plugins.typedrequestInterfaces.implementsTR<
plugins.typedrequestInterfaces.ITypedEvent<plugins.tsclass.container.IContainer>,
IEvent_Cloudly_ContainerVersionNotification
> {
name: 'newContainerVersion';
uniqueEventId: string;
payload: plugins.tsclass.container.IContainer;
}

View File

@ -0,0 +1,15 @@
import * as plugins from '../plugins.js';
export interface IImage {
id: string;
data: {
name: string;
description: string;
versions: Array<{
versionString: string;
storagePath?: string;
size: number;
createdAt: number;
}>;
};
}

View File

@ -0,0 +1,17 @@
export * from './cloudlyconfig.js';
export * from './cluster.js';
export * from './config.js';
export * from './deployment.js';
export * from './deploymentdirective.js';
export * from './docker.js';
export * from './env.js';
export * from './event.js';
export * from './image.js';
export * from './secretbundle.js';
export * from './secretgroup.js'
export * from './server.js';
export * from './service.js';
export * from './status.js';
export * from './traffic.js';
export * from './user.js';
export * from './version.js';

View File

@ -0,0 +1,42 @@
export interface ISecretBundle {
id: string;
data: {
name: string;
description: string;
/**
* determines if the secret is a service or an external secret
* if external secret additional checks are put in place to protect the secret
*/
type: 'service' | 'npmci' | 'gitzone' | 'external';
/**
* You can add specific secret groups using this
*/
includedSecretGroupIds: string[];
/**
* You can add specific tags using this
*/
includedTags: {
key: string;
value?: string;
}[];
/**
* add images
*/
includedImages: {
imageId: string;
permissions: ('read' | 'write')[];
}[];
/**
* authrozations select a specific environment of a config bundle
*/
authorizations: Array<{
secretAccessKey: string;
environment: string;
}>;
};
}

View File

@ -0,0 +1,54 @@
export interface ISecretGroup {
/**
* the insatnce id. This should be a random id, except for default
*/
id: string;
data: {
name: string;
description: string;
/**
* the key of the secretgroup like CI_RUNNER_TOKEN
*/
key: string;
/**
* the priority of the secretgroup
* will be used to determine which secretgroup will be used
* when there are multiple secretgroups with the same key
*/
priority?: number;
/**
* any tags that can be used to filter the secretgroup
* can be used for putting secrets into projects
*/
tags: {
key: string;
value: string;
}[];
/**
* the values for this secretGroup
*/
environments: {
[key: string]: {
value: string;
/**
* can be used to update the value
*/
updateToken?: string;
/**
* the linux timestamp of the last update
*/
lastUpdated: number;
history: {
timestamp: string;
value: string;
}[];
};
};
};
}

View File

@ -0,0 +1,36 @@
import * as plugins from '../plugins.js';
import { type IDockerRegistryInfo } from './docker.js';
export interface IServerMetrics {
serverId: string;
cpuUsageInPercent: number;
memoryUsageinMB: number;
memoryAvailableInMB: number;
containerCount: number;
containerMetrics: Array<{
containerId: string;
containerName: string;
cpuUsageInPercent: number;
memoryUsageInMB: number;
}>;
}
export interface IServer {
id: string;
data: {
type: 'baremetal' | 'hetzner';
assignedClusterId: string;
/**
* a list of debian packages to be installed
*/
requiredDebianPackages: string[];
/**
* a list of SSH keys to deploy
*/
sshKeys: plugins.tsclass.network.ISshKey[];
};
}

View File

@ -0,0 +1,26 @@
import type { IServiceRessources } from './docker.js';
export interface IService {
id: string;
data: {
name: string;
imageId: string;
imageVersion: string;
environment: { [key: string]: string };
secretBundleId: string;
scaleFactor: number;
balancingStrategy: 'round-robin' | 'least-connections';
ports: {
web: number;
custom?: { [domain: string]: string };
};
resources?: IServiceRessources;
domains: {
name: string;
port?: number;
protocol?: 'http' | 'https' | 'ssh';
}[];
deploymentIds: string[];
deploymentDirectiveIds: string[];
};
}

View File

@ -0,0 +1,20 @@
import * as plugins from '../plugins.js';
export interface IClusterStatus {
name: string;
ip: string;
nodesCount: number;
containersUnderManagementCount: number;
nodeStatusId: string;
containerStatusArray: IContainerStatus[];
}
export interface INodeStatus {
nodeId: string;
}
export interface IContainerStatus {
serviceName: string;
dockerImageUrl: string;
dockerImageVersion: string;
}

View File

@ -0,0 +1,5 @@
import * as plugins from '../plugins.js';
interface IReverseProxyConfig extends plugins.tsclass.network.IReverseProxyConfig {}
export { type IReverseProxyConfig };

View File

@ -0,0 +1,30 @@
export interface IToken {
token: string;
expiresAt: number;
assignedRoles: string[];
}
/**
* an identity is assumed by authentication as a user
* an identity is ephemeral and has to be renewed regularly
*/
export interface IIdentity {
name: string;
userId: string;
type: 'machine' | 'human';
role: 'admin' | 'user' | 'api' | 'cluster';
expiresAt: number;
/** the jwt token should contain above data for verification */
jwt: string;
}
export interface IUser {
id: string;
data: {
type: 'machine' | 'human';
role: 'admin' | 'user' | 'api' | 'cluster';
username?: string;
password?: string;
tokens?: IToken[];
}
}

View File

@ -0,0 +1,11 @@
export interface IContainerVersionData {
/**
* the docker image url
* example: registry.gitlab.com/hosttoday/ht-docker-node:latest
*/
dockerImageUrl: string;
/**
* the docker image version. Note: This is different from docker tags that are often used for versions.
*/
dockerImageVersion: string;
}