add customImage attribute

pull/151/head
Kai Biermeier 2020-09-18 18:06:04 +02:00
parent cccd5074ea
commit 931f79417e
No known key found for this signature in database
GPG Key ID: 7CC9CD98828758A3
6 changed files with 25 additions and 2 deletions

View File

@ -6,6 +6,10 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Version of unity to use for building the project.' description: 'Version of unity to use for building the project.'
customImage:
required: false
default: ''
description: 'Specific docker image that should be used for building the project'
targetPlatform: targetPlatform:
required: false required: false
default: '' default: ''

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,7 @@ class BuildParameters {
return { return {
version: Input.unityVersion, version: Input.unityVersion,
customImage: Input.customImage,
uid, uid,
gid, gid,
runnerTempPath: process.env.RUNNER_TEMP, runnerTempPath: process.env.RUNNER_TEMP,

View File

@ -8,6 +8,7 @@ class ImageTag {
name = 'unity3d', name = 'unity3d',
version = '2019.2.11f1', version = '2019.2.11f1',
platform, platform,
customImage,
} = imageProperties; } = imageProperties;
if (!ImageTag.versionPattern.test(version)) { if (!ImageTag.versionPattern.test(version)) {
@ -24,7 +25,7 @@ class ImageTag {
ImageTag.imageSuffixes.generic, ImageTag.imageSuffixes.generic,
); );
Object.assign(this, { repository, name, version, platform, builderPlatform }); Object.assign(this, { repository, name, version, platform, builderPlatform, customImage });
} }
static get versionPattern() { static get versionPattern() {
@ -82,6 +83,10 @@ class ImageTag {
toString() { toString() {
const { image, tag } = this; const { image, tag } = this;
if (this.customImage) {
return this.customImage;
}
return `${image}:${tag}`; return `${image}:${tag}`;
} }
} }

View File

@ -51,6 +51,15 @@ describe('UnityImageVersion', () => {
expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111`); expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111`);
}); });
it('returns customImage if given', () => {
const image = new ImageTag({
version: '2099.1.1111',
platform: some.platform,
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
});
expect(image.toString()).toStrictEqual(image.customImage);
});
it('returns the specific build platform', () => { it('returns the specific build platform', () => {
const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' }); const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' });

View File

@ -12,6 +12,10 @@ class Input {
return core.getInput('unityVersion'); return core.getInput('unityVersion');
} }
static get customImage() {
return core.getInput('customImage');
}
static get targetPlatform() { static get targetPlatform() {
return core.getInput('targetPlatform') || Platform.default; return core.getInput('targetPlatform') || Platform.default;
} }