Run build with input commands

pull/265/head
Frostebite 2021-05-28 21:03:41 +01:00
parent 148569023b
commit 821b9eeddf
3 changed files with 26 additions and 10 deletions

18
dist/index.js vendored
View File

@ -849,7 +849,7 @@ class Kubernetes {
{
name: 'main',
image,
command: ['bin/bash', '-c', command],
command,
resources: {
requests: {
memory: this.buildParameters.remoteBuildMemory,
@ -957,7 +957,10 @@ class Kubernetes {
}
static runCloneJob() {
return __awaiter(this, void 0, void 0, function* () {
yield Kubernetes.runJob(`apk update;
yield Kubernetes.runJob([
'bin/sh',
'-c',
`apk update;
apk add git-lfs;
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
cd /data;
@ -965,12 +968,16 @@ class Kubernetes {
git clone https://github.com/webbertakken/unity-builder.git builder;
cd repo;
git checkout $GITHUB_SHA;
ls`, 'alpine/git');
ls`,
], 'alpine/git');
});
}
static runBuildJob() {
return __awaiter(this, void 0, void 0, function* () {
yield this.runJob(`ls
yield this.runJob([
'bin/bash',
'-c',
`ls
for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
ls /data
ls /data/builder
@ -981,7 +988,8 @@ class Kubernetes {
chmod -R +x /entrypoint.sh
chmod -R +x /steps
/entrypoint.sh
`, this.baseImage.toString());
`,
], this.baseImage.toString());
});
}
static watchPersistentVolumeClaimUntilReady() {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -103,7 +103,7 @@ class Kubernetes {
core.info('Persistent Volume created, waiting for ready state...');
}
static async runJob(command: string, image: string) {
static async runJob(command: string[], image: string) {
core.info('Creating build job');
const job = new k8s.V1Job();
job.apiVersion = 'batch/v1';
@ -135,7 +135,7 @@ class Kubernetes {
{
name: 'main',
image,
command: ['bin/bash', '-c', command],
command,
resources: {
requests: {
memory: this.buildParameters.remoteBuildMemory,
@ -242,6 +242,9 @@ class Kubernetes {
static async runCloneJob() {
await Kubernetes.runJob(
[
'bin/sh',
'-c',
`apk update;
apk add git-lfs;
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
@ -251,12 +254,16 @@ class Kubernetes {
cd repo;
git checkout $GITHUB_SHA;
ls`,
],
'alpine/git',
);
}
static async runBuildJob() {
await this.runJob(
[
'bin/bash',
'-c',
`ls
for f in ./credentials/*; do export $(basename $f)="$(cat $f)"; done
ls /data
@ -269,6 +276,7 @@ class Kubernetes {
chmod -R +x /steps
/entrypoint.sh
`,
],
this.baseImage.toString(),
);
}