correcting bug with async env
parent
c54786ae55
commit
8552ed6b92
|
@ -39,10 +39,8 @@ jobs:
|
|||
if: github.event.event_type != 'pull_request_target'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout (default)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
lfs: false
|
||||
- run: git clone -b cloud-runner-develop https://github.com/game-ci/unity-builder
|
||||
- run: cd unity-builder
|
||||
- run: yarn
|
||||
- run: yarn run cli -m checks-update
|
||||
timeout-minutes: 180
|
||||
|
|
|
@ -308,6 +308,7 @@ class BuildParameters {
|
|||
garbageCollectionMaxAge: cloud_runner_options_1.default.garbageCollectionMaxAge,
|
||||
githubChecks: cloud_runner_options_1.default.githubChecks,
|
||||
asyncWorkflow: cloud_runner_options_1.default.asyncCloudRunner,
|
||||
githubCheckId: ``,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -1017,9 +1018,11 @@ class CloudRunner {
|
|||
return process.env[`GAMECI_ASYNC_WORKFLOW`] === `true`;
|
||||
}
|
||||
static setup(buildParameters) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
cloud_runner_logger_1.default.setup();
|
||||
cloud_runner_logger_1.default.log(`Setting up cloud runner`);
|
||||
CloudRunner.buildParameters = buildParameters;
|
||||
CloudRunner.buildParameters.githubCheckId = yield github_1.default.createGitHubCheck(CloudRunner.buildParameters.buildGuid);
|
||||
CloudRunner.setupSelectedBuildPlatform();
|
||||
CloudRunner.defaultSecrets = task_parameter_serializer_1.TaskParameterSerializer.readDefaultSecrets();
|
||||
CloudRunner.cloudRunnerEnvironmentVariables =
|
||||
|
@ -1036,6 +1039,7 @@ class CloudRunner {
|
|||
}
|
||||
core.setOutput(__1.Input.ToEnvVarFormat(`buildArtifact`), `build-${CloudRunner.buildParameters.buildGuid}.tar${CloudRunner.buildParameters.useLz4Compression ? '.lz4' : ''}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
static setupSelectedBuildPlatform() {
|
||||
cloud_runner_logger_1.default.log(`Cloud Runner platform selected ${CloudRunner.buildParameters.cloudRunnerCluster}`);
|
||||
|
@ -1059,9 +1063,8 @@ class CloudRunner {
|
|||
}
|
||||
static run(buildParameters, baseImage) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
CloudRunner.setup(buildParameters);
|
||||
yield CloudRunner.setup(buildParameters);
|
||||
try {
|
||||
CloudRunner.githubCheckId = yield github_1.default.createGitHubCheck(CloudRunner.buildParameters.buildGuid);
|
||||
if (buildParameters.retainWorkspace) {
|
||||
CloudRunner.lockedWorkspace = `${CloudRunner.retainedWorkspacePrefix}-${CloudRunner.buildParameters.buildGuid}`;
|
||||
const result = yield shared_workspace_locking_1.default.GetOrCreateLockedWorkspace(CloudRunner.lockedWorkspace, CloudRunner.buildParameters.buildGuid, CloudRunner.buildParameters);
|
||||
|
@ -6433,7 +6436,7 @@ class GitHub {
|
|||
return GitHub.checkName;
|
||||
}
|
||||
static get checkRunId() {
|
||||
return cloud_runner_1.default.githubCheckId;
|
||||
return cloud_runner_1.default.buildParameters.githubCheckId;
|
||||
}
|
||||
static get owner() {
|
||||
return cloud_runner_options_1.default.githubOwner;
|
||||
|
@ -6473,7 +6476,7 @@ class GitHub {
|
|||
},
|
||||
};
|
||||
const result = yield GitHub.createGitHubCheckRequest(data);
|
||||
return result.data.id;
|
||||
return result.data.id.toString();
|
||||
});
|
||||
}
|
||||
static updateGitHubCheck(longDescription, summary, result = `neutral`, status = `in_progress`) {
|
||||
|
@ -6520,12 +6523,12 @@ class GitHub {
|
|||
}
|
||||
static updateGitHubCheckRequest(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield GitHub.octokitPAT.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
return yield GitHub.octokitDefaultToken.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
});
|
||||
}
|
||||
static createGitHubCheckRequest(data) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return yield GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
return yield GitHub.octokitDefaultToken.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
});
|
||||
}
|
||||
static runUpdateAsyncChecksWorkflow(data, mode) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -72,6 +72,7 @@ class BuildParameters {
|
|||
public constantGarbageCollection!: boolean;
|
||||
public githubChecks!: boolean;
|
||||
public asyncWorkflow!: boolean;
|
||||
public githubCheckId!: string;
|
||||
|
||||
static async create(): Promise<BuildParameters> {
|
||||
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
|
||||
|
@ -157,6 +158,7 @@ class BuildParameters {
|
|||
garbageCollectionMaxAge: CloudRunnerOptions.garbageCollectionMaxAge,
|
||||
githubChecks: CloudRunnerOptions.githubChecks,
|
||||
asyncWorkflow: CloudRunnerOptions.asyncCloudRunner,
|
||||
githubCheckId: ``,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,17 +23,17 @@ class CloudRunner {
|
|||
private static cloudRunnerEnvironmentVariables: CloudRunnerEnvironmentVariable[];
|
||||
static lockedWorkspace: string | undefined;
|
||||
public static readonly retainedWorkspacePrefix: string = `retained-workspace`;
|
||||
public static githubCheckId;
|
||||
public static get isCloudRunnerEnvironment() {
|
||||
return process.env[`GITHUB_ACTIONS`] !== `true`;
|
||||
}
|
||||
public static get isCloudRunnerAsyncEnvironment() {
|
||||
return process.env[`GAMECI_ASYNC_WORKFLOW`] === `true`;
|
||||
}
|
||||
public static setup(buildParameters: BuildParameters) {
|
||||
public static async setup(buildParameters: BuildParameters) {
|
||||
CloudRunnerLogger.setup();
|
||||
CloudRunnerLogger.log(`Setting up cloud runner`);
|
||||
CloudRunner.buildParameters = buildParameters;
|
||||
CloudRunner.buildParameters.githubCheckId = await GitHub.createGitHubCheck(CloudRunner.buildParameters.buildGuid);
|
||||
CloudRunner.setupSelectedBuildPlatform();
|
||||
CloudRunner.defaultSecrets = TaskParameterSerializer.readDefaultSecrets();
|
||||
CloudRunner.cloudRunnerEnvironmentVariables =
|
||||
|
@ -79,10 +79,8 @@ class CloudRunner {
|
|||
}
|
||||
|
||||
static async run(buildParameters: BuildParameters, baseImage: string) {
|
||||
CloudRunner.setup(buildParameters);
|
||||
await CloudRunner.setup(buildParameters);
|
||||
try {
|
||||
CloudRunner.githubCheckId = await GitHub.createGitHubCheck(CloudRunner.buildParameters.buildGuid);
|
||||
|
||||
if (buildParameters.retainWorkspace) {
|
||||
CloudRunner.lockedWorkspace = `${CloudRunner.retainedWorkspacePrefix}-${CloudRunner.buildParameters.buildGuid}`;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class GitHub {
|
|||
}
|
||||
|
||||
private static get checkRunId() {
|
||||
return CloudRunner.githubCheckId;
|
||||
return CloudRunner.buildParameters.githubCheckId;
|
||||
}
|
||||
|
||||
private static get owner() {
|
||||
|
@ -77,7 +77,7 @@ class GitHub {
|
|||
};
|
||||
const result = await GitHub.createGitHubCheckRequest(data);
|
||||
|
||||
return result.data.id;
|
||||
return result.data.id.toString();
|
||||
}
|
||||
|
||||
public static async updateGitHubCheck(longDescription, summary, result = `neutral`, status = `in_progress`) {
|
||||
|
@ -126,11 +126,11 @@ class GitHub {
|
|||
}
|
||||
|
||||
public static async updateGitHubCheckRequest(data) {
|
||||
return await GitHub.octokitPAT.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
return await GitHub.octokitDefaultToken.request(`PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}`, data);
|
||||
}
|
||||
|
||||
public static async createGitHubCheckRequest(data) {
|
||||
return await GitHub.octokitPAT.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
return await GitHub.octokitDefaultToken.request(`POST /repos/{owner}/{repo}/check-runs`, data);
|
||||
}
|
||||
|
||||
public static async runUpdateAsyncChecksWorkflow(data, mode) {
|
||||
|
|
Loading…
Reference in New Issue