Skip to content

Commit e3da1e4

Browse files
committed
Add process.env to all coana calls
1 parent 183ff9d commit e3da1e4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/commands/scan/perform-reachability-analysis.mts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,20 @@ export async function performReachabilityAnalysis(
166166
]
167167

168168
// Build environment variables.
169-
const env: NodeJS.ProcessEnv = {
170-
...process.env,
171-
}
169+
const coanaEnv: NodeJS.ProcessEnv = {}
172170
// do not pass default repo and branch name to coana to avoid mixing
173171
// buckets (cached configuration) from projects that are likely very different.
174172
if (repoName && repoName !== constants.SOCKET_DEFAULT_REPOSITORY) {
175-
env['SOCKET_REPO_NAME'] = repoName
173+
coanaEnv['SOCKET_REPO_NAME'] = repoName
176174
}
177175
if (branchName && branchName !== constants.SOCKET_DEFAULT_BRANCH) {
178-
env['SOCKET_BRANCH_NAME'] = branchName
176+
coanaEnv['SOCKET_BRANCH_NAME'] = branchName
179177
}
180178

181179
// Run Coana with the manifests tar hash.
182180
const coanaResult = await spawnCoana(coanaArgs, orgSlug, {
183181
cwd,
184-
env,
182+
env: coanaEnv,
185183
spinner,
186184
stdio: 'inherit',
187185
})

src/utils/coana.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function spawnCoana(
3535
__proto__: null,
3636
...options,
3737
} as ShadowBinOptions
38-
const mixinsEnv: Record<string, string> = {
38+
const mixinsEnv: NodeJS.ProcessEnv = {
3939
SOCKET_CLI_VERSION: constants.ENV.INLINED_SOCKET_CLI_VERSION,
4040
}
4141
const defaultApiToken = getDefaultApiToken()
@@ -63,6 +63,8 @@ export async function spawnCoana(
6363
{
6464
...spawnOpts,
6565
env: {
66+
...process.env,
67+
...constants.processEnv,
6668
...mixinsEnv,
6769
...spawnEnv,
6870
},

test/utils.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function cmdit(
7676
export async function invokeNpm(
7777
entryPath: string,
7878
args: string[],
79-
env = {},
79+
spawnEnv = {},
8080
): Promise<{
8181
code: number
8282
error?: {
@@ -93,7 +93,7 @@ export async function invokeNpm(
9393
env: {
9494
...process.env,
9595
...constants.processEnv,
96-
...env,
96+
...spawnEnv,
9797
},
9898
})
9999
return {

0 commit comments

Comments
 (0)