Skip to content

Commit 9e3637f

Browse files
authored
Merge pull request #49 from oslabs-beta/configpagechanges
feat: added extra fields for user input on dashboard page for AWS dep…
2 parents 4840bbc + d2deaa4 commit 9e3637f

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

client/src/pages/ConfigurePage.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ export default function ConfigurePage() {
344344
</div>
345345

346346
{provider === "aws" && (
347+
<>
347348
<label className="grid gap-1">
348349
<span className="text-sm font-medium">AWS Role (OIDC)</span>
349350
<select
@@ -364,6 +365,28 @@ export default function ConfigurePage() {
364365
the deploy job.
365366
</span>
366367
</label>
368+
<label className="grid gap-1">
369+
<span className="text-sm font-medium">AWS Role Session Name</span>
370+
<input
371+
disabled={busy}
372+
value={options.awsSessionName ?? ""}
373+
onChange={(e) => setOption("awsSessionName", e.target.value)}
374+
className="rounded-md border border-white/25 px-3 py-2 text-sm font-mono text-white bg-white/10 placeholder-white/60 disabled:bg-white/5 disabled:text-slate-400"
375+
placeholder="autodeploy"
376+
/>
377+
</label>
378+
379+
<label className="grid gap-1">
380+
<span className="text-sm font-medium">AWS Region</span>
381+
<input
382+
disabled={busy}
383+
value={options.awsRegion ?? ""}
384+
onChange={(e) => setOption("awsRegion", e.target.value)}
385+
className="rounded-md border border-white/25 px-3 py-2 text-sm font-mono text-white bg-white/10 placeholder-white/60 disabled:bg-white/5 disabled:text-slate-400"
386+
placeholder="us-east-1"
387+
/>
388+
</label>
389+
</>
367390
)}
368391

369392
{provider === "gcp" && (

client/src/store/usePipelineStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ type PipelineState = {
1414
testCmd: string;
1515
buildCmd: string;
1616
awsRoleArn?: string;
17+
awsSessionName?: string;
18+
awsRegion?: string;
1719
gcpServiceAccountEmail?: string;
1820
};
1921
provider: "aws" | "gcp" | "jenkins";
@@ -72,6 +74,8 @@ const initial: PipelineState = {
7274
installCmd: "npm ci",
7375
testCmd: "npm test",
7476
buildCmd: "npm run build",
77+
awsSessionName: "autodeploy",
78+
awsRegion: "us-east-1",
7579
gcpServiceAccountEmail: "",
7680
},
7781
provider: "aws",

server/tools/pipeline_generator.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export const pipeline_generator = {
1919
testCmd: z.string().optional(),
2020
buildCmd: z.string().optional(),
2121
awsRoleArn: z.string().optional(),
22+
awsSessionName: z.string().optional(),
23+
awsRegion: z.string().optional(),
2224
gcpServiceAccountEmail: z.string().optional(),
2325
stages: z.array(z.enum(["build", "test", "deploy"])).optional(),
2426
})
@@ -33,6 +35,8 @@ export const pipeline_generator = {
3335
testCmd: options?.testCmd,
3436
buildCmd: options?.buildCmd,
3537
awsRoleArn: options?.awsRoleArn,
38+
awsSessionName: options?.awsSessionName,
39+
awsRegion: options?.awsRegion,
3640
stages: options?.stages,
3741
};
3842

@@ -103,6 +107,8 @@ export const pipeline_generator = {
103107
testCmd: options?.testCmd,
104108
buildCmd: options?.buildCmd,
105109
awsRoleArn: options?.awsRoleArn,
110+
awsSessionName: options?.awsSessionName,
111+
awsRegion: options?.awsRegion,
106112
gcpServiceAccountEmail: options?.gcpServiceAccountEmail,
107113
stages: options?.stages,
108114
};
@@ -177,7 +183,8 @@ jobs:
177183
uses: aws-actions/configure-aws-credentials@v4
178184
with:
179185
role-to-assume: ${normalized.awsRoleArn ?? "REPLACE_ME"}
180-
aws-region: us-east-1
186+
role-session-name: ${normalized.awsSessionName ?? "autodeploy"}
187+
aws-region: ${normalized.awsRegion ?? "us-east-1"}
181188
- name: Deploy Application
182189
run: echo "Deploying ${repo} to AWS..."
183190
`;

0 commit comments

Comments
 (0)