Skip to content

Commit

Permalink
Merge pull request #61 from depot/user-data
Browse files Browse the repository at this point in the history
Allow setting user-agent
  • Loading branch information
jacobwgillespie authored Sep 20, 2023
2 parents f45185c + 4ed5123 commit 339692f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions proto/depot/cloud/v2/cloud.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ message GetDesiredStateResponse {
string image = 5;
SecurityGroup security_group = 6;
RootVolume root_volume = 7;
optional string user_data = 8;
}

message NewVolume {
Expand Down
6 changes: 6 additions & 0 deletions src/proto/depot/cloud/v2/cloud_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ export class GetDesiredStateResponse_NewMachine extends Message<GetDesiredStateR
*/
rootVolume?: GetDesiredStateResponse_RootVolume

/**
* @generated from field: optional string user_data = 8;
*/
userData?: string

constructor(data?: PartialMessage<GetDesiredStateResponse_NewMachine>) {
super()
proto3.util.initPartial(data, this)
Expand All @@ -331,6 +336,7 @@ export class GetDesiredStateResponse_NewMachine extends Message<GetDesiredStateR
{no: 5, name: 'image', kind: 'scalar', T: 9 /* ScalarType.STRING */},
{no: 6, name: 'security_group', kind: 'enum', T: proto3.getEnumType(GetDesiredStateResponse_SecurityGroup)},
{no: 7, name: 'root_volume', kind: 'message', T: GetDesiredStateResponse_RootVolume},
{no: 8, name: 'user_data', kind: 'scalar', T: 9 /* ScalarType.STRING */, opt: true},
])

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetDesiredStateResponse_NewMachine {
Expand Down
4 changes: 3 additions & 1 deletion src/utils/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ async function runInstance(machine: GetDesiredStateResponse_NewMachine, subnetID
// }

// Construct user data with cloud connection ID
const userData = `
const userData =
machine.userData ||
`
#!/bin/bash
set -e
exec > >(tee /var/log/user-data.log | logger -t user-data -s 2>/dev/console) 2>&1
Expand Down

0 comments on commit 339692f

Please sign in to comment.