Skip to content

Commit 3a06c20

Browse files
feat(ci): rename computeVariant to compute_type and apply as resource tag (#97)
Aligns CI and CDK terminology with the existing ComputeType union in repo-config.ts. build.yml matrix key, env var, and cdk.context.json key are all renamed from computeVariant to compute_type. The CDK app now reads compute_type from context (default: agentcore) and applies it as a resource tag for per-type baseline diffs and cost attribution. Closes phase 2 items in #73. Co-authored-by: scottschreckengaust <345885+scottschreckengaust@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8ad11d1 commit 3a06c20

3 files changed

Lines changed: 33 additions & 6 deletions

File tree

.github/workflows/build.yml

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

cdk/src/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const stack = new AgentStack(
4242
},
4343
);
4444

45+
const computeType = app.node.tryGetContext('compute_type') ?? 'agentcore';
46+
Tags.of(stack).add('compute_type', computeType);
47+
4548
const githubTagKeys = [
4649
'sha',
4750
'ref',

cdk/test/stacks/github-tags.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ function synthWithTags(context: Record<string, string> = {}): Template {
4444
env: { account: '123456789012', region: 'us-east-1' },
4545
});
4646

47+
const computeType = app.node.tryGetContext('compute_type') ?? 'agentcore';
48+
Tags.of(stack).add('compute_type', computeType);
49+
4750
const githubTagKeys = [
4851
'sha', 'ref', 'ref-type', 'actor', 'head-ref',
4952
'base-ref', 'pr-number', 'run-id', 'run-attempt',
@@ -125,4 +128,25 @@ describe('github:* resource tags', () => {
125128
expect(tags.find(t => t.Key === 'github:sha')!.Value).toBe('none');
126129
expect(tags.find(t => t.Key === 'github:head-ref')!.Value).toBe('none');
127130
});
131+
132+
test('compute_type tag defaults to "agentcore" when no context is provided', () => {
133+
const resources = templateWithDefaults.findResources('AWS::DynamoDB::Table');
134+
const firstResource = Object.values(resources)[0];
135+
const tags: Array<{ Key: string; Value: string }> = firstResource?.Properties?.Tags ?? [];
136+
137+
const tag = tags.find(t => t.Key === 'compute_type');
138+
expect(tag).toBeDefined();
139+
expect(tag!.Value).toBe('agentcore');
140+
});
141+
142+
test('compute_type tag reflects context value when provided', () => {
143+
const template = synthWithTags({ compute_type: 'ecs' });
144+
const resources = template.findResources('AWS::DynamoDB::Table');
145+
const firstResource = Object.values(resources)[0];
146+
const tags: Array<{ Key: string; Value: string }> = firstResource?.Properties?.Tags ?? [];
147+
148+
const tag = tags.find(t => t.Key === 'compute_type');
149+
expect(tag).toBeDefined();
150+
expect(tag!.Value).toBe('ecs');
151+
});
128152
});

0 commit comments

Comments
 (0)