K8s Feature (#124)
Adds the ability to use a kubernetes container to run builds that are too large for the local machine running the unity-builder. Logs are streamed back during the build. Build results can then be downloaded separately.
This commit is contained in:
17
src/index.js
17
src/index.js
@@ -1,4 +1,4 @@
|
||||
import { Action, BuildParameters, Cache, Docker, ImageTag } from './model';
|
||||
import { Action, BuildParameters, Cache, Docker, ImageTag, Kubernetes } from './model';
|
||||
|
||||
const core = require('@actions/core');
|
||||
|
||||
@@ -10,12 +10,15 @@ async function action() {
|
||||
|
||||
const buildParameters = await BuildParameters.create();
|
||||
const baseImage = new ImageTag(buildParameters);
|
||||
|
||||
// Build docker image
|
||||
const builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||
|
||||
// Run docker image
|
||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
||||
if (buildParameters.kubeConfig) {
|
||||
core.info('Building with Kubernetes');
|
||||
await Kubernetes.runBuildJob(buildParameters, baseImage);
|
||||
} else {
|
||||
// Build docker image
|
||||
// TODO: No image required (instead use a version published to dockerhub for the action, supply credentials for github cloning)
|
||||
const builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
||||
}
|
||||
}
|
||||
|
||||
action().catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user