retained workspace for k8s
parent
605fca859f
commit
a63b155b63
|
|
@ -2882,9 +2882,7 @@ class Kubernetes {
|
|||
defaultSecretsArray) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const id = buildParameters.retainWorkspace && cloud_runner_1.default.lockedWorkspace
|
||||
? cloud_runner_1.default.lockedWorkspace
|
||||
: buildParameters.buildGuid;
|
||||
const id = buildParameters.retainWorkspace ? cloud_runner_1.default.lockedWorkspace : buildParameters.buildGuid;
|
||||
this.pvcName = `unity-builder-pvc-${id}`;
|
||||
this.cleanupCronJobName = `unity-builder-cronjob-${id}`;
|
||||
this.serviceAccountName = `service-account-${buildParameters.buildGuid}`;
|
||||
|
|
@ -2991,16 +2989,15 @@ class Kubernetes {
|
|||
catch (_a) { }
|
||||
});
|
||||
}
|
||||
cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters,
|
||||
cleanup(buildGuid, buildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (buildParameters.retainWorkspace) {
|
||||
return;
|
||||
}
|
||||
cloud_runner_logger_1.default.log(`deleting PVC`);
|
||||
try {
|
||||
const promise = this.kubeClient.deleteNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
|
||||
|
|
@ -3350,8 +3347,10 @@ class KubernetesStorage {
|
|||
pvcName = buildParameters.kubeVolume;
|
||||
return;
|
||||
}
|
||||
const pvcList = (yield kubeClient.listNamespacedPersistentVolumeClaim(namespace)).body.items.map((x) => { var _a; return (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name; });
|
||||
const allPvc = (yield kubeClient.listNamespacedPersistentVolumeClaim(namespace)).body.items;
|
||||
const pvcList = allPvc.map((x) => { var _a; return (_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name; });
|
||||
cloud_runner_logger_1.default.log(`Current PVCs in namespace ${namespace}`);
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(allPvc, undefined, 4));
|
||||
cloud_runner_logger_1.default.log(JSON.stringify(pvcList, undefined, 4));
|
||||
if (pvcList.includes(pvcName)) {
|
||||
cloud_runner_logger_1.default.log(`pvc ${pvcName} already exists`);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -65,10 +65,7 @@ class Kubernetes implements ProviderInterface {
|
|||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {
|
||||
try {
|
||||
const id =
|
||||
buildParameters.retainWorkspace && CloudRunner.lockedWorkspace
|
||||
? CloudRunner.lockedWorkspace
|
||||
: buildParameters.buildGuid;
|
||||
const id = buildParameters.retainWorkspace ? CloudRunner.lockedWorkspace : buildParameters.buildGuid;
|
||||
this.pvcName = `unity-builder-pvc-${id}`;
|
||||
this.cleanupCronJobName = `unity-builder-cronjob-${id}`;
|
||||
this.serviceAccountName = `service-account-${buildParameters.buildGuid}`;
|
||||
|
|
@ -211,15 +208,16 @@ class Kubernetes implements ProviderInterface {
|
|||
}
|
||||
|
||||
async cleanup(
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildGuid: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
buildParameters: BuildParameters,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
branchName: string,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {
|
||||
if (buildParameters.retainWorkspace) {
|
||||
return;
|
||||
}
|
||||
CloudRunnerLogger.log(`deleting PVC`);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ class KubernetesStorage {
|
|||
|
||||
return;
|
||||
}
|
||||
const pvcList = (await kubeClient.listNamespacedPersistentVolumeClaim(namespace)).body.items.map(
|
||||
(x) => x.metadata?.name,
|
||||
);
|
||||
const allPvc = (await kubeClient.listNamespacedPersistentVolumeClaim(namespace)).body.items;
|
||||
const pvcList = allPvc.map((x) => x.metadata?.name);
|
||||
CloudRunnerLogger.log(`Current PVCs in namespace ${namespace}`);
|
||||
CloudRunnerLogger.log(JSON.stringify(allPvc, undefined, 4));
|
||||
CloudRunnerLogger.log(JSON.stringify(pvcList, undefined, 4));
|
||||
if (pvcList.includes(pvcName)) {
|
||||
CloudRunnerLogger.log(`pvc ${pvcName} already exists`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue