Fix: log all pvc info

pull/273/head
Frostebite 2021-06-19 02:40:34 +01:00
parent 9fb09da753
commit b9cf74b2e6
3 changed files with 6 additions and 8 deletions

7
dist/index.js vendored
View File

@ -1720,7 +1720,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const async_wait_until_1 = __importDefault(__webpack_require__(41299));
const core = __importStar(__webpack_require__(42186));
const k8s = __importStar(__webpack_require__(89679));
const assert_1 = __webpack_require__(42357);
class KubernetesStorage {
static getPVCPhase(kubeClient, name, namespace) {
var _a;
@ -1730,6 +1729,7 @@ class KubernetesStorage {
}
static watchUntilPVCNotPending(kubeClient, name, namespace) {
return __awaiter(this, void 0, void 0, function* () {
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'; }), {
timeout: 500000,
intervalBetweenAttempts: 15000,
@ -1737,7 +1737,7 @@ class KubernetesStorage {
});
}
static createPersistentVolumeClaim(buildParameters, pvcName, kubeClient, namespace) {
var _a, _b;
var _a;
return __awaiter(this, void 0, void 0, function* () {
if (buildParameters.kubeVolume) {
core.info(buildParameters.kubeVolume);
@ -1760,8 +1760,7 @@ class KubernetesStorage {
},
};
const result = yield kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
core.info(`Persistent Volume Claim ${(_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name} created`);
assert_1.strict.strictEqual((_b = result.body.metadata) === null || _b === void 0 ? void 0 : _b.name, pvcName);
core.info(`Persistent Volume Claim ${(_a = result.body.metadata) === null || _a === void 0 ? void 0 : _a.name} ${pvcName} created`);
});
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -2,13 +2,13 @@ import waitUntil from 'async-wait-until';
import * as core from '@actions/core';
import * as k8s from '@kubernetes/client-node';
import BuildParameters from '../build-parameters';
import { strict as assert } from 'assert';
class KubernetesStorage {
public static async getPVCPhase(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
return (await kubeClient.readNamespacedPersistentVolumeClaim(name, namespace)).body.status?.phase;
}
public static async watchUntilPVCNotPending(kubeClient: k8s.CoreV1Api, name: string, namespace: string) {
core.info(`watch Until PVC Not Pending ${name} ${namespace}`);
await waitUntil(async () => (await this.getPVCPhase(kubeClient, name, namespace)) !== 'Pending', {
timeout: 500000,
intervalBetweenAttempts: 15000,
@ -42,8 +42,7 @@ class KubernetesStorage {
},
};
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
core.info(`Persistent Volume Claim ${result.body.metadata?.name} created`);
assert.strictEqual(result.body.metadata?.name, pvcName);
core.info(`Persistent Volume Claim ${result.body.metadata?.name} ${pvcName} created`);
}
}