k8s refactoring started, new k8s api client
parent
5d41be7bc7
commit
5929a988d3
|
|
@ -732,8 +732,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const k8s = __importStar(__webpack_require__(89679));
|
const k8s = __importStar(__webpack_require__(89679));
|
||||||
const core = __webpack_require__(42186);
|
const core = __webpack_require__(42186);
|
||||||
// const base64 = require('base-64');
|
const base64 = __webpack_require__(85848);
|
||||||
// const pollInterval = 10000;
|
const pollInterval = 10000;
|
||||||
class Kubernetes {
|
class Kubernetes {
|
||||||
static runBuildJob(buildParameters, baseImage) {
|
static runBuildJob(buildParameters, baseImage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
|
@ -741,6 +741,7 @@ class Kubernetes {
|
||||||
const kc = new k8s.KubeConfig();
|
const kc = new k8s.KubeConfig();
|
||||||
kc.loadFromDefault();
|
kc.loadFromDefault();
|
||||||
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
|
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
|
||||||
|
const k8sBatchApi = kc.makeApiClient(k8s.BatchV1Api);
|
||||||
core.info('loaded from default');
|
core.info('loaded from default');
|
||||||
// const kubeconfig = new KubeConfig();
|
// const kubeconfig = new KubeConfig();
|
||||||
// kubeconfig.loadFromString(base64.decode(buildParameters.kubeConfig));
|
// kubeconfig.loadFromString(base64.decode(buildParameters.kubeConfig));
|
||||||
|
|
@ -753,6 +754,7 @@ class Kubernetes {
|
||||||
const jobName = `unity-builder-job-${buildId}`;
|
const jobName = `unity-builder-job-${buildId}`;
|
||||||
const namespace = 'default';
|
const namespace = 'default';
|
||||||
this.kubeClient = k8sApi;
|
this.kubeClient = k8sApi;
|
||||||
|
this.kubeClientBatch = k8sBatchApi;
|
||||||
this.buildId = buildId;
|
this.buildId = buildId;
|
||||||
this.buildParameters = buildParameters;
|
this.buildParameters = buildParameters;
|
||||||
this.baseImage = baseImage;
|
this.baseImage = baseImage;
|
||||||
|
|
@ -760,240 +762,243 @@ class Kubernetes {
|
||||||
this.secretName = secretName;
|
this.secretName = secretName;
|
||||||
this.jobName = jobName;
|
this.jobName = jobName;
|
||||||
this.namespace = namespace;
|
this.namespace = namespace;
|
||||||
// await Kubernetes.createSecret();
|
yield Kubernetes.createSecret();
|
||||||
// await Kubernetes.createPersistentVolumeClaim();
|
yield Kubernetes.createPersistentVolumeClaim();
|
||||||
// await Kubernetes.scheduleBuildJob();
|
// await Kubernetes.scheduleBuildJob();
|
||||||
// await Kubernetes.watchBuildJobUntilFinished();
|
// await Kubernetes.watchBuildJobUntilFinished();
|
||||||
// await Kubernetes.cleanup();
|
// await Kubernetes.cleanup();
|
||||||
core.setOutput('volume', pvcName);
|
core.setOutput('volume', pvcName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// static async createSecret() {
|
static createSecret() {
|
||||||
// //const secretManifest = {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// // apiVersion: 'v1',
|
const secret = new k8s.V1Secret();
|
||||||
// // kind: 'Secret',
|
secret.apiVersion = 'v1';
|
||||||
// // metadata: {
|
secret.kind = 'Secret';
|
||||||
// // name: this.secretName,
|
secret.type = 'Opaque';
|
||||||
// // },
|
secret.metadata = {
|
||||||
// // type: 'Opaque',
|
name: this.secretName,
|
||||||
// // data: {
|
};
|
||||||
// // GITHUB_TOKEN: base64.encode(this.buildParameters.githubToken),
|
secret.data = {
|
||||||
// // UNITY_LICENSE: base64.encode(process.env.UNITY_LICENSE),
|
GITHUB_TOKEN: base64.encode(this.buildParameters.githubToken),
|
||||||
// // ANDROID_KEYSTORE_BASE64: base64.encode(this.buildParameters.androidKeystoreBase64),
|
UNITY_LICENSE: base64.encode(process.env.UNITY_LICENSE),
|
||||||
// // ANDROID_KEYSTORE_PASS: base64.encode(this.buildParameters.androidKeystorePass),
|
ANDROID_KEYSTORE_BASE64: base64.encode(this.buildParameters.androidKeystoreBase64),
|
||||||
// // ANDROID_KEYALIAS_PASS: base64.encode(this.buildParameters.androidKeyaliasPass),
|
ANDROID_KEYSTORE_PASS: base64.encode(this.buildParameters.androidKeystorePass),
|
||||||
// // },
|
ANDROID_KEYALIAS_PASS: base64.encode(this.buildParameters.androidKeyaliasPass),
|
||||||
// //};
|
};
|
||||||
// //await this.kubeClient.api.v1.namespaces(this.namespace).secrets.post({ body: secretManifest });
|
yield this.kubeClient.createNamespacedSecret(this.namespace, secret);
|
||||||
// }
|
});
|
||||||
// static async createPersistentVolumeClaim() {
|
}
|
||||||
// if (this.buildParameters.kubeVolume) {
|
static createPersistentVolumeClaim() {
|
||||||
// core.info(this.buildParameters.kubeVolume);
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// this.pvcName = this.buildParameters.kubeVolume;
|
if (this.buildParameters.kubeVolume) {
|
||||||
// return;
|
core.info(this.buildParameters.kubeVolume);
|
||||||
// }
|
this.pvcName = this.buildParameters.kubeVolume;
|
||||||
// const pvcManifest = {
|
return;
|
||||||
// apiVersion: 'v1',
|
}
|
||||||
// kind: 'PersistentVolumeClaim',
|
const pvc = new k8s.V1PersistentVolumeClaim();
|
||||||
// metadata: {
|
pvc.apiVersion = 'v1';
|
||||||
// name: this.pvcName,
|
pvc.kind = 'PersistentVolumeClaim';
|
||||||
// },
|
pvc.metadata = {
|
||||||
// spec: {
|
name: this.pvcName,
|
||||||
// accessModes: ['ReadWriteOnce'],
|
};
|
||||||
// volumeMode: 'Filesystem',
|
pvc.spec = {
|
||||||
// resources: {
|
accessModes: ['ReadWriteOnce'],
|
||||||
// requests: {
|
volumeMode: 'Filesystem',
|
||||||
// storage: this.buildParameters.kubeVolumeSize,
|
resources: {
|
||||||
// },
|
requests: {
|
||||||
// },
|
storage: this.buildParameters.kubeVolumeSize,
|
||||||
// },
|
},
|
||||||
// };
|
},
|
||||||
// await this.kubeClient.api.v1.namespaces(this.namespace).persistentvolumeclaims.post({ body: pvcManifest });
|
};
|
||||||
// core.info('Persistent Volume created, waiting for ready state...');
|
yield this.kubeClient.createNamespacedPersistentVolumeClaim(this.namespace, pvc);
|
||||||
// await Kubernetes.watchPersistentVolumeClaimUntilReady();
|
core.info('Persistent Volume created, waiting for ready state...');
|
||||||
// core.info('Persistent Volume ready for claims');
|
yield Kubernetes.watchPersistentVolumeClaimUntilReady();
|
||||||
// }
|
core.info('Persistent Volume ready for claims');
|
||||||
// static async watchPersistentVolumeClaimUntilReady() {
|
});
|
||||||
// await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
}
|
||||||
// const queryResult = await this.kubeClient.api.v1
|
static watchPersistentVolumeClaimUntilReady() {
|
||||||
// .namespaces(this.namespace)
|
var _a;
|
||||||
// .persistentvolumeclaims(this.pvcName)
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// .get();
|
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
// if (queryResult.body.status.phase === 'Pending') {
|
const queryResult = yield this.kubeClient.readNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
|
||||||
// await Kubernetes.watchPersistentVolumeClaimUntilReady();
|
if (((_a = queryResult.body.status) === null || _a === void 0 ? void 0 : _a.phase) === 'Pending') {
|
||||||
// }
|
yield Kubernetes.watchPersistentVolumeClaimUntilReady();
|
||||||
// }
|
}
|
||||||
// static async scheduleBuildJob() {
|
});
|
||||||
// core.info('Creating build job');
|
}
|
||||||
// const jobManifest = {
|
static scheduleBuildJob() {
|
||||||
// apiVersion: 'batch/v1',
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// kind: 'Job',
|
core.info('Creating build job');
|
||||||
// metadata: {
|
const job = new k8s.V1Job();
|
||||||
// name: this.jobName,
|
job.apiVersion = 'batch/v1';
|
||||||
// labels: {
|
job.kind = 'Job';
|
||||||
// app: 'unity-builder',
|
job.metadata = {
|
||||||
// },
|
name: this.jobName,
|
||||||
// },
|
labels: {
|
||||||
// spec: {
|
app: 'unity-builder',
|
||||||
// template: {
|
},
|
||||||
// backoffLimit: 1,
|
};
|
||||||
// spec: {
|
job.spec = {
|
||||||
// volumes: [
|
template: {
|
||||||
// {
|
spec: {
|
||||||
// name: 'data',
|
volumes: [
|
||||||
// persistentVolumeClaim: {
|
{
|
||||||
// claimName: this.pvcName,
|
name: 'data',
|
||||||
// },
|
persistentVolumeClaim: {
|
||||||
// },
|
claimName: this.pvcName,
|
||||||
// {
|
},
|
||||||
// name: 'credentials',
|
},
|
||||||
// secret: {
|
{
|
||||||
// secretName: this.secretName,
|
name: 'credentials',
|
||||||
// },
|
secret: {
|
||||||
// },
|
secretName: this.secretName,
|
||||||
// ],
|
},
|
||||||
// initContainers: [
|
},
|
||||||
// {
|
],
|
||||||
// name: 'clone',
|
initContainers: [
|
||||||
// image: 'alpine/git',
|
{
|
||||||
// command: [
|
name: 'clone',
|
||||||
// '/bin/sh',
|
image: 'alpine/git',
|
||||||
// '-c',
|
command: [
|
||||||
// `apk update;
|
'/bin/sh',
|
||||||
// apk add git-lfs;
|
'-c',
|
||||||
// export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
`apk update;
|
||||||
// cd /data;
|
apk add git-lfs;
|
||||||
// git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git repo;
|
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
||||||
// git clone https://github.com/webbertakken/unity-builder.git builder;
|
cd /data;
|
||||||
// cd repo;
|
git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git repo;
|
||||||
// git checkout $GITHUB_SHA;
|
git clone https://github.com/webbertakken/unity-builder.git builder;
|
||||||
// ls`,
|
cd repo;
|
||||||
// ],
|
git checkout $GITHUB_SHA;
|
||||||
// volumeMounts: [
|
ls`,
|
||||||
// {
|
],
|
||||||
// name: 'data',
|
volumeMounts: [
|
||||||
// mountPath: '/data',
|
{
|
||||||
// },
|
name: 'data',
|
||||||
// {
|
mountPath: '/data',
|
||||||
// name: 'credentials',
|
},
|
||||||
// mountPath: '/credentials',
|
{
|
||||||
// readOnly: true,
|
name: 'credentials',
|
||||||
// },
|
mountPath: '/credentials',
|
||||||
// ],
|
readOnly: true,
|
||||||
// env: [
|
},
|
||||||
// {
|
],
|
||||||
// name: 'GITHUB_SHA',
|
env: [
|
||||||
// value: this.buildId,
|
{
|
||||||
// },
|
name: 'GITHUB_SHA',
|
||||||
// ],
|
value: this.buildId,
|
||||||
// },
|
},
|
||||||
// ],
|
],
|
||||||
// containers: [
|
},
|
||||||
// {
|
],
|
||||||
// name: 'main',
|
containers: [
|
||||||
// image: `${this.baseImage.toString()}`,
|
{
|
||||||
// command: [
|
name: 'main',
|
||||||
// 'bin/bash',
|
image: `${this.baseImage.toString()}`,
|
||||||
// '-c',
|
command: [
|
||||||
// `for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
|
'bin/bash',
|
||||||
// cp -r /data/builder/action/default-build-script /UnityBuilderAction
|
'-c',
|
||||||
// cp -r /data/builder/action/entrypoint.sh /entrypoint.sh
|
`for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
|
||||||
// cp -r /data/builder/action/steps /steps
|
cp -r /data/builder/action/default-build-script /UnityBuilderAction
|
||||||
// chmod -R +x /entrypoint.sh;
|
cp -r /data/builder/action/entrypoint.sh /entrypoint.sh
|
||||||
// chmod -R +x /steps;
|
cp -r /data/builder/action/steps /steps
|
||||||
// /entrypoint.sh;
|
chmod -R +x /entrypoint.sh;
|
||||||
// `,
|
chmod -R +x /steps;
|
||||||
// ],
|
/entrypoint.sh;
|
||||||
// resources: {
|
`,
|
||||||
// requests: {
|
],
|
||||||
// memory: this.buildParameters.kubeContainerMemory,
|
resources: {
|
||||||
// cpu: this.buildParameters.kubeContainerCPU,
|
requests: {
|
||||||
// },
|
memory: this.buildParameters.remoteBuildMemory,
|
||||||
// },
|
cpu: this.buildParameters.remoteBuildCpu,
|
||||||
// env: [
|
},
|
||||||
// {
|
},
|
||||||
// name: 'GITHUB_WORKSPACE',
|
env: [
|
||||||
// value: '/data/repo',
|
{
|
||||||
// },
|
name: 'GITHUB_WORKSPACE',
|
||||||
// {
|
value: '/data/repo',
|
||||||
// name: 'PROJECT_PATH',
|
},
|
||||||
// value: this.buildParameters.projectPath,
|
{
|
||||||
// },
|
name: 'PROJECT_PATH',
|
||||||
// {
|
value: this.buildParameters.projectPath,
|
||||||
// name: 'BUILD_PATH',
|
},
|
||||||
// value: this.buildParameters.buildPath,
|
{
|
||||||
// },
|
name: 'BUILD_PATH',
|
||||||
// {
|
value: this.buildParameters.buildPath,
|
||||||
// name: 'BUILD_FILE',
|
},
|
||||||
// value: this.buildParameters.buildFile,
|
{
|
||||||
// },
|
name: 'BUILD_FILE',
|
||||||
// {
|
value: this.buildParameters.buildFile,
|
||||||
// name: 'BUILD_NAME',
|
},
|
||||||
// value: this.buildParameters.buildName,
|
{
|
||||||
// },
|
name: 'BUILD_NAME',
|
||||||
// {
|
value: this.buildParameters.buildName,
|
||||||
// name: 'BUILD_METHOD',
|
},
|
||||||
// value: this.buildParameters.buildMethod,
|
{
|
||||||
// },
|
name: 'BUILD_METHOD',
|
||||||
// {
|
value: this.buildParameters.buildMethod,
|
||||||
// name: 'CUSTOM_PARAMETERS',
|
},
|
||||||
// value: this.buildParameters.customParameters,
|
{
|
||||||
// },
|
name: 'CUSTOM_PARAMETERS',
|
||||||
// {
|
value: this.buildParameters.customParameters,
|
||||||
// name: 'CHOWN_FILES_TO',
|
},
|
||||||
// value: this.buildParameters.chownFilesTo,
|
{
|
||||||
// },
|
name: 'CHOWN_FILES_TO',
|
||||||
// {
|
value: this.buildParameters.chownFilesTo,
|
||||||
// name: 'BUILD_TARGET',
|
},
|
||||||
// value: this.buildParameters.platform,
|
{
|
||||||
// },
|
name: 'BUILD_TARGET',
|
||||||
// {
|
value: this.buildParameters.platform,
|
||||||
// name: 'ANDROID_VERSION_CODE',
|
},
|
||||||
// value: this.buildParameters.androidVersionCode.toString(),
|
{
|
||||||
// },
|
name: 'ANDROID_VERSION_CODE',
|
||||||
// {
|
value: this.buildParameters.androidVersionCode.toString(),
|
||||||
// name: 'ANDROID_KEYSTORE_NAME',
|
},
|
||||||
// value: this.buildParameters.androidKeystoreName,
|
{
|
||||||
// },
|
name: 'ANDROID_KEYSTORE_NAME',
|
||||||
// {
|
value: this.buildParameters.androidKeystoreName,
|
||||||
// name: 'ANDROID_KEYALIAS_NAME',
|
},
|
||||||
// value: this.buildParameters.androidKeyaliasName,
|
{
|
||||||
// },
|
name: 'ANDROID_KEYALIAS_NAME',
|
||||||
// ],
|
value: this.buildParameters.androidKeyaliasName,
|
||||||
// volumeMounts: [
|
},
|
||||||
// {
|
],
|
||||||
// name: 'data',
|
volumeMounts: [
|
||||||
// mountPath: '/data',
|
{
|
||||||
// },
|
name: 'data',
|
||||||
// {
|
mountPath: '/data',
|
||||||
// name: 'credentials',
|
},
|
||||||
// mountPath: '/credentials',
|
{
|
||||||
// readOnly: true,
|
name: 'credentials',
|
||||||
// },
|
mountPath: '/credentials',
|
||||||
// ],
|
readOnly: true,
|
||||||
// lifeCycle: {
|
},
|
||||||
// preStop: {
|
],
|
||||||
// exec: {
|
lifecycle: {
|
||||||
// command: [
|
preStop: {
|
||||||
// 'bin/bash',
|
exec: {
|
||||||
// '-c',
|
command: [
|
||||||
// `cd /data/builder/action/steps;
|
'bin/bash',
|
||||||
// chmod +x /return_license.sh;
|
'-c',
|
||||||
// /return_license.sh;`,
|
`cd /data/builder/action/steps;
|
||||||
// ],
|
chmod +x /return_license.sh;
|
||||||
// },
|
/return_license.sh;`,
|
||||||
// },
|
],
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// ],
|
},
|
||||||
// restartPolicy: 'Never',
|
},
|
||||||
// },
|
],
|
||||||
// },
|
restartPolicy: 'Never',
|
||||||
// },
|
},
|
||||||
// };
|
},
|
||||||
// await this.kubeClient.apis.batch.v1.namespaces(this.namespace).jobs.post({ body: jobManifest });
|
};
|
||||||
// core.info('Job created');
|
job.spec.backoffLimit = 1;
|
||||||
// }
|
yield this.kubeClientBatch.createNamespacedJob(this.namespace, job);
|
||||||
|
core.info('Job created');
|
||||||
|
});
|
||||||
|
}
|
||||||
// static async watchBuildJobUntilFinished() {
|
// static async watchBuildJobUntilFinished() {
|
||||||
// let podname;
|
// let podname;
|
||||||
// let ready = false;
|
// let ready = false;
|
||||||
|
|
@ -167558,6 +167563,178 @@ function range(a, b, str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 85848:
|
||||||
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
/* module decorator */ module = __webpack_require__.nmd(module);
|
||||||
|
/*! https://mths.be/base64 v1.0.0 by @mathias | MIT license */
|
||||||
|
;(function(root) {
|
||||||
|
|
||||||
|
// Detect free variables `exports`.
|
||||||
|
var freeExports = true && exports;
|
||||||
|
|
||||||
|
// Detect free variable `module`.
|
||||||
|
var freeModule = true && module &&
|
||||||
|
module.exports == freeExports && module;
|
||||||
|
|
||||||
|
// Detect free variable `global`, from Node.js or Browserified code, and use
|
||||||
|
// it as `root`.
|
||||||
|
var freeGlobal = typeof global == 'object' && global;
|
||||||
|
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
||||||
|
root = freeGlobal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
var InvalidCharacterError = function(message) {
|
||||||
|
this.message = message;
|
||||||
|
};
|
||||||
|
InvalidCharacterError.prototype = new Error;
|
||||||
|
InvalidCharacterError.prototype.name = 'InvalidCharacterError';
|
||||||
|
|
||||||
|
var error = function(message) {
|
||||||
|
// Note: the error messages used throughout this file match those used by
|
||||||
|
// the native `atob`/`btoa` implementation in Chromium.
|
||||||
|
throw new InvalidCharacterError(message);
|
||||||
|
};
|
||||||
|
|
||||||
|
var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||||
|
// http://whatwg.org/html/common-microsyntaxes.html#space-character
|
||||||
|
var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
|
||||||
|
|
||||||
|
// `decode` is designed to be fully compatible with `atob` as described in the
|
||||||
|
// HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob
|
||||||
|
// The optimized base64-decoding algorithm used is based on @atk’s excellent
|
||||||
|
// implementation. https://gist.github.com/atk/1020396
|
||||||
|
var decode = function(input) {
|
||||||
|
input = String(input)
|
||||||
|
.replace(REGEX_SPACE_CHARACTERS, '');
|
||||||
|
var length = input.length;
|
||||||
|
if (length % 4 == 0) {
|
||||||
|
input = input.replace(/==?$/, '');
|
||||||
|
length = input.length;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
length % 4 == 1 ||
|
||||||
|
// http://whatwg.org/C#alphanumeric-ascii-characters
|
||||||
|
/[^+a-zA-Z0-9/]/.test(input)
|
||||||
|
) {
|
||||||
|
error(
|
||||||
|
'Invalid character: the string to be decoded is not correctly encoded.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var bitCounter = 0;
|
||||||
|
var bitStorage;
|
||||||
|
var buffer;
|
||||||
|
var output = '';
|
||||||
|
var position = -1;
|
||||||
|
while (++position < length) {
|
||||||
|
buffer = TABLE.indexOf(input.charAt(position));
|
||||||
|
bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;
|
||||||
|
// Unless this is the first of a group of 4 characters…
|
||||||
|
if (bitCounter++ % 4) {
|
||||||
|
// …convert the first 8 bits to a single ASCII character.
|
||||||
|
output += String.fromCharCode(
|
||||||
|
0xFF & bitStorage >> (-2 * bitCounter & 6)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
|
||||||
|
// `encode` is designed to be fully compatible with `btoa` as described in the
|
||||||
|
// HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa
|
||||||
|
var encode = function(input) {
|
||||||
|
input = String(input);
|
||||||
|
if (/[^\0-\xFF]/.test(input)) {
|
||||||
|
// Note: no need to special-case astral symbols here, as surrogates are
|
||||||
|
// matched, and the input is supposed to only contain ASCII anyway.
|
||||||
|
error(
|
||||||
|
'The string to be encoded contains characters outside of the ' +
|
||||||
|
'Latin1 range.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var padding = input.length % 3;
|
||||||
|
var output = '';
|
||||||
|
var position = -1;
|
||||||
|
var a;
|
||||||
|
var b;
|
||||||
|
var c;
|
||||||
|
var buffer;
|
||||||
|
// Make sure any padding is handled outside of the loop.
|
||||||
|
var length = input.length - padding;
|
||||||
|
|
||||||
|
while (++position < length) {
|
||||||
|
// Read three bytes, i.e. 24 bits.
|
||||||
|
a = input.charCodeAt(position) << 16;
|
||||||
|
b = input.charCodeAt(++position) << 8;
|
||||||
|
c = input.charCodeAt(++position);
|
||||||
|
buffer = a + b + c;
|
||||||
|
// Turn the 24 bits into four chunks of 6 bits each, and append the
|
||||||
|
// matching character for each of them to the output.
|
||||||
|
output += (
|
||||||
|
TABLE.charAt(buffer >> 18 & 0x3F) +
|
||||||
|
TABLE.charAt(buffer >> 12 & 0x3F) +
|
||||||
|
TABLE.charAt(buffer >> 6 & 0x3F) +
|
||||||
|
TABLE.charAt(buffer & 0x3F)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (padding == 2) {
|
||||||
|
a = input.charCodeAt(position) << 8;
|
||||||
|
b = input.charCodeAt(++position);
|
||||||
|
buffer = a + b;
|
||||||
|
output += (
|
||||||
|
TABLE.charAt(buffer >> 10) +
|
||||||
|
TABLE.charAt((buffer >> 4) & 0x3F) +
|
||||||
|
TABLE.charAt((buffer << 2) & 0x3F) +
|
||||||
|
'='
|
||||||
|
);
|
||||||
|
} else if (padding == 1) {
|
||||||
|
buffer = input.charCodeAt(position);
|
||||||
|
output += (
|
||||||
|
TABLE.charAt(buffer >> 2) +
|
||||||
|
TABLE.charAt((buffer << 4) & 0x3F) +
|
||||||
|
'=='
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
|
||||||
|
var base64 = {
|
||||||
|
'encode': encode,
|
||||||
|
'decode': decode,
|
||||||
|
'version': '1.0.0'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
||||||
|
// like the following:
|
||||||
|
if (
|
||||||
|
typeof define == 'function' &&
|
||||||
|
typeof define.amd == 'object' &&
|
||||||
|
define.amd
|
||||||
|
) {
|
||||||
|
define(function() {
|
||||||
|
return base64;
|
||||||
|
});
|
||||||
|
} else if (freeExports && !freeExports.nodeType) {
|
||||||
|
if (freeModule) { // in Node.js or RingoJS v0.8.0+
|
||||||
|
freeModule.exports = base64;
|
||||||
|
} else { // in Narwhal or RingoJS v0.7.0-
|
||||||
|
for (var key in base64) {
|
||||||
|
base64.hasOwnProperty(key) && (freeExports[key] = base64[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // in Rhino or a web browser
|
||||||
|
root.base64 = base64;
|
||||||
|
}
|
||||||
|
|
||||||
|
}(this));
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 45447:
|
/***/ 45447:
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -706,6 +706,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
base-64
|
||||||
|
MIT
|
||||||
|
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
bcrypt-pbkdf
|
bcrypt-pbkdf
|
||||||
BSD-3-Clause
|
BSD-3-Clause
|
||||||
The Blowfish portions are under the following license:
|
The Blowfish portions are under the following license:
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,13 @@
|
||||||
import * as k8s from '@kubernetes/client-node';
|
import * as k8s from '@kubernetes/client-node';
|
||||||
import { BuildParameters } from '.';
|
import { BuildParameters } from '.';
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
// const base64 = require('base-64');
|
const base64 = require('base-64');
|
||||||
|
|
||||||
// const pollInterval = 10000;
|
const pollInterval = 10000;
|
||||||
|
|
||||||
class Kubernetes {
|
class Kubernetes {
|
||||||
private static kubeClient: k8s.CoreV1Api;
|
private static kubeClient: k8s.CoreV1Api;
|
||||||
|
private static kubeClientBatch: k8s.BatchV1Api;
|
||||||
private static buildId: string;
|
private static buildId: string;
|
||||||
private static buildParameters: BuildParameters;
|
private static buildParameters: BuildParameters;
|
||||||
private static baseImage: any;
|
private static baseImage: any;
|
||||||
|
|
@ -21,6 +22,7 @@ class Kubernetes {
|
||||||
const kc = new k8s.KubeConfig();
|
const kc = new k8s.KubeConfig();
|
||||||
kc.loadFromDefault();
|
kc.loadFromDefault();
|
||||||
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
|
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
|
||||||
|
const k8sBatchApi = kc.makeApiClient(k8s.BatchV1Api);
|
||||||
core.info('loaded from default');
|
core.info('loaded from default');
|
||||||
|
|
||||||
// const kubeconfig = new KubeConfig();
|
// const kubeconfig = new KubeConfig();
|
||||||
|
|
@ -36,6 +38,7 @@ class Kubernetes {
|
||||||
const namespace = 'default';
|
const namespace = 'default';
|
||||||
|
|
||||||
this.kubeClient = k8sApi;
|
this.kubeClient = k8sApi;
|
||||||
|
this.kubeClientBatch = k8sBatchApi;
|
||||||
this.buildId = buildId;
|
this.buildId = buildId;
|
||||||
this.buildParameters = buildParameters;
|
this.buildParameters = buildParameters;
|
||||||
this.baseImage = baseImage;
|
this.baseImage = baseImage;
|
||||||
|
|
@ -44,8 +47,8 @@ class Kubernetes {
|
||||||
this.jobName = jobName;
|
this.jobName = jobName;
|
||||||
this.namespace = namespace;
|
this.namespace = namespace;
|
||||||
|
|
||||||
// await Kubernetes.createSecret();
|
await Kubernetes.createSecret();
|
||||||
// await Kubernetes.createPersistentVolumeClaim();
|
await Kubernetes.createPersistentVolumeClaim();
|
||||||
// await Kubernetes.scheduleBuildJob();
|
// await Kubernetes.scheduleBuildJob();
|
||||||
// await Kubernetes.watchBuildJobUntilFinished();
|
// await Kubernetes.watchBuildJobUntilFinished();
|
||||||
// await Kubernetes.cleanup();
|
// await Kubernetes.cleanup();
|
||||||
|
|
@ -53,235 +56,232 @@ class Kubernetes {
|
||||||
core.setOutput('volume', pvcName);
|
core.setOutput('volume', pvcName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static async createSecret() {
|
static async createSecret() {
|
||||||
// //const secretManifest = {
|
const secret = new k8s.V1Secret();
|
||||||
// // apiVersion: 'v1',
|
secret.apiVersion = 'v1';
|
||||||
// // kind: 'Secret',
|
secret.kind = 'Secret';
|
||||||
// // metadata: {
|
secret.type = 'Opaque';
|
||||||
// // name: this.secretName,
|
secret.metadata = {
|
||||||
// // },
|
name: this.secretName,
|
||||||
// // type: 'Opaque',
|
};
|
||||||
// // data: {
|
|
||||||
// // GITHUB_TOKEN: base64.encode(this.buildParameters.githubToken),
|
|
||||||
// // UNITY_LICENSE: base64.encode(process.env.UNITY_LICENSE),
|
|
||||||
// // ANDROID_KEYSTORE_BASE64: base64.encode(this.buildParameters.androidKeystoreBase64),
|
|
||||||
// // ANDROID_KEYSTORE_PASS: base64.encode(this.buildParameters.androidKeystorePass),
|
|
||||||
// // ANDROID_KEYALIAS_PASS: base64.encode(this.buildParameters.androidKeyaliasPass),
|
|
||||||
// // },
|
|
||||||
// //};
|
|
||||||
// //await this.kubeClient.api.v1.namespaces(this.namespace).secrets.post({ body: secretManifest });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static async createPersistentVolumeClaim() {
|
secret.data = {
|
||||||
// if (this.buildParameters.kubeVolume) {
|
GITHUB_TOKEN: base64.encode(this.buildParameters.githubToken),
|
||||||
// core.info(this.buildParameters.kubeVolume);
|
UNITY_LICENSE: base64.encode(process.env.UNITY_LICENSE),
|
||||||
// this.pvcName = this.buildParameters.kubeVolume;
|
ANDROID_KEYSTORE_BASE64: base64.encode(this.buildParameters.androidKeystoreBase64),
|
||||||
// return;
|
ANDROID_KEYSTORE_PASS: base64.encode(this.buildParameters.androidKeystorePass),
|
||||||
// }
|
ANDROID_KEYALIAS_PASS: base64.encode(this.buildParameters.androidKeyaliasPass),
|
||||||
// const pvcManifest = {
|
};
|
||||||
// apiVersion: 'v1',
|
|
||||||
// kind: 'PersistentVolumeClaim',
|
|
||||||
// metadata: {
|
|
||||||
// name: this.pvcName,
|
|
||||||
// },
|
|
||||||
// spec: {
|
|
||||||
// accessModes: ['ReadWriteOnce'],
|
|
||||||
// volumeMode: 'Filesystem',
|
|
||||||
// resources: {
|
|
||||||
// requests: {
|
|
||||||
// storage: this.buildParameters.kubeVolumeSize,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
// await this.kubeClient.api.v1.namespaces(this.namespace).persistentvolumeclaims.post({ body: pvcManifest });
|
|
||||||
// core.info('Persistent Volume created, waiting for ready state...');
|
|
||||||
// await Kubernetes.watchPersistentVolumeClaimUntilReady();
|
|
||||||
// core.info('Persistent Volume ready for claims');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static async watchPersistentVolumeClaimUntilReady() {
|
await this.kubeClient.createNamespacedSecret(this.namespace, secret);
|
||||||
// await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
}
|
||||||
// const queryResult = await this.kubeClient.api.v1
|
|
||||||
// .namespaces(this.namespace)
|
|
||||||
// .persistentvolumeclaims(this.pvcName)
|
|
||||||
// .get();
|
|
||||||
// if (queryResult.body.status.phase === 'Pending') {
|
|
||||||
// await Kubernetes.watchPersistentVolumeClaimUntilReady();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static async scheduleBuildJob() {
|
static async createPersistentVolumeClaim() {
|
||||||
// core.info('Creating build job');
|
if (this.buildParameters.kubeVolume) {
|
||||||
// const jobManifest = {
|
core.info(this.buildParameters.kubeVolume);
|
||||||
// apiVersion: 'batch/v1',
|
this.pvcName = this.buildParameters.kubeVolume;
|
||||||
// kind: 'Job',
|
return;
|
||||||
// metadata: {
|
}
|
||||||
// name: this.jobName,
|
const pvc = new k8s.V1PersistentVolumeClaim();
|
||||||
// labels: {
|
pvc.apiVersion = 'v1';
|
||||||
// app: 'unity-builder',
|
pvc.kind = 'PersistentVolumeClaim';
|
||||||
// },
|
pvc.metadata = {
|
||||||
// },
|
name: this.pvcName,
|
||||||
// spec: {
|
};
|
||||||
// template: {
|
pvc.spec = {
|
||||||
// backoffLimit: 1,
|
accessModes: ['ReadWriteOnce'],
|
||||||
// spec: {
|
volumeMode: 'Filesystem',
|
||||||
// volumes: [
|
resources: {
|
||||||
// {
|
requests: {
|
||||||
// name: 'data',
|
storage: this.buildParameters.kubeVolumeSize,
|
||||||
// persistentVolumeClaim: {
|
},
|
||||||
// claimName: this.pvcName,
|
},
|
||||||
// },
|
};
|
||||||
// },
|
await this.kubeClient.createNamespacedPersistentVolumeClaim(this.namespace, pvc);
|
||||||
// {
|
core.info('Persistent Volume created, waiting for ready state...');
|
||||||
// name: 'credentials',
|
await Kubernetes.watchPersistentVolumeClaimUntilReady();
|
||||||
// secret: {
|
core.info('Persistent Volume ready for claims');
|
||||||
// secretName: this.secretName,
|
}
|
||||||
// },
|
|
||||||
// },
|
static async watchPersistentVolumeClaimUntilReady() {
|
||||||
// ],
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
||||||
// initContainers: [
|
const queryResult = await this.kubeClient.readNamespacedPersistentVolumeClaim(this.pvcName, this.namespace);
|
||||||
// {
|
|
||||||
// name: 'clone',
|
if (queryResult.body.status?.phase === 'Pending') {
|
||||||
// image: 'alpine/git',
|
await Kubernetes.watchPersistentVolumeClaimUntilReady();
|
||||||
// command: [
|
}
|
||||||
// '/bin/sh',
|
}
|
||||||
// '-c',
|
|
||||||
// `apk update;
|
static async scheduleBuildJob() {
|
||||||
// apk add git-lfs;
|
core.info('Creating build job');
|
||||||
// export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
const job = new k8s.V1Job();
|
||||||
// cd /data;
|
job.apiVersion = 'batch/v1';
|
||||||
// git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git repo;
|
job.kind = 'Job';
|
||||||
// git clone https://github.com/webbertakken/unity-builder.git builder;
|
job.metadata = {
|
||||||
// cd repo;
|
name: this.jobName,
|
||||||
// git checkout $GITHUB_SHA;
|
labels: {
|
||||||
// ls`,
|
app: 'unity-builder',
|
||||||
// ],
|
},
|
||||||
// volumeMounts: [
|
};
|
||||||
// {
|
job.spec = {
|
||||||
// name: 'data',
|
template: {
|
||||||
// mountPath: '/data',
|
spec: {
|
||||||
// },
|
volumes: [
|
||||||
// {
|
{
|
||||||
// name: 'credentials',
|
name: 'data',
|
||||||
// mountPath: '/credentials',
|
persistentVolumeClaim: {
|
||||||
// readOnly: true,
|
claimName: this.pvcName,
|
||||||
// },
|
},
|
||||||
// ],
|
},
|
||||||
// env: [
|
{
|
||||||
// {
|
name: 'credentials',
|
||||||
// name: 'GITHUB_SHA',
|
secret: {
|
||||||
// value: this.buildId,
|
secretName: this.secretName,
|
||||||
// },
|
},
|
||||||
// ],
|
},
|
||||||
// },
|
],
|
||||||
// ],
|
initContainers: [
|
||||||
// containers: [
|
{
|
||||||
// {
|
name: 'clone',
|
||||||
// name: 'main',
|
image: 'alpine/git',
|
||||||
// image: `${this.baseImage.toString()}`,
|
command: [
|
||||||
// command: [
|
'/bin/sh',
|
||||||
// 'bin/bash',
|
'-c',
|
||||||
// '-c',
|
`apk update;
|
||||||
// `for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
|
apk add git-lfs;
|
||||||
// cp -r /data/builder/action/default-build-script /UnityBuilderAction
|
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
||||||
// cp -r /data/builder/action/entrypoint.sh /entrypoint.sh
|
cd /data;
|
||||||
// cp -r /data/builder/action/steps /steps
|
git clone https://github.com/${process.env.GITHUB_REPOSITORY}.git repo;
|
||||||
// chmod -R +x /entrypoint.sh;
|
git clone https://github.com/webbertakken/unity-builder.git builder;
|
||||||
// chmod -R +x /steps;
|
cd repo;
|
||||||
// /entrypoint.sh;
|
git checkout $GITHUB_SHA;
|
||||||
// `,
|
ls`,
|
||||||
// ],
|
],
|
||||||
// resources: {
|
volumeMounts: [
|
||||||
// requests: {
|
{
|
||||||
// memory: this.buildParameters.kubeContainerMemory,
|
name: 'data',
|
||||||
// cpu: this.buildParameters.kubeContainerCPU,
|
mountPath: '/data',
|
||||||
// },
|
},
|
||||||
// },
|
{
|
||||||
// env: [
|
name: 'credentials',
|
||||||
// {
|
mountPath: '/credentials',
|
||||||
// name: 'GITHUB_WORKSPACE',
|
readOnly: true,
|
||||||
// value: '/data/repo',
|
},
|
||||||
// },
|
],
|
||||||
// {
|
env: [
|
||||||
// name: 'PROJECT_PATH',
|
{
|
||||||
// value: this.buildParameters.projectPath,
|
name: 'GITHUB_SHA',
|
||||||
// },
|
value: this.buildId,
|
||||||
// {
|
},
|
||||||
// name: 'BUILD_PATH',
|
],
|
||||||
// value: this.buildParameters.buildPath,
|
},
|
||||||
// },
|
],
|
||||||
// {
|
containers: [
|
||||||
// name: 'BUILD_FILE',
|
{
|
||||||
// value: this.buildParameters.buildFile,
|
name: 'main',
|
||||||
// },
|
image: `${this.baseImage.toString()}`,
|
||||||
// {
|
command: [
|
||||||
// name: 'BUILD_NAME',
|
'bin/bash',
|
||||||
// value: this.buildParameters.buildName,
|
'-c',
|
||||||
// },
|
`for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
|
||||||
// {
|
cp -r /data/builder/action/default-build-script /UnityBuilderAction
|
||||||
// name: 'BUILD_METHOD',
|
cp -r /data/builder/action/entrypoint.sh /entrypoint.sh
|
||||||
// value: this.buildParameters.buildMethod,
|
cp -r /data/builder/action/steps /steps
|
||||||
// },
|
chmod -R +x /entrypoint.sh;
|
||||||
// {
|
chmod -R +x /steps;
|
||||||
// name: 'CUSTOM_PARAMETERS',
|
/entrypoint.sh;
|
||||||
// value: this.buildParameters.customParameters,
|
`,
|
||||||
// },
|
],
|
||||||
// {
|
resources: {
|
||||||
// name: 'CHOWN_FILES_TO',
|
requests: {
|
||||||
// value: this.buildParameters.chownFilesTo,
|
memory: this.buildParameters.remoteBuildMemory,
|
||||||
// },
|
cpu: this.buildParameters.remoteBuildCpu,
|
||||||
// {
|
},
|
||||||
// name: 'BUILD_TARGET',
|
},
|
||||||
// value: this.buildParameters.platform,
|
env: [
|
||||||
// },
|
{
|
||||||
// {
|
name: 'GITHUB_WORKSPACE',
|
||||||
// name: 'ANDROID_VERSION_CODE',
|
value: '/data/repo',
|
||||||
// value: this.buildParameters.androidVersionCode.toString(),
|
},
|
||||||
// },
|
{
|
||||||
// {
|
name: 'PROJECT_PATH',
|
||||||
// name: 'ANDROID_KEYSTORE_NAME',
|
value: this.buildParameters.projectPath,
|
||||||
// value: this.buildParameters.androidKeystoreName,
|
},
|
||||||
// },
|
{
|
||||||
// {
|
name: 'BUILD_PATH',
|
||||||
// name: 'ANDROID_KEYALIAS_NAME',
|
value: this.buildParameters.buildPath,
|
||||||
// value: this.buildParameters.androidKeyaliasName,
|
},
|
||||||
// },
|
{
|
||||||
// ],
|
name: 'BUILD_FILE',
|
||||||
// volumeMounts: [
|
value: this.buildParameters.buildFile,
|
||||||
// {
|
},
|
||||||
// name: 'data',
|
{
|
||||||
// mountPath: '/data',
|
name: 'BUILD_NAME',
|
||||||
// },
|
value: this.buildParameters.buildName,
|
||||||
// {
|
},
|
||||||
// name: 'credentials',
|
{
|
||||||
// mountPath: '/credentials',
|
name: 'BUILD_METHOD',
|
||||||
// readOnly: true,
|
value: this.buildParameters.buildMethod,
|
||||||
// },
|
},
|
||||||
// ],
|
{
|
||||||
// lifeCycle: {
|
name: 'CUSTOM_PARAMETERS',
|
||||||
// preStop: {
|
value: this.buildParameters.customParameters,
|
||||||
// exec: {
|
},
|
||||||
// command: [
|
{
|
||||||
// 'bin/bash',
|
name: 'CHOWN_FILES_TO',
|
||||||
// '-c',
|
value: this.buildParameters.chownFilesTo,
|
||||||
// `cd /data/builder/action/steps;
|
},
|
||||||
// chmod +x /return_license.sh;
|
{
|
||||||
// /return_license.sh;`,
|
name: 'BUILD_TARGET',
|
||||||
// ],
|
value: this.buildParameters.platform,
|
||||||
// },
|
},
|
||||||
// },
|
{
|
||||||
// },
|
name: 'ANDROID_VERSION_CODE',
|
||||||
// },
|
value: this.buildParameters.androidVersionCode.toString(),
|
||||||
// ],
|
},
|
||||||
// restartPolicy: 'Never',
|
{
|
||||||
// },
|
name: 'ANDROID_KEYSTORE_NAME',
|
||||||
// },
|
value: this.buildParameters.androidKeystoreName,
|
||||||
// },
|
},
|
||||||
// };
|
{
|
||||||
// await this.kubeClient.apis.batch.v1.namespaces(this.namespace).jobs.post({ body: jobManifest });
|
name: 'ANDROID_KEYALIAS_NAME',
|
||||||
// core.info('Job created');
|
value: this.buildParameters.androidKeyaliasName,
|
||||||
// }
|
},
|
||||||
|
],
|
||||||
|
volumeMounts: [
|
||||||
|
{
|
||||||
|
name: 'data',
|
||||||
|
mountPath: '/data',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'credentials',
|
||||||
|
mountPath: '/credentials',
|
||||||
|
readOnly: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
lifecycle: {
|
||||||
|
preStop: {
|
||||||
|
exec: {
|
||||||
|
command: [
|
||||||
|
'bin/bash',
|
||||||
|
'-c',
|
||||||
|
`cd /data/builder/action/steps;
|
||||||
|
chmod +x /return_license.sh;
|
||||||
|
/return_license.sh;`,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
restartPolicy: 'Never',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
job.spec.backoffLimit = 1;
|
||||||
|
await this.kubeClientBatch.createNamespacedJob(this.namespace, job);
|
||||||
|
core.info('Job created');
|
||||||
|
}
|
||||||
|
|
||||||
// static async watchBuildJobUntilFinished() {
|
// static async watchBuildJobUntilFinished() {
|
||||||
// let podname;
|
// let podname;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue