Merge db9abc4f3b
into 83c85328dd
commit
6aa961efae
11
action.yml
11
action.yml
|
@ -261,7 +261,16 @@ inputs:
|
|||
default: 'false'
|
||||
required: false
|
||||
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
|
||||
|
||||
cloneDepth:
|
||||
default: '50'
|
||||
required: false
|
||||
description: '[CloudRunner] Specifies the depth of the clone for the repository'
|
||||
cloudRunnerRepoName:
|
||||
default: 'game-ci/unity-builder'
|
||||
required: false
|
||||
description:
|
||||
'[CloudRunner] Specifies the repo for the unity builder. Useful if you forked the repo for testing, features, or
|
||||
fixes.'
|
||||
outputs:
|
||||
volume:
|
||||
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
|
||||
|
|
|
@ -339,7 +339,8 @@ class BuildParameters {
|
|||
branch: input_1.default.branch.replace('/head', '') || (await git_repo_1.GitRepoReader.GetBranch()),
|
||||
cloudRunnerBranch: cloud_runner_options_1.default.cloudRunnerBranch.split('/').reverse()[0],
|
||||
cloudRunnerDebug: cloud_runner_options_1.default.cloudRunnerDebug,
|
||||
githubRepo: (input_1.default.githubRepo ?? (await git_repo_1.GitRepoReader.GetRemote())) || 'game-ci/unity-builder',
|
||||
githubRepo: (input_1.default.githubRepo ?? (await git_repo_1.GitRepoReader.GetRemote())) || cloud_runner_options_1.default.cloudRunnerRepoName,
|
||||
cloudRunnerRepoName: cloud_runner_options_1.default.cloudRunnerRepoName,
|
||||
isCliMode: cli_1.Cli.isCliMode,
|
||||
awsStackName: cloud_runner_options_1.default.awsStackName,
|
||||
gitSha: input_1.default.gitSha,
|
||||
|
@ -363,6 +364,7 @@ class BuildParameters {
|
|||
cacheUnityInstallationOnMac: input_1.default.cacheUnityInstallationOnMac,
|
||||
unityHubVersionOnMac: input_1.default.unityHubVersionOnMac,
|
||||
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
||||
cloneDepth: Number.parseInt(cloud_runner_options_1.default.cloneDepth),
|
||||
};
|
||||
}
|
||||
static parseBuildFile(filename, platform, androidExportType) {
|
||||
|
@ -1015,7 +1017,7 @@ class CloudRunnerFolders {
|
|||
return node_path_1.default.join(CloudRunnerFolders.cacheFolderForCacheKeyFull, `Library`);
|
||||
}
|
||||
static get unityBuilderRepoUrl() {
|
||||
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/game-ci/unity-builder.git`;
|
||||
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/${cloud_runner_1.default.buildParameters.cloudRunnerRepoName}.git`;
|
||||
}
|
||||
static get targetBuildRepoUrl() {
|
||||
return `https://${cloud_runner_1.default.buildParameters.gitPrivateToken}@github.com/${cloud_runner_1.default.buildParameters.githubRepo}.git`;
|
||||
|
@ -1170,6 +1172,9 @@ class CloudRunnerOptions {
|
|||
static get githubRepoName() {
|
||||
return CloudRunnerOptions.getInput('githubRepoName') || CloudRunnerOptions.githubRepo?.split(`/`)[1] || '';
|
||||
}
|
||||
static get cloudRunnerRepoName() {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerRepoName') || `game-ci/unity-builder`;
|
||||
}
|
||||
static get finalHooks() {
|
||||
return CloudRunnerOptions.getInput('finalHooks')?.split(',') || [];
|
||||
}
|
||||
|
@ -1222,6 +1227,9 @@ class CloudRunnerOptions {
|
|||
static get customJob() {
|
||||
return CloudRunnerOptions.getInput('customJob') || '';
|
||||
}
|
||||
static get cloneDepth() {
|
||||
return CloudRunnerOptions.getInput('cloneDepth') || `50`;
|
||||
}
|
||||
// ### ### ###
|
||||
// Custom commands from files parameters
|
||||
// ### ### ###
|
||||
|
@ -1596,6 +1604,7 @@ class AWSCloudFormationTemplates {
|
|||
}
|
||||
static getSecretDefinitionTemplate(p1, p2) {
|
||||
return `
|
||||
Secrets:
|
||||
- Name: '${p1}'
|
||||
ValueFrom: !Ref ${p2}Secret
|
||||
`;
|
||||
|
@ -1710,7 +1719,7 @@ class AWSJobStack {
|
|||
}
|
||||
taskDefCloudFormation = aws_cloud_formation_templates_1.AWSCloudFormationTemplates.insertAtTemplate(taskDefCloudFormation, 'p1 - input', aws_cloud_formation_templates_1.AWSCloudFormationTemplates.getParameterTemplate(secret.ParameterKey));
|
||||
taskDefCloudFormation = aws_cloud_formation_templates_1.AWSCloudFormationTemplates.insertAtTemplate(taskDefCloudFormation, '# template resources secrets', aws_cloud_formation_templates_1.AWSCloudFormationTemplates.getSecretTemplate(`${secret.ParameterKey}`));
|
||||
taskDefCloudFormation = aws_cloud_formation_templates_1.AWSCloudFormationTemplates.insertAtTemplate(taskDefCloudFormation, 'p3 - container def', aws_cloud_formation_templates_1.AWSCloudFormationTemplates.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey));
|
||||
taskDefCloudFormation = aws_cloud_formation_templates_1.AWSCloudFormationTemplates.insertAtTemplate(taskDefCloudFormation, '# template secrets p3 - container def', aws_cloud_formation_templates_1.AWSCloudFormationTemplates.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey));
|
||||
}
|
||||
const secretsMappedToCloudFormationParameters = secrets.map((x) => {
|
||||
return { ParameterKey: x.ParameterKey.replace(/[^\dA-Za-z]/g, ''), ParameterValue: x.ParameterValue };
|
||||
|
@ -1751,6 +1760,7 @@ class AWSJobStack {
|
|||
},
|
||||
...secretsMappedToCloudFormationParameters,
|
||||
];
|
||||
cloud_runner_logger_1.default.log(`TaskDef: ${taskDefCloudFormation}`);
|
||||
cloud_runner_logger_1.default.log(`Starting AWS job with memory: ${cloud_runner_1.default.buildParameters.containerMemory} cpu: ${cloud_runner_1.default.buildParameters.containerCpu}`);
|
||||
let previousStackExists = true;
|
||||
while (previousStackExists) {
|
||||
|
@ -1774,7 +1784,9 @@ class AWSJobStack {
|
|||
Capabilities: ['CAPABILITY_IAM'],
|
||||
Parameters: parameters,
|
||||
};
|
||||
cloud_runner_logger_1.default.log(`StackInput: ${createStackInput}`);
|
||||
try {
|
||||
cloud_runner_logger_1.default.log(`TaskDef Cloud formation: ${taskDefCloudFormation}`);
|
||||
cloud_runner_logger_1.default.log(`Creating job aws formation ${taskDefStackName}`);
|
||||
await CF.createStack(createStackInput).promise();
|
||||
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName }).promise();
|
||||
|
@ -2759,9 +2771,8 @@ Resources:
|
|||
MountPoints:
|
||||
- SourceVolume: efs-data
|
||||
ContainerPath: !Ref EFSMountDirectory
|
||||
ReadOnly: false
|
||||
Secrets:
|
||||
# template secrets p3 - container def
|
||||
ReadOnly: false
|
||||
# template secrets p3 - container def
|
||||
LogConfiguration:
|
||||
LogDriver: awslogs
|
||||
Options:
|
||||
|
@ -4579,7 +4590,7 @@ class RemoteClient {
|
|||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"`);
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git config --global filter.lfs.process "git-lfs filter-process --skip"`);
|
||||
try {
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git clone ${cloud_runner_folders_1.CloudRunnerFolders.targetBuildRepoUrl} ${node_path_1.default.basename(cloud_runner_folders_1.CloudRunnerFolders.repoPathAbsolute)}`);
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`git clone --depth ${cloud_runner_options_1.default.cloneDepth} ${cloud_runner_folders_1.CloudRunnerFolders.targetBuildRepoUrl} ${node_path_1.default.basename(cloud_runner_folders_1.CloudRunnerFolders.repoPathAbsolute)}`);
|
||||
}
|
||||
catch (error) {
|
||||
throw error;
|
||||
|
@ -6519,7 +6530,7 @@ class ImageTag {
|
|||
this.targetPlatform = targetPlatform;
|
||||
this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion, providerStrategy);
|
||||
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(buildPlatform);
|
||||
this.imageRollingVersion = Number(containerRegistryImageVersion); // Will automatically roll to the latest non-breaking version.
|
||||
this.imageRollingVersion = containerRegistryImageVersion; // Will automatically roll to the latest non-breaking version.
|
||||
}
|
||||
static get versionPattern() {
|
||||
return /^\d+\.\d+\.\d+[a-z]\d+$/;
|
||||
|
@ -8012,7 +8023,7 @@ class Versioning {
|
|||
static async getVersionDescription() {
|
||||
const versionTags = (await this.git(['tag', '--list', '--merged', 'HEAD', '--sort=-creatordate']))
|
||||
.split('\n')
|
||||
.filter(tag => new RegExp(this.grepCompatibleInputVersionRegex).test(tag));
|
||||
.filter((tag) => new RegExp(this.grepCompatibleInputVersionRegex).test(tag));
|
||||
if (versionTags.length === 0) {
|
||||
core.warning('No valid version tags found. Using fallback description.');
|
||||
return this.git(['describe', '--long', '--tags', '--always', 'HEAD']);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -67,6 +67,7 @@ class BuildParameters {
|
|||
public pullInputList!: string[];
|
||||
public inputPullCommand!: string;
|
||||
public cacheKey!: string;
|
||||
public cloneDepth!: number;
|
||||
|
||||
public postBuildContainerHooks!: string;
|
||||
public preBuildContainerHooks!: string;
|
||||
|
@ -74,6 +75,7 @@ class BuildParameters {
|
|||
public runNumber!: string;
|
||||
public branch!: string;
|
||||
public githubRepo!: string;
|
||||
public cloudRunnerRepoName!: string;
|
||||
public gitSha!: string;
|
||||
public logId!: string;
|
||||
public buildGuid!: string;
|
||||
|
@ -194,7 +196,8 @@ class BuildParameters {
|
|||
branch: Input.branch.replace('/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())) || CloudRunnerOptions.cloudRunnerRepoName,
|
||||
cloudRunnerRepoName: CloudRunnerOptions.cloudRunnerRepoName,
|
||||
isCliMode: Cli.isCliMode,
|
||||
awsStackName: CloudRunnerOptions.awsStackName,
|
||||
gitSha: Input.gitSha,
|
||||
|
@ -205,6 +208,7 @@ class BuildParameters {
|
|||
pullInputList: CloudRunnerOptions.pullInputList,
|
||||
kubeStorageClass: CloudRunnerOptions.kubeStorageClass,
|
||||
cacheKey: CloudRunnerOptions.cacheKey,
|
||||
|
||||
maxRetainedWorkspaces: Number.parseInt(CloudRunnerOptions.maxRetainedWorkspaces),
|
||||
useLargePackages: CloudRunnerOptions.useLargePackages,
|
||||
useCompressionStrategy: CloudRunnerOptions.useCompressionStrategy,
|
||||
|
@ -218,6 +222,7 @@ class BuildParameters {
|
|||
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
||||
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
||||
dockerWorkspacePath: Input.dockerWorkspacePath,
|
||||
cloneDepth: Number.parseInt(CloudRunnerOptions.cloneDepth),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ export class CloudRunnerFolders {
|
|||
}
|
||||
|
||||
public static get unityBuilderRepoUrl(): string {
|
||||
return `https://${CloudRunner.buildParameters.gitPrivateToken}@github.com/game-ci/unity-builder.git`;
|
||||
return `https://${CloudRunner.buildParameters.gitPrivateToken}@github.com/${CloudRunner.buildParameters.cloudRunnerRepoName}.git`;
|
||||
}
|
||||
|
||||
public static get targetBuildRepoUrl(): string {
|
||||
|
|
|
@ -74,6 +74,10 @@ class CloudRunnerOptions {
|
|||
return CloudRunnerOptions.getInput('githubRepoName') || CloudRunnerOptions.githubRepo?.split(`/`)[1] || '';
|
||||
}
|
||||
|
||||
static get cloudRunnerRepoName(): string {
|
||||
return CloudRunnerOptions.getInput('cloudRunnerRepoName') || `game-ci/unity-builder`;
|
||||
}
|
||||
|
||||
static get finalHooks(): string[] {
|
||||
return CloudRunnerOptions.getInput('finalHooks')?.split(',') || [];
|
||||
}
|
||||
|
@ -85,6 +89,7 @@ class CloudRunnerOptions {
|
|||
static get githubRepo(): string | undefined {
|
||||
return CloudRunnerOptions.getInput('GITHUB_REPOSITORY') || CloudRunnerOptions.getInput('GITHUB_REPO') || undefined;
|
||||
}
|
||||
|
||||
static get branch(): string {
|
||||
if (CloudRunnerOptions.getInput(`GITHUB_REF`)) {
|
||||
return (
|
||||
|
@ -139,6 +144,10 @@ class CloudRunnerOptions {
|
|||
return CloudRunnerOptions.getInput('customJob') || '';
|
||||
}
|
||||
|
||||
static get cloneDepth(): string {
|
||||
return CloudRunnerOptions.getInput('cloneDepth') || `50`;
|
||||
}
|
||||
|
||||
// ### ### ###
|
||||
// Custom commands from files parameters
|
||||
// ### ### ###
|
||||
|
|
|
@ -21,6 +21,7 @@ export class AWSCloudFormationTemplates {
|
|||
|
||||
public static getSecretDefinitionTemplate(p1: string, p2: string) {
|
||||
return `
|
||||
Secrets:
|
||||
- Name: '${p1}'
|
||||
ValueFrom: !Ref ${p2}Secret
|
||||
`;
|
||||
|
|
|
@ -70,7 +70,7 @@ export class AWSJobStack {
|
|||
);
|
||||
taskDefCloudFormation = AWSCloudFormationTemplates.insertAtTemplate(
|
||||
taskDefCloudFormation,
|
||||
'p3 - container def',
|
||||
'# template secrets p3 - container def',
|
||||
AWSCloudFormationTemplates.getSecretDefinitionTemplate(secret.EnvironmentVariable, secret.ParameterKey),
|
||||
);
|
||||
}
|
||||
|
@ -113,9 +113,13 @@ export class AWSJobStack {
|
|||
},
|
||||
...secretsMappedToCloudFormationParameters,
|
||||
];
|
||||
|
||||
CloudRunnerLogger.log(`TaskDef: ${taskDefCloudFormation}`);
|
||||
|
||||
CloudRunnerLogger.log(
|
||||
`Starting AWS job with memory: ${CloudRunner.buildParameters.containerMemory} cpu: ${CloudRunner.buildParameters.containerCpu}`,
|
||||
);
|
||||
|
||||
let previousStackExists = true;
|
||||
while (previousStackExists) {
|
||||
previousStackExists = false;
|
||||
|
@ -132,13 +136,17 @@ export class AWSJobStack {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const createStackInput: SDK.CloudFormation.CreateStackInput = {
|
||||
StackName: taskDefStackName,
|
||||
TemplateBody: taskDefCloudFormation,
|
||||
Capabilities: ['CAPABILITY_IAM'],
|
||||
Parameters: parameters,
|
||||
};
|
||||
|
||||
CloudRunnerLogger.log(`StackInput: ${createStackInput}`);
|
||||
try {
|
||||
CloudRunnerLogger.log(`TaskDef Cloud formation: ${taskDefCloudFormation}`);
|
||||
CloudRunnerLogger.log(`Creating job aws formation ${taskDefStackName}`);
|
||||
await CF.createStack(createStackInput).promise();
|
||||
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName }).promise();
|
||||
|
|
|
@ -126,9 +126,8 @@ Resources:
|
|||
MountPoints:
|
||||
- SourceVolume: efs-data
|
||||
ContainerPath: !Ref EFSMountDirectory
|
||||
ReadOnly: false
|
||||
Secrets:
|
||||
# template secrets p3 - container def
|
||||
ReadOnly: false
|
||||
# template secrets p3 - container def
|
||||
LogConfiguration:
|
||||
LogDriver: awslogs
|
||||
Options:
|
||||
|
|
|
@ -184,7 +184,9 @@ export class RemoteClient {
|
|||
await CloudRunnerSystem.Run(`git config --global filter.lfs.process "git-lfs filter-process --skip"`);
|
||||
try {
|
||||
await CloudRunnerSystem.Run(
|
||||
`git clone ${CloudRunnerFolders.targetBuildRepoUrl} ${path.basename(CloudRunnerFolders.repoPathAbsolute)}`,
|
||||
`git clone --depth ${CloudRunnerOptions.cloneDepth} ${CloudRunnerFolders.targetBuildRepoUrl} ${path.basename(
|
||||
CloudRunnerFolders.repoPathAbsolute,
|
||||
)}`,
|
||||
);
|
||||
} catch (error: any) {
|
||||
throw error;
|
||||
|
|
|
@ -6,7 +6,7 @@ class ImageTag {
|
|||
public targetPlatform: string;
|
||||
public builderPlatform: string;
|
||||
public customImage: string;
|
||||
public imageRollingVersion: number;
|
||||
public imageRollingVersion: string;
|
||||
public imagePlatformPrefix: string;
|
||||
|
||||
constructor(imageProperties: { [key: string]: string }) {
|
||||
|
@ -38,7 +38,7 @@ class ImageTag {
|
|||
providerStrategy,
|
||||
);
|
||||
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(buildPlatform);
|
||||
this.imageRollingVersion = Number(containerRegistryImageVersion); // Will automatically roll to the latest non-breaking version.
|
||||
this.imageRollingVersion = containerRegistryImageVersion; // Will automatically roll to the latest non-breaking version.
|
||||
}
|
||||
|
||||
static get versionPattern(): RegExp {
|
||||
|
|
Loading…
Reference in New Issue