Add skipActivation functionality
parent
082ea39498
commit
090b4d1e82
|
@ -253,6 +253,10 @@ inputs:
|
||||||
description:
|
description:
|
||||||
'The path to mount the workspace inside the docker container. For windows, leave out the drive letter. For example
|
'The path to mount the workspace inside the docker container. For windows, leave out the drive letter. For example
|
||||||
c:/github/workspace should be defined as /github/workspace'
|
c:/github/workspace should be defined as /github/workspace'
|
||||||
|
skipActivation:
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
volume:
|
volume:
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create directories for license activation
|
# Perform Activation
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||||
UNITY_LICENSE_PATH="/Library/Application Support/Unity"
|
UNITY_LICENSE_PATH="/Library/Application Support/Unity"
|
||||||
|
|
||||||
if [ ! -d "$UNITY_LICENSE_PATH" ]; then
|
if [ ! -d "$UNITY_LICENSE_PATH" ]; then
|
||||||
|
@ -15,18 +16,25 @@ fi;
|
||||||
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
||||||
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
||||||
|
|
||||||
#
|
|
||||||
# Run steps
|
|
||||||
#
|
|
||||||
source $ACTION_FOLDER/platforms/mac/steps/activate.sh
|
source $ACTION_FOLDER/platforms/mac/steps/activate.sh
|
||||||
|
else
|
||||||
|
echo "Skipping activation"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run Build
|
||||||
|
#
|
||||||
|
|
||||||
source $ACTION_FOLDER/platforms/mac/steps/build.sh
|
source $ACTION_FOLDER/platforms/mac/steps/build.sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# License Cleanup
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||||
source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
|
source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
|
||||||
|
|
||||||
#
|
|
||||||
# Remove license activation directory
|
|
||||||
#
|
|
||||||
|
|
||||||
rm -r "$ACTIVATE_LICENSE_PATH"
|
rm -r "$ACTIVATE_LICENSE_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Instructions for debugging
|
# Instructions for debugging
|
||||||
|
|
|
@ -5,15 +5,23 @@
|
||||||
#
|
#
|
||||||
source /steps/set_extra_git_configs.sh
|
source /steps/set_extra_git_configs.sh
|
||||||
source /steps/set_gitcredential.sh
|
source /steps/set_gitcredential.sh
|
||||||
|
|
||||||
|
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||||
source /steps/activate.sh
|
source /steps/activate.sh
|
||||||
|
|
||||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||||
if [[ $UNITY_EXIT_CODE -ne 0 ]]; then
|
if [[ $UNITY_EXIT_CODE -ne 0 ]]; then
|
||||||
exit $UNITY_EXIT_CODE
|
exit $UNITY_EXIT_CODE
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Skipping activation"
|
||||||
|
fi
|
||||||
|
|
||||||
source /steps/build.sh
|
source /steps/build.sh
|
||||||
|
|
||||||
|
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||||
source /steps/return_license.sh
|
source /steps/return_license.sh
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Instructions for debugging
|
# Instructions for debugging
|
||||||
|
|
|
@ -14,18 +14,25 @@ Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force }
|
||||||
. "c:\steps\set_gitcredential.ps1"
|
. "c:\steps\set_gitcredential.ps1"
|
||||||
|
|
||||||
# Activate Unity
|
# Activate Unity
|
||||||
|
if ($env:SKIP_ACTIVATION -ne "true") {
|
||||||
. "c:\steps\activate.ps1"
|
. "c:\steps\activate.ps1"
|
||||||
|
|
||||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||||
if ($ACTIVATION_EXIT_CODE -ne 0) {
|
if ($ACTIVATION_EXIT_CODE -ne 0) {
|
||||||
exit $ACTIVATION_EXIT_CODE
|
exit $ACTIVATION_EXIT_CODE
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Skipping activation"
|
||||||
|
}
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
. "c:\steps\build.ps1"
|
. "c:\steps\build.ps1"
|
||||||
|
|
||||||
# Free the seat for the activated license
|
# Free the seat for the activated license
|
||||||
|
if ($env:SKIP_ACTIVATION -ne "true") {
|
||||||
. "c:\steps\return_license.ps1"
|
. "c:\steps\return_license.ps1"
|
||||||
|
}
|
||||||
|
|
||||||
Get-Process
|
Get-Process
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ class BuildParameters {
|
||||||
public customImage!: string;
|
public customImage!: string;
|
||||||
public unitySerial!: string;
|
public unitySerial!: string;
|
||||||
public unityLicensingServer!: string;
|
public unityLicensingServer!: string;
|
||||||
|
public skipActivation!: string;
|
||||||
public runnerTempPath!: string;
|
public runnerTempPath!: string;
|
||||||
public targetPlatform!: string;
|
public targetPlatform!: string;
|
||||||
public projectPath!: string;
|
public projectPath!: string;
|
||||||
|
@ -59,7 +60,7 @@ class BuildParameters {
|
||||||
public kubeVolumeSize!: string;
|
public kubeVolumeSize!: string;
|
||||||
public kubeVolume!: string;
|
public kubeVolume!: string;
|
||||||
public kubeStorageClass!: string;
|
public kubeStorageClass!: string;
|
||||||
public runAsHostUser!: String;
|
public runAsHostUser!: string;
|
||||||
public chownFilesTo!: string;
|
public chownFilesTo!: string;
|
||||||
public commandHooks!: string;
|
public commandHooks!: string;
|
||||||
public pullInputList!: string[];
|
public pullInputList!: string[];
|
||||||
|
@ -146,6 +147,7 @@ class BuildParameters {
|
||||||
customImage: Input.customImage,
|
customImage: Input.customImage,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
unityLicensingServer: Input.unityLicensingServer,
|
unityLicensingServer: Input.unityLicensingServer,
|
||||||
|
skipActivation: Input.skipActivation,
|
||||||
runnerTempPath: Input.runnerTempPath,
|
runnerTempPath: Input.runnerTempPath,
|
||||||
targetPlatform: Input.targetPlatform,
|
targetPlatform: Input.targetPlatform,
|
||||||
projectPath: Input.projectPath,
|
projectPath: Input.projectPath,
|
||||||
|
@ -168,7 +170,7 @@ class BuildParameters {
|
||||||
customParameters: Input.customParameters,
|
customParameters: Input.customParameters,
|
||||||
sshAgent: Input.sshAgent,
|
sshAgent: Input.sshAgent,
|
||||||
sshPublicKeysDirectoryPath: Input.sshPublicKeysDirectoryPath,
|
sshPublicKeysDirectoryPath: Input.sshPublicKeysDirectoryPath,
|
||||||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
gitPrivateToken: Input.gitPrivateToken ?? (await GithubCliReader.GetGitHubAuthToken()),
|
||||||
runAsHostUser: Input.runAsHostUser,
|
runAsHostUser: Input.runAsHostUser,
|
||||||
chownFilesTo: Input.chownFilesTo,
|
chownFilesTo: Input.chownFilesTo,
|
||||||
dockerCpuLimit: Input.dockerCpuLimit,
|
dockerCpuLimit: Input.dockerCpuLimit,
|
||||||
|
@ -187,10 +189,10 @@ class BuildParameters {
|
||||||
preBuildContainerHooks: CloudRunnerOptions.preBuildContainerHooks,
|
preBuildContainerHooks: CloudRunnerOptions.preBuildContainerHooks,
|
||||||
customJob: CloudRunnerOptions.customJob,
|
customJob: CloudRunnerOptions.customJob,
|
||||||
runNumber: Input.runNumber,
|
runNumber: Input.runNumber,
|
||||||
branch: Input.branch.replace('/head', '') || (await GitRepoReader.GetBranch()),
|
branch: Input.branch.replaceAll('/head', '') || (await GitRepoReader.GetBranch()),
|
||||||
cloudRunnerBranch: CloudRunnerOptions.cloudRunnerBranch.split('/').reverse()[0],
|
cloudRunnerBranch: CloudRunnerOptions.cloudRunnerBranch.split('/').reverse()[0],
|
||||||
cloudRunnerDebug: CloudRunnerOptions.cloudRunnerDebug,
|
cloudRunnerDebug: CloudRunnerOptions.cloudRunnerDebug,
|
||||||
githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
|
githubRepo: (Input.githubRepo ?? (await GitRepoReader.GetRemote())) || 'game-ci/unity-builder',
|
||||||
isCliMode: Cli.isCliMode,
|
isCliMode: Cli.isCliMode,
|
||||||
awsStackName: CloudRunnerOptions.awsStackName,
|
awsStackName: CloudRunnerOptions.awsStackName,
|
||||||
gitSha: Input.gitSha,
|
gitSha: Input.gitSha,
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ImageEnvironmentFactory {
|
||||||
name: 'UNITY_LICENSING_SERVER',
|
name: 'UNITY_LICENSING_SERVER',
|
||||||
value: parameters.unityLicensingServer,
|
value: parameters.unityLicensingServer,
|
||||||
},
|
},
|
||||||
|
{ name: 'SKIP_ACTIVATION', value: parameters.skipActivation },
|
||||||
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
|
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
|
||||||
{
|
{
|
||||||
name: 'USYM_UPLOAD_AUTH_TOKEN',
|
name: 'USYM_UPLOAD_AUTH_TOKEN',
|
||||||
|
@ -81,20 +82,12 @@ class ImageEnvironmentFactory {
|
||||||
];
|
];
|
||||||
if (parameters.providerStrategy === 'local-docker') {
|
if (parameters.providerStrategy === 'local-docker') {
|
||||||
for (const element of additionalVariables) {
|
for (const element of additionalVariables) {
|
||||||
if (
|
if (environmentVariables.some((x) => element?.name === x?.name) === undefined) {
|
||||||
environmentVariables.find(
|
|
||||||
(x) => element !== undefined && element.name !== undefined && x.name === element.name,
|
|
||||||
) === undefined
|
|
||||||
) {
|
|
||||||
environmentVariables.push(element);
|
environmentVariables.push(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const variable of environmentVariables) {
|
for (const variable of environmentVariables) {
|
||||||
if (
|
if (!environmentVariables.some((x) => variable?.name === x?.name)) {
|
||||||
environmentVariables.find(
|
|
||||||
(x) => variable !== undefined && variable.name !== undefined && x.name === variable.name,
|
|
||||||
) === undefined
|
|
||||||
) {
|
|
||||||
environmentVariables = environmentVariables.filter((x) => x !== variable);
|
environmentVariables = environmentVariables.filter((x) => x !== variable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Input {
|
||||||
|
|
||||||
static get branch(): string {
|
static get branch(): string {
|
||||||
if (Input.getInput(`GITHUB_REF`)) {
|
if (Input.getInput(`GITHUB_REF`)) {
|
||||||
return Input.getInput(`GITHUB_REF`)!.replace('refs/', '').replace(`head/`, '').replace(`heads/`, '');
|
return Input.getInput(`GITHUB_REF`)!.replaceAll('refs/', '').replaceAll(`head/`, '').replaceAll(`heads/`, '');
|
||||||
} else if (Input.getInput('branch')) {
|
} else if (Input.getInput('branch')) {
|
||||||
return Input.getInput('branch')!;
|
return Input.getInput('branch')!;
|
||||||
} else {
|
} else {
|
||||||
|
@ -104,7 +104,7 @@ class Input {
|
||||||
rawProjectPath = '.';
|
rawProjectPath = '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return rawProjectPath.replace(/\/$/, '');
|
return rawProjectPath.replaceAll(/\/$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
static get runnerTempPath(): string {
|
static get runnerTempPath(): string {
|
||||||
|
@ -186,7 +186,7 @@ class Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
static get sshPublicKeysDirectoryPath(): string {
|
static get sshPublicKeysDirectoryPath(): string {
|
||||||
return Input.getInput('sshPublicKeysDirectoryPath') || '';
|
return Input.getInput('sshPublicKeysDirectoryPath') ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get gitPrivateToken(): string | undefined {
|
static get gitPrivateToken(): string | undefined {
|
||||||
|
@ -194,27 +194,27 @@ class Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
static get runAsHostUser(): string {
|
static get runAsHostUser(): string {
|
||||||
return Input.getInput('runAsHostUser') || 'false';
|
return Input.getInput('runAsHostUser')?.toLowerCase() ?? 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get chownFilesTo() {
|
static get chownFilesTo() {
|
||||||
return Input.getInput('chownFilesTo') || '';
|
return Input.getInput('chownFilesTo') ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get allowDirtyBuild(): boolean {
|
static get allowDirtyBuild(): boolean {
|
||||||
const input = Input.getInput('allowDirtyBuild') || false;
|
const input = Input.getInput('allowDirtyBuild') ?? false;
|
||||||
|
|
||||||
return input === 'true';
|
return input === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get cacheUnityInstallationOnMac(): boolean {
|
static get cacheUnityInstallationOnMac(): boolean {
|
||||||
const input = Input.getInput('cacheUnityInstallationOnMac') || false;
|
const input = Input.getInput('cacheUnityInstallationOnMac') ?? false;
|
||||||
|
|
||||||
return input === 'true';
|
return input === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get unityHubVersionOnMac(): string {
|
static get unityHubVersionOnMac(): string {
|
||||||
const input = Input.getInput('unityHubVersionOnMac') || '';
|
const input = Input.getInput('unityHubVersionOnMac') ?? '';
|
||||||
|
|
||||||
return input !== '' ? input : '';
|
return input !== '' ? input : '';
|
||||||
}
|
}
|
||||||
|
@ -228,11 +228,11 @@ class Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
static get dockerWorkspacePath(): string {
|
static get dockerWorkspacePath(): string {
|
||||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
return Input.getInput('dockerWorkspacePath') ?? '/github/workspace';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get dockerCpuLimit(): string {
|
static get dockerCpuLimit(): string {
|
||||||
return Input.getInput('dockerCpuLimit') || os.cpus().length.toString();
|
return Input.getInput('dockerCpuLimit') ?? os.cpus().length.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
static get dockerMemoryLimit(): string {
|
static get dockerMemoryLimit(): string {
|
||||||
|
@ -252,20 +252,24 @@ class Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Input.getInput('dockerMemoryLimit') || `${Math.floor((os.totalmem() / bytesInMegabyte) * memoryMultiplier)}m`
|
Input.getInput('dockerMemoryLimit') ?? `${Math.floor((os.totalmem() / bytesInMegabyte) * memoryMultiplier)}m`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static get dockerIsolationMode(): string {
|
static get dockerIsolationMode(): string {
|
||||||
return Input.getInput('dockerIsolationMode') || 'default';
|
return Input.getInput('dockerIsolationMode') ?? 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get containerRegistryRepository(): string {
|
static get containerRegistryRepository(): string {
|
||||||
return Input.getInput('containerRegistryRepository') || 'unityci/editor';
|
return Input.getInput('containerRegistryRepository') ?? 'unityci/editor';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get containerRegistryImageVersion(): string {
|
static get containerRegistryImageVersion(): string {
|
||||||
return Input.getInput('containerRegistryImageVersion') || '3';
|
return Input.getInput('containerRegistryImageVersion') ?? '3';
|
||||||
|
}
|
||||||
|
|
||||||
|
static get skipActivation(): string {
|
||||||
|
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ToEnvVarFormat(input: string) {
|
public static ToEnvVarFormat(input: string) {
|
||||||
|
@ -274,10 +278,10 @@ class Input {
|
||||||
}
|
}
|
||||||
|
|
||||||
return input
|
return input
|
||||||
.replace(/([A-Z])/g, ' $1')
|
.replaceAll(/([A-Z])/g, ' $1')
|
||||||
.trim()
|
.trim()
|
||||||
.toUpperCase()
|
.toUpperCase()
|
||||||
.replace(/ /g, '_');
|
.replaceAll(' ', '_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue