Skip to content

Commit a0a22be

Browse files
authored
Merge pull request #5 from SanjulaGanepola/fix/step-exit-code
Call `process.exit` with step exit code and filter env vars with spaces
2 parents 0f919a8 + 614a170 commit a0a22be

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

.env.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
IBMI_HOST=
2+
IBMI_USER=
3+
IBMI_PASSWORD=
4+
IBMI_SSH_PORT=

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ test
55
src
66
!dist/src
77
node_modules
8-
.vscode
8+
.vscode
9+
.env.sample

.vscode/launch.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"name": "Debug ibmi-ci CLI",
99
"type": "node",
1010
"request": "launch",
11-
"program": "${workspaceFolder:ibmicli}/dist/index.js",
11+
"program": "${workspaceFolder:ibmi-ci}/dist/index.js",
1212
"sourceMaps": true,
1313
"args": [
14-
"--lcwd", "${workspaceFolder:ibmicli}/src",
14+
"--lcwd", "${workspaceFolder:ibmi-ci}/src",
1515
"--cmd", "mkdir -p './builds/icisrc'",
1616
"--ignore", "--cmd", "woejhraljdsfn",
1717
"--rcwd", "./builds/icisrc",
@@ -27,13 +27,13 @@
2727
"type": "npm",
2828
"script": "webpack:dev"
2929
},
30-
"envFile": "${workspaceFolder:ibmicli}/.env"
30+
"envFile": "${workspaceFolder:ibmi-ci}/.env"
3131
},
3232
{
3333
"name": "Debug ibmi-ci yaml",
3434
"type": "node",
3535
"request": "launch",
36-
"program": "${workspaceFolder:ibmicli}/dist/index.js",
36+
"program": "${workspaceFolder:ibmi-ci}/dist/index.js",
3737
"sourceMaps": true,
3838
"args": [
3939
"--file", "examples/exampleA.yml",
@@ -42,7 +42,7 @@
4242
"type": "npm",
4343
"script": "webpack:dev"
4444
},
45-
"envFile": "${workspaceFolder:ibmicli}/.env"
45+
"envFile": "${workspaceFolder:ibmi-ci}/.env"
4646
},
4747
]
4848
}

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ async function main() {
7272

7373
const result = await executor.executeSteps({log: logger});
7474
executor.dispose();
75+
console.log(`ibmi-ci completed with exit code ${result.code}.`);
76+
process.exit(result.code);
7577
}
7678
}
7779

src/steps/actions/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class EnvironmentStep extends StepI {
1212
`CommonProgramFiles(x86)`, `ProgramFiles(x86)`
1313
];
1414

15-
const environmentVariables = Object.keys(process.env).filter(key => !ignoredEnvironmentVariables.includes(key) && !key.includes('.'));
15+
const environmentVariables = Object.keys(process.env).filter(key => !ignoredEnvironmentVariables.includes(key) && !key.includes('.') && !key.includes(' '));
1616
const commandString = environmentVariables.map(key => `${key}='${process.env[key]}'`).join(` `);
1717

1818
this.log(`Setting environment variables: ${environmentVariables.join(`, `)}`);

0 commit comments

Comments
 (0)