Skip to content

Commit

Permalink
Update vector config if specified
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed Jan 11, 2024
1 parent ef03862 commit d749f70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions proto/depot/cloud/v3/machine.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ message RegisterMachineResponse {
// Enable buildkit context logging. This can be deprecated in the future
// when all customers are using context logging.
optional bool enable_context_logging = 17;
optional string vector_config = 18;
}

// EngineTask represents an instruction to start an engine daemon
Expand Down
6 changes: 6 additions & 0 deletions src/gen/ts/depot/cloud/v3/machine_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ export class RegisterMachineResponse_BuildKitTask extends Message<RegisterMachin
*/
enableContextLogging?: boolean

/**
* @generated from field: optional string vector_config = 18;
*/
vectorConfig?: string

constructor(data?: PartialMessage<RegisterMachineResponse_BuildKitTask>) {
super()
proto3.util.initPartial(data, this)
Expand All @@ -519,6 +524,7 @@ export class RegisterMachineResponse_BuildKitTask extends Message<RegisterMachin
{no: 15, name: 'resolver_concurrency', kind: 'scalar', T: 5 /* ScalarType.INT32 */, opt: true},
{no: 16, name: 'enable_debug_logging', kind: 'scalar', T: 8 /* ScalarType.BOOL */, opt: true},
{no: 17, name: 'enable_context_logging', kind: 'scalar', T: 8 /* ScalarType.BOOL */, opt: true},
{no: 18, name: 'vector_config', kind: 'scalar', T: 9 /* ScalarType.STRING */, opt: true},
])

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RegisterMachineResponse_BuildKitTask {
Expand Down
7 changes: 7 additions & 0 deletions src/tasks/buildkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import {reportUsage} from './usage'
export async function startBuildKit(message: RegisterMachineResponse, task: RegisterMachineResponse_BuildKitTask) {
console.log('Starting BuildKit')

if (task.vectorConfig) {
try {
await fsp.writeFile('/etc/vector/vector.yaml', task.vectorConfig)
await execa('systemctl', ['kill', '-s', 'HUP', '--kill-who=main', 'vector.service'], {stdio: 'inherit'})
} catch {}
}

let useCeph = false
for (const mount of task.mounts) {
await ensureMounted(mount.device, mount.path, mount.fsType, mount.cephVolume, mount.options)
Expand Down

0 comments on commit d749f70

Please sign in to comment.