Skip to content

Commit d90bf7a

Browse files
jason-rlclaude
andcommitted
Add architecture-specific path inputs to deploy-agent action
Adds x86-64-path and arm64-path inputs to support uploading separate tar files per architecture. When provided, these files are uploaded as separate objects and the agent is created with x86_64_object_id and arm64_object_id in the object source. Changes: - action.yml: Add x86-64-path, arm64-path inputs and corresponding outputs - validators.ts: Parse new inputs and update validation for tar source type - agent-deployer.ts: Rewrite deployTarAgent to handle arch-specific uploads Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b8c9e3a commit d90bf7a

5 files changed

Lines changed: 121 additions & 21 deletions

File tree

action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ inputs:
5656
description: 'Path to file or tar archive (required if source-type=tar/file)'
5757
required: false
5858

59+
x86-64-path:
60+
description: 'Path to tar archive for x86_64 architecture (optional, used with source-type=tar)'
61+
required: false
62+
63+
arm64-path:
64+
description: 'Path to tar archive for arm64 architecture (optional, used with source-type=tar)'
65+
required: false
66+
5967
# Common inputs
6068
setup-commands:
6169
description: 'Newline-separated setup commands to run after agent installation'
@@ -83,6 +91,12 @@ outputs:
8391
object-id:
8492
description: 'The ID of the uploaded object (if applicable, e.g., obj_xxxx)'
8593

94+
x86-64-object-id:
95+
description: 'The ID of the uploaded x86_64 object (if applicable)'
96+
97+
arm64-object-id:
98+
description: 'The ID of the uploaded arm64 object (if applicable)'
99+
86100
agent-name:
87101
description: 'The final name of the created agent'
88102

dist/index.js

Lines changed: 48 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agent-deployer.ts

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,44 @@ async function deployTarAgent(
119119
): Promise<DeploymentResult> {
120120
core.info('Deploying tar agent...');
121121

122-
if (!inputs.path) {
123-
throw new Error('path is required for tar agent deployment');
122+
const objectSource: Record<string, unknown> = {
123+
agent_setup: inputs.setupCommands || [],
124+
};
125+
126+
let firstObjectId: string | undefined;
127+
128+
// Upload universal object if path provided
129+
if (inputs.path) {
130+
const tarPath = resolvePath(inputs.path);
131+
const result = await uploadTarFile(client, tarPath, inputs.objectTtlDays);
132+
objectSource.object_id = result.objectId;
133+
firstObjectId = result.objectId;
134+
core.info(`Universal object uploaded: ${result.objectId}`);
124135
}
125136

126-
const tarPath = resolvePath(inputs.path);
137+
// Upload x86_64 object if path provided
138+
if (inputs.x86_64Path) {
139+
const tarPath = resolvePath(inputs.x86_64Path);
140+
const result = await uploadTarFile(client, tarPath, inputs.objectTtlDays);
141+
objectSource.x86_64_object_id = result.objectId;
142+
firstObjectId = firstObjectId || result.objectId;
143+
core.info(`x86_64 object uploaded: ${result.objectId}`);
144+
}
127145

128-
// Upload tar file
129-
const uploadResult = await uploadTarFile(client, tarPath, inputs.objectTtlDays);
146+
// Upload arm64 object if path provided
147+
if (inputs.arm64Path) {
148+
const tarPath = resolvePath(inputs.arm64Path);
149+
const result = await uploadTarFile(client, tarPath, inputs.objectTtlDays);
150+
objectSource.arm64_object_id = result.objectId;
151+
firstObjectId = firstObjectId || result.objectId;
152+
core.info(`arm64 object uploaded: ${result.objectId}`);
153+
}
154+
155+
if (!firstObjectId) {
156+
throw new Error(
157+
'At least one of path, x86-64-path, or arm64-path is required for tar deployment'
158+
);
159+
}
130160

131161
// Create agent with object source
132162
// Using client.api.post because SDK v1.0.0 types are missing 'version' field in AgentCreateParams
@@ -137,18 +167,15 @@ async function deployTarAgent(
137167
is_public: inputs.isPublic,
138168
source: {
139169
type: 'object',
140-
object: {
141-
object_id: uploadResult.objectId,
142-
agent_setup: inputs.setupCommands || [],
143-
},
170+
object: objectSource,
144171
},
145172
},
146173
});
147174

148175
return {
149176
agentId: agent.id,
150177
agentName: agent.name,
151-
objectId: uploadResult.objectId,
178+
objectId: firstObjectId,
152179
};
153180
}
154181

src/validators.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export interface ActionInputs {
1010
gitRepository?: string;
1111
gitRef?: string;
1212
path?: string;
13+
x86_64Path?: string;
14+
arm64Path?: string;
1315
npmPackage?: string;
1416
npmRegistryUrl?: string;
1517
pipPackage?: string;
@@ -37,6 +39,8 @@ export function getInputs(): ActionInputs {
3739
gitRepository: core.getInput('git-repository') || undefined,
3840
gitRef: core.getInput('git-ref') || undefined,
3941
path: core.getInput('path') || undefined,
42+
x86_64Path: core.getInput('x86-64-path') || undefined,
43+
arm64Path: core.getInput('arm64-path') || undefined,
4044
npmPackage: core.getInput('npm-package') || undefined,
4145
npmRegistryUrl: core.getInput('npm-registry-url') || undefined,
4246
pipPackage: core.getInput('pip-package') || undefined,
@@ -67,6 +71,23 @@ export function validateInputs(inputs: ActionInputs): void {
6771
// Validate source-specific inputs
6872
switch (inputs.sourceType) {
6973
case 'tar':
74+
// For tar, at least one of path, x86-64-path, or arm64-path must be provided
75+
if (!inputs.path && !inputs.x86_64Path && !inputs.arm64Path) {
76+
throw new Error(
77+
'At least one of path, x86-64-path, or arm64-path is required when source-type is "tar"'
78+
);
79+
}
80+
if (inputs.path) {
81+
validatePath(inputs.path, inputs.sourceType);
82+
}
83+
if (inputs.x86_64Path) {
84+
validatePath(inputs.x86_64Path, inputs.sourceType);
85+
}
86+
if (inputs.arm64Path) {
87+
validatePath(inputs.arm64Path, inputs.sourceType);
88+
}
89+
break;
90+
7091
case 'file':
7192
if (!inputs.path) {
7293
throw new Error(`path is required when source-type is "${inputs.sourceType}"`);

0 commit comments

Comments
 (0)