mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-16 13:06:53 -07:00
9d475434d3
* Rename "Cloud Runner" to "Orchestrator" across entire codebase Breaking change: All CloudRunner classes, options, environment variables, and action.yml inputs have been renamed to Orchestrator equivalents. - Renamed src/model/cloud-runner/ directory to src/model/orchestrator/ - Renamed all cloud-runner-* files to orchestrator-* - Renamed all CloudRunner* classes to Orchestrator* (15+ classes) - Renamed all cloudRunner* properties to orchestrator* equivalents - Renamed CLOUD_RUNNER_* env vars to ORCHESTRATOR_* - Updated action.yml [CloudRunner] markers to [Orchestrator] - Updated workflow files and package.json test scripts - Updated all runtime strings (cache paths, log messages, branch refs) - Rebuilt dist/index.js No backward compatibility layer is provided. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove tracked log/temp files and add to .gitignore Remove $LOG_FILE and temp/job-log.txt debug artifacts that should not be in the repository. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { CoreV1Api } from '@kubernetes/client-node';
|
|
import OrchestratorSecret from '../../options/orchestrator-secret';
|
|
import * as k8s from '@kubernetes/client-node';
|
|
import OrchestratorLogger from '../../services/core/orchestrator-logger';
|
|
import * as base64 from 'base-64';
|
|
|
|
class KubernetesSecret {
|
|
static async createSecret(
|
|
secrets: OrchestratorSecret[],
|
|
secretName: string,
|
|
namespace: string,
|
|
kubeClient: CoreV1Api,
|
|
) {
|
|
try {
|
|
const secret = new k8s.V1Secret();
|
|
secret.apiVersion = 'v1';
|
|
secret.kind = 'Secret';
|
|
secret.type = 'Opaque';
|
|
secret.metadata = {
|
|
name: secretName,
|
|
};
|
|
secret.data = {};
|
|
for (const buildSecret of secrets) {
|
|
secret.data[buildSecret.ParameterKey] = base64.encode(buildSecret.ParameterValue);
|
|
}
|
|
OrchestratorLogger.log(`Creating secret: ${secretName}`);
|
|
const existingSecrets = await kubeClient.listNamespacedSecret(namespace);
|
|
const mappedSecrets = existingSecrets.body.items.map((x) => {
|
|
return x.metadata?.name || `no name`;
|
|
});
|
|
|
|
OrchestratorLogger.log(
|
|
`ExistsAlready: ${mappedSecrets.includes(secretName)} SecretsCount: ${mappedSecrets.length}`,
|
|
);
|
|
await new Promise((promise) => setTimeout(promise, 15000));
|
|
await kubeClient.createNamespacedSecret(namespace, secret);
|
|
OrchestratorLogger.log('Created secret');
|
|
} catch (error) {
|
|
OrchestratorLogger.log(`Created secret failed ${error}`);
|
|
throw new Error(`Failed to create kubernetes secret`);
|
|
}
|
|
}
|
|
}
|
|
|
|
export default KubernetesSecret;
|