Catch errors during get PVC Phase
parent
b00a0baa34
commit
4ee780c5c8
|
|
@ -1585,8 +1585,8 @@ class KubernetesJobSpecFactory {
|
||||||
command: [
|
command: [
|
||||||
'bin/bash',
|
'bin/bash',
|
||||||
'-c',
|
'-c',
|
||||||
`cd /data/builder/action/steps;
|
`cd /data/builder/action/steps;
|
||||||
chmod +x /return_license.sh;
|
chmod +x /return_license.sh;
|
||||||
/return_license.sh;`,
|
/return_license.sh;`,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -1887,17 +1887,31 @@ class KubernetesStorage {
|
||||||
static getPVCPhase(kubeClient, name, namespace) {
|
static getPVCPhase(kubeClient, name, namespace) {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
return (_a = (yield kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status) === null || _a === void 0 ? void 0 : _a.phase;
|
try {
|
||||||
|
return (_a = (yield kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status) === null || _a === void 0 ? void 0 : _a.phase;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.error('Failed to get PVC phase');
|
||||||
|
core.error(JSON.stringify(error, undefined, 4));
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static watchUntilPVCNotPending(kubeClient, name, namespace) {
|
static watchUntilPVCNotPending(kubeClient, name, namespace) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
|
try {
|
||||||
core.info(`${yield this.getPVCPhase(kubeClient, name, namespace)}`);
|
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
|
||||||
yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { return (yield this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending'; }), {
|
core.info(`${yield this.getPVCPhase(kubeClient, name, namespace)}`);
|
||||||
timeout: 500000,
|
yield async_wait_until_1.default(() => __awaiter(this, void 0, void 0, function* () { return (yield this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending'; }), {
|
||||||
intervalBetweenAttempts: 15000,
|
timeout: 500000,
|
||||||
});
|
intervalBetweenAttempts: 15000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.error('Failed to watch PVC');
|
||||||
|
core.error(JSON.stringify(error, undefined, 4));
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static createPVC(pvcName, buildParameters, kubeClient, namespace) {
|
static createPVC(pvcName, buildParameters, kubeClient, namespace) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -31,16 +31,28 @@ class KubernetesStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getPVCPhase(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
public static async getPVCPhase(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||||
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
|
try {
|
||||||
|
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
|
||||||
|
} catch (error) {
|
||||||
|
core.error('Failed to get PVC phase');
|
||||||
|
core.error(JSON.stringify(error, undefined, 4));
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
|
||||||
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
|
try {
|
||||||
core.info(`${await this.getPVCPhase(kubeClient, name, namespace)}`);
|
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
|
||||||
await waitUntil(async () => (await this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending', {
|
core.info(`${await this.getPVCPhase(kubeClient, name, namespace)}`);
|
||||||
timeout: 500000,
|
await waitUntil(async () => (await this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending', {
|
||||||
intervalBetweenAttempts: 15000,
|
timeout: 500000,
|
||||||
});
|
intervalBetweenAttempts: 15000,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.error('Failed to watch PVC');
|
||||||
|
core.error(JSON.stringify(error, undefined, 4));
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async createPVC(
|
private static async createPVC(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue