This commit is contained in:
@@ -14,6 +14,11 @@ import { setImmediate as yieldToController } from 'node:timers/promises';
|
||||
import { choosePlacement, availableHostPort, type PlacementOptions } from '../hosts/capacity.js';
|
||||
import { randomBytes, randomUUID } from 'node:crypto';
|
||||
import { bankCredential } from '../auth/bank.js';
|
||||
import { moderationCredential } from '../moderation/credentials.js';
|
||||
import {
|
||||
moderationConfiguration,
|
||||
moderationConfigureCapability
|
||||
} from '../moderation/configuration.js';
|
||||
import { posix } from 'node:path';
|
||||
import { db } from '../db/index.js';
|
||||
import { unsettledCancelledCommand } from './cancellation.js';
|
||||
@@ -1996,6 +2001,7 @@ async function processJob(job: Job, eligibility: (job: Job) => string | null) {
|
||||
let prepared: PreparedNativeLaunch | undefined;
|
||||
let preparedKey: string | null = null;
|
||||
let preparedPassword: string | undefined;
|
||||
let preparedModeration = false;
|
||||
try {
|
||||
if (job.action === 'create' || job.action === 'rebuild') {
|
||||
if (
|
||||
@@ -2027,6 +2033,11 @@ async function processJob(job: Job, eligibility: (job: Job) => string | null) {
|
||||
(files.length ? runtimePasswordForServer(job.server) : undefined) ||
|
||||
config.rcon.password ||
|
||||
randomBytes(32).toString('hex');
|
||||
const rebuilding = job.action === 'rebuild' && !migration;
|
||||
const generation = instance.generation + (rebuilding ? 1 : 0);
|
||||
preparedModeration =
|
||||
!!config.publicUrl &&
|
||||
!!host.inventory.capabilities?.includes(moderationConfigureCapability);
|
||||
prepared = await prepareNativeLaunch({
|
||||
game: prior.game,
|
||||
mapSlug: prior.mapSlug,
|
||||
@@ -2035,7 +2046,15 @@ async function processJob(job: Job, eligibility: (job: Job) => string | null) {
|
||||
serverKey: preparedKey,
|
||||
rconPassword: preparedPassword,
|
||||
bankToken: bankCredential(instance.id),
|
||||
rebuild: job.action === 'rebuild' && !migration,
|
||||
...(preparedModeration
|
||||
? {
|
||||
moderation: moderationConfiguration(
|
||||
moderationCredential(instance.id, generation),
|
||||
generation
|
||||
)
|
||||
}
|
||||
: {}),
|
||||
rebuild: rebuilding,
|
||||
safetyOverride: overrideSafety,
|
||||
unhealthyRecovery:
|
||||
!files.length &&
|
||||
@@ -2124,6 +2143,16 @@ async function processJob(job: Job, eligibility: (job: Job) => string | null) {
|
||||
return;
|
||||
}
|
||||
if (prepared) {
|
||||
if (
|
||||
preparedModeration &&
|
||||
!liveHost.inventory.capabilities?.includes(moderationConfigureCapability)
|
||||
) {
|
||||
hold(
|
||||
job,
|
||||
'Host moderation support changed during preparation; preparing the current selection next pass.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Compare the same runtime config bytes while rechecking current promoted files.
|
||||
const expected =
|
||||
migration && isRebalanceMigration(job.id)
|
||||
|
||||
Reference in New Issue
Block a user