Wait until kubernetes job deleted
parent
51239059c9
commit
488e39420d
|
|
@ -1276,6 +1276,7 @@ const kubernetes_storage_1 = __importDefault(__webpack_require__(38941));
|
|||
const kubernetes_logging_1 = __importDefault(__webpack_require__(37290));
|
||||
const kubernetes_secret_1 = __importDefault(__webpack_require__(35129));
|
||||
const kubernetes_utils_1 = __importDefault(__webpack_require__(92040));
|
||||
const async_wait_until_1 = __importDefault(__webpack_require__(41299));
|
||||
class Kubernetes {
|
||||
constructor(buildParameters) {
|
||||
this.buildId = '';
|
||||
|
|
@ -1474,6 +1475,10 @@ class Kubernetes {
|
|||
try {
|
||||
yield this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
||||
yield this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace);
|
||||
yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { return (yield this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body === null; }), {
|
||||
timeout: 500000,
|
||||
intervalBetweenAttempts: 15000,
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
core.info('Failed to cleanup, error:');
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -8,6 +8,7 @@ import RemoteBuilderEnvironmentVariable from './remote-builder-environment-varia
|
|||
import KubernetesLogging from './kubernetes-logging';
|
||||
import KubernetesSecret from './kubernetes-secret';
|
||||
import KubernetesUtilities from './kubernetes-utils';
|
||||
import waitUntil from 'async-wait-until';
|
||||
|
||||
class Kubernetes implements RemoteBuilderProviderInterface {
|
||||
private kubeConfig: k8s.KubeConfig;
|
||||
|
|
@ -243,6 +244,13 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
|||
try {
|
||||
await this.kubeClientBatch.deleteNamespacedJob(this.jobName, this.namespace);
|
||||
await this.kubeClient.deleteNamespacedSecret(this.secretName, this.namespace);
|
||||
await waitUntil(
|
||||
async () => (await this.kubeClientBatch.readNamespacedJob(this.jobName, this.namespace)).body === null,
|
||||
{
|
||||
timeout: 500000,
|
||||
intervalBetweenAttempts: 15000,
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
core.info('Failed to cleanup, error:');
|
||||
core.error(JSON.stringify(error, undefined, 4));
|
||||
|
|
|
|||
Loading…
Reference in New Issue