Add skipActivation functionality
parent
082ea39498
commit
090b4d1e82
|
@ -253,6 +253,10 @@ inputs:
|
|||
description:
|
||||
'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'
|
||||
skipActivation:
|
||||
default: 'false'
|
||||
required: false
|
||||
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
|
||||
|
||||
outputs:
|
||||
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,32 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Create directories for license activation
|
||||
# Perform Activation
|
||||
#
|
||||
|
||||
UNITY_LICENSE_PATH="/Library/Application Support/Unity"
|
||||
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||
UNITY_LICENSE_PATH="/Library/Application Support/Unity"
|
||||
|
||||
if [ ! -d "$UNITY_LICENSE_PATH" ]; then
|
||||
echo "Creating Unity License Directory"
|
||||
sudo mkdir -p "$UNITY_LICENSE_PATH"
|
||||
sudo chmod -R 777 "$UNITY_LICENSE_PATH"
|
||||
fi;
|
||||
if [ ! -d "$UNITY_LICENSE_PATH" ]; then
|
||||
echo "Creating Unity License Directory"
|
||||
sudo mkdir -p "$UNITY_LICENSE_PATH"
|
||||
sudo chmod -R 777 "$UNITY_LICENSE_PATH"
|
||||
fi;
|
||||
|
||||
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
||||
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
||||
ACTIVATE_LICENSE_PATH="$ACTION_FOLDER/BlankProject"
|
||||
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
||||
|
||||
source $ACTION_FOLDER/platforms/mac/steps/activate.sh
|
||||
else
|
||||
echo "Skipping activation"
|
||||
fi
|
||||
|
||||
#
|
||||
# Run steps
|
||||
# Run Build
|
||||
#
|
||||
source $ACTION_FOLDER/platforms/mac/steps/activate.sh
|
||||
|
||||
source $ACTION_FOLDER/platforms/mac/steps/build.sh
|
||||
source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
|
||||
|
||||
#
|
||||
# Remove license activation directory
|
||||
# License Cleanup
|
||||
#
|
||||
|
||||
rm -r "$ACTIVATE_LICENSE_PATH"
|
||||
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||
source $ACTION_FOLDER/platforms/mac/steps/return_license.sh
|
||||
rm -r "$ACTIVATE_LICENSE_PATH"
|
||||
fi
|
||||
|
||||
#
|
||||
# Instructions for debugging
|
||||
|
|
|
@ -5,15 +5,23 @@
|
|||
#
|
||||
source /steps/set_extra_git_configs.sh
|
||||
source /steps/set_gitcredential.sh
|
||||
source /steps/activate.sh
|
||||
|
||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||
if [[ $UNITY_EXIT_CODE -ne 0 ]]; then
|
||||
exit $UNITY_EXIT_CODE
|
||||
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||
source /steps/activate.sh
|
||||
|
||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||
if [[ $UNITY_EXIT_CODE -ne 0 ]]; then
|
||||
exit $UNITY_EXIT_CODE
|
||||
fi
|
||||
else
|
||||
echo "Skipping activation"
|
||||
fi
|
||||
|
||||
source /steps/build.sh
|
||||
source /steps/return_license.sh
|
||||
|
||||
if [ "$SKIP_ACTIVATION" != "true" ]; then
|
||||
source /steps/return_license.sh
|
||||
fi
|
||||
|
||||
#
|
||||
# Instructions for debugging
|
||||
|
|
|
@ -2,7 +2,7 @@ Get-Process
|
|||
|
||||
# Import any necessary registry keys, ie: location of windows 10 sdk
|
||||
# No guarantee that there will be any necessary registry keys, ie: tvOS
|
||||
Get-ChildItem -Path c:\regkeys -File | ForEach-Object {reg import $_.fullname}
|
||||
Get-ChildItem -Path c:\regkeys -File | ForEach-Object { reg import $_.fullname }
|
||||
|
||||
# Register the Visual Studio installation so Unity can find it
|
||||
regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll
|
||||
|
@ -14,18 +14,25 @@ Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force }
|
|||
. "c:\steps\set_gitcredential.ps1"
|
||||
|
||||
# Activate Unity
|
||||
. "c:\steps\activate.ps1"
|
||||
if ($env:SKIP_ACTIVATION -ne "true") {
|
||||
. "c:\steps\activate.ps1"
|
||||
|
||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||
if ($ACTIVATION_EXIT_CODE -ne 0) {
|
||||
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||
if ($ACTIVATION_EXIT_CODE -ne 0) {
|
||||
exit $ACTIVATION_EXIT_CODE
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "Skipping activation"
|
||||
}
|
||||
|
||||
# Build the project
|
||||
. "c:\steps\build.ps1"
|
||||
|
||||
# Free the seat for the activated license
|
||||
. "c:\steps\return_license.ps1"
|
||||
if ($env:SKIP_ACTIVATION -ne "true") {
|
||||
. "c:\steps\return_license.ps1"
|
||||
}
|
||||
|
||||
Get-Process
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ class BuildParameters {
|
|||
public customImage!: string;
|
||||
public unitySerial!: string;
|
||||
public unityLicensingServer!: string;
|
||||
public skipActivation!: string;
|
||||
public runnerTempPath!: string;
|
||||
public targetPlatform!: string;
|
||||
public projectPath!: string;
|
||||
|
@ -59,7 +60,7 @@ class BuildParameters {
|
|||
public kubeVolumeSize!: string;
|
||||
public kubeVolume!: string;
|
||||
public kubeStorageClass!: string;
|
||||
public runAsHostUser!: String;
|
||||
public runAsHostUser!: string;
|
||||
public chownFilesTo!: string;
|
||||
public commandHooks!: string;
|
||||
public pullInputList!: string[];
|
||||
|
@ -146,6 +147,7 @@ class BuildParameters {
|
|||
customImage: Input.customImage,
|
||||
unitySerial,
|
||||
unityLicensingServer: Input.unityLicensingServer,
|
||||
skipActivation: Input.skipActivation,
|
||||
runnerTempPath: Input.runnerTempPath,
|
||||
targetPlatform: Input.targetPlatform,
|
||||
projectPath: Input.projectPath,
|
||||
|
@ -168,7 +170,7 @@ class BuildParameters {
|
|||
customParameters: Input.customParameters,
|
||||
sshAgent: Input.sshAgent,
|
||||
sshPublicKeysDirectoryPath: Input.sshPublicKeysDirectoryPath,
|
||||
gitPrivateToken: Input.gitPrivateToken || (await GithubCliReader.GetGitHubAuthToken()),
|
||||
gitPrivateToken: Input.gitPrivateToken ?? (await GithubCliReader.GetGitHubAuthToken()),
|
||||
runAsHostUser: Input.runAsHostUser,
|
||||
chownFilesTo: Input.chownFilesTo,
|
||||
dockerCpuLimit: Input.dockerCpuLimit,
|
||||
|
@ -187,10 +189,10 @@ class BuildParameters {
|
|||
preBuildContainerHooks: CloudRunnerOptions.preBuildContainerHooks,
|
||||
customJob: CloudRunnerOptions.customJob,
|
||||
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],
|
||||
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,
|
||||
awsStackName: CloudRunnerOptions.awsStackName,
|
||||
gitSha: Input.gitSha,
|
||||
|
|
|
@ -29,6 +29,7 @@ class ImageEnvironmentFactory {
|
|||
name: 'UNITY_LICENSING_SERVER',
|
||||
value: parameters.unityLicensingServer,
|
||||
},
|
||||
{ name: 'SKIP_ACTIVATION', value: parameters.skipActivation },
|
||||
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
|
||||
{
|
||||
name: 'USYM_UPLOAD_AUTH_TOKEN',
|
||||
|
@ -81,20 +82,12 @@ class ImageEnvironmentFactory {
|
|||
];
|
||||
if (parameters.providerStrategy === 'local-docker') {
|
||||
for (const element of additionalVariables) {
|
||||
if (
|
||||
environmentVariables.find(
|
||||
(x) => element !== undefined && element.name !== undefined && x.name === element.name,
|
||||
) === undefined
|
||||
) {
|
||||
if (environmentVariables.some((x) => element?.name === x?.name) === undefined) {
|
||||
environmentVariables.push(element);
|
||||
}
|
||||
}
|
||||
for (const variable of environmentVariables) {
|
||||
if (
|
||||
environmentVariables.find(
|
||||
(x) => variable !== undefined && variable.name !== undefined && x.name === variable.name,
|
||||
) === undefined
|
||||
) {
|
||||
if (!environmentVariables.some((x) => variable?.name === x?.name)) {
|
||||
environmentVariables = environmentVariables.filter((x) => x !== variable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class Input {
|
|||
|
||||
static get branch(): string {
|
||||
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')) {
|
||||
return Input.getInput('branch')!;
|
||||
} else {
|
||||
|
@ -104,7 +104,7 @@ class Input {
|
|||
rawProjectPath = '.';
|
||||
}
|
||||
|
||||
return rawProjectPath.replace(/\/$/, '');
|
||||
return rawProjectPath.replaceAll(/\/$/, '');
|
||||
}
|
||||
|
||||
static get runnerTempPath(): string {
|
||||
|
@ -186,7 +186,7 @@ class Input {
|
|||
}
|
||||
|
||||
static get sshPublicKeysDirectoryPath(): string {
|
||||
return Input.getInput('sshPublicKeysDirectoryPath') || '';
|
||||
return Input.getInput('sshPublicKeysDirectoryPath') ?? '';
|
||||
}
|
||||
|
||||
static get gitPrivateToken(): string | undefined {
|
||||
|
@ -194,27 +194,27 @@ class Input {
|
|||
}
|
||||
|
||||
static get runAsHostUser(): string {
|
||||
return Input.getInput('runAsHostUser') || 'false';
|
||||
return Input.getInput('runAsHostUser')?.toLowerCase() ?? 'false';
|
||||
}
|
||||
|
||||
static get chownFilesTo() {
|
||||
return Input.getInput('chownFilesTo') || '';
|
||||
return Input.getInput('chownFilesTo') ?? '';
|
||||
}
|
||||
|
||||
static get allowDirtyBuild(): boolean {
|
||||
const input = Input.getInput('allowDirtyBuild') || false;
|
||||
const input = Input.getInput('allowDirtyBuild') ?? false;
|
||||
|
||||
return input === 'true';
|
||||
}
|
||||
|
||||
static get cacheUnityInstallationOnMac(): boolean {
|
||||
const input = Input.getInput('cacheUnityInstallationOnMac') || false;
|
||||
const input = Input.getInput('cacheUnityInstallationOnMac') ?? false;
|
||||
|
||||
return input === 'true';
|
||||
}
|
||||
|
||||
static get unityHubVersionOnMac(): string {
|
||||
const input = Input.getInput('unityHubVersionOnMac') || '';
|
||||
const input = Input.getInput('unityHubVersionOnMac') ?? '';
|
||||
|
||||
return input !== '' ? input : '';
|
||||
}
|
||||
|
@ -228,11 +228,11 @@ class Input {
|
|||
}
|
||||
|
||||
static get dockerWorkspacePath(): string {
|
||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||
return Input.getInput('dockerWorkspacePath') ?? '/github/workspace';
|
||||
}
|
||||
|
||||
static get dockerCpuLimit(): string {
|
||||
return Input.getInput('dockerCpuLimit') || os.cpus().length.toString();
|
||||
return Input.getInput('dockerCpuLimit') ?? os.cpus().length.toString();
|
||||
}
|
||||
|
||||
static get dockerMemoryLimit(): string {
|
||||
|
@ -252,20 +252,24 @@ class Input {
|
|||
}
|
||||
|
||||
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 {
|
||||
return Input.getInput('dockerIsolationMode') || 'default';
|
||||
return Input.getInput('dockerIsolationMode') ?? 'default';
|
||||
}
|
||||
|
||||
static get containerRegistryRepository(): string {
|
||||
return Input.getInput('containerRegistryRepository') || 'unityci/editor';
|
||||
return Input.getInput('containerRegistryRepository') ?? 'unityci/editor';
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -274,10 +278,10 @@ class Input {
|
|||
}
|
||||
|
||||
return input
|
||||
.replace(/([A-Z])/g, ' $1')
|
||||
.replaceAll(/([A-Z])/g, ' $1')
|
||||
.trim()
|
||||
.toUpperCase()
|
||||
.replace(/ /g, '_');
|
||||
.replaceAll(' ', '_');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue