Assert PVC created name is === input name

pull/273/head
Frostebite 2021-06-19 01:01:34 +01:00
parent adf74e9bde
commit d1dc644ccf
3 changed files with 29 additions and 25 deletions

50
dist/index.js vendored
View File

@ -1513,8 +1513,8 @@ class Kubernetes {
command: [
'bin/bash',
'-c',
`cd /data/builder/action/steps;
chmod +x /return_license.sh;
`cd /data/builder/action/steps;
chmod +x /return_license.sh;
/return_license.sh;`,
],
},
@ -1571,16 +1571,16 @@ class Kubernetes {
yield this.runJob([
'/bin/ash',
'-c',
`apk update;
apk add git-lfs;
ls /credentials/
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
cd /data;
git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git repo;
git clone https://github.com/webbertakken/unity-builder.git builder;
cd repo;
git checkout $GITHUB_SHA;
ls
`apk update;
apk add git-lfs;
ls /credentials/
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
cd /data;
git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git repo;
git clone https://github.com/webbertakken/unity-builder.git builder;
cd repo;
git checkout $GITHUB_SHA;
ls
echo "end"`,
], 'alpine/git');
});
@ -1590,17 +1590,17 @@ class Kubernetes {
yield this.runJob([
'bin/bash',
'-c',
`ls
for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
ls /data
ls /data/builder
ls /data/builder/dist
cp -r /data/builder/dist/default-build-script /UnityBuilderAction
cp -r /data/builder/dist/entrypoint.sh /entrypoint.sh
cp -r /data/builder/dist/steps /steps
chmod -R +x /entrypoint.sh
chmod -R +x /steps
/entrypoint.sh
`ls
for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
ls /data
ls /data/builder
ls /data/builder/dist
cp -r /data/builder/dist/default-build-script /UnityBuilderAction
cp -r /data/builder/dist/entrypoint.sh /entrypoint.sh
cp -r /data/builder/dist/steps /steps
chmod -R +x /entrypoint.sh
chmod -R +x /steps
/entrypoint.sh
`,
], this.baseImage.toString());
});
@ -1720,6 +1720,7 @@ 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;
@ -1736,7 +1737,7 @@ class KubernetesStorage {
});
}
static createPersistentVolumeClaim(buildParameters, pvcName, kubeClient, namespace) {
var _a;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
if (buildParameters.kubeVolume) {
core.info(buildParameters.kubeVolume);
@ -1760,6 +1761,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(((_b = result.body.metadata) === null || _b === void 0 ? void 0 : _b.name) === pvcName);
});
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@ 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) {
@ -42,6 +43,7 @@ class KubernetesStorage {
};
const result = await kubeClient.createNamespacedPersistentVolumeClaim(namespace, pvc);
core.info(`Persistent Volume Claim ${result.body.metadata?.name} created`);
assert(result.body.metadata?.name === pvcName);
}
}