This repository was archived by the owner on May 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +25
-11
lines changed Expand file tree Collapse file tree 3 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -16,14 +16,23 @@ jobs:
1616 test :
1717 runs-on : ubuntu-latest
1818 steps :
19- - uses : actions/checkout@v4
20- - uses : coder/coder/.github/actions/setup-tf@main
21- - uses : oven-sh/setup-bun@v2
19+ - name : Check out code
20+ uses : actions/checkout@v4
21+ - name : Set up Terraform
22+ uses : coder/coder/.github/actions/setup-tf@main
23+ - name : Set up Bun
24+ uses : oven-sh/setup-bun@v2
2225 with :
26+ # We're using the latest version of Bun for now, but it might be worth
27+ # reconsidering. They've pushed breaking changes in patch releases
28+ # that have broken our CI.
29+ # Our PR where issues started to pop up: https://github.com/coder/modules/pull/383
30+ # The Bun PR that broke things: https://github.com/oven-sh/bun/pull/16067
2331 bun-version : latest
24- - name : Setup
32+ - name : Install dependencies
2533 run : bun install
26- - run : bun test
34+ - name : Run tests
35+ run : bun test
2736 pretty :
2837 runs-on : ubuntu-latest
2938 steps :
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ const removeOldContainers = async () => {
2525 "-a" ,
2626 "-q" ,
2727 "--filter" ,
28- ` label=modules-test` ,
28+ " label=modules-test" ,
2929 ] ) ;
3030 let containerIDsRaw = await readableStreamToText ( proc . stdout ) ;
3131 let exitCode = await proc . exited ;
Original file line number Diff line number Diff line change @@ -194,13 +194,18 @@ export const testRequiredVariables = <TVars extends TerraformVariables>(
194194export const runTerraformApply = async < TVars extends TerraformVariables > (
195195 dir : string ,
196196 vars : Readonly < TVars > ,
197- env ?: Record < string , string > ,
197+ customEnv ?: Record < string , string > ,
198198) : Promise < TerraformState > => {
199199 const stateFile = `${ dir } /${ crypto . randomUUID ( ) } .tfstate` ;
200200
201- const combinedEnv = env === undefined ? { } : { ...env } ;
202- for ( const [ key , value ] of Object . entries ( vars ) ) {
203- combinedEnv [ `TF_VAR_${ key } ` ] = String ( value ) ;
201+ const childEnv : Record < string , string | undefined > = {
202+ ...process . env ,
203+ ...( customEnv ?? { } ) ,
204+ } ;
205+ for ( const [ key , value ] of Object . entries ( vars ) as [ string , JsonValue ] [ ] ) {
206+ if ( value !== null ) {
207+ childEnv [ `TF_VAR_${ key } ` ] = String ( value ) ;
208+ }
204209 }
205210
206211 const proc = spawn (
@@ -216,7 +221,7 @@ export const runTerraformApply = async <TVars extends TerraformVariables>(
216221 ] ,
217222 {
218223 cwd : dir ,
219- env : combinedEnv ,
224+ env : childEnv ,
220225 stderr : "pipe" ,
221226 stdout : "pipe" ,
222227 } ,
You can’t perform that action at this time.
0 commit comments