Skip to content

Commit 9016d6f

Browse files
authored
fix: Allow boolean values in variables (#1302)
See <https://gitlab.com/gitlab-org/gitlab/-/issues/21587#note_2016187568>.
1 parent 52b231f commit 9016d6f

File tree

3 files changed

+2
-32
lines changed

3 files changed

+2
-32
lines changed

src/parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class Parser {
138138
let value = _value;
139139
if (value === null) value = ""; // variable's values are nullable
140140
assert(
141-
typeof value === "string" || typeof value === "number",
141+
typeof value === "string" || typeof value === "number" || typeof value === "boolean",
142142
chalk`{blueBright ${jobName}} has invalid variables hash of key value pairs. ${key}=${value}`
143143
);
144144
jobData.variables[key] = String(value);
@@ -148,7 +148,7 @@ export class Parser {
148148
const service = jobData.services[i];
149149
for (const [key, value] of Object.entries(service.variables || {})) {
150150
assert(
151-
typeof value === "string" || typeof value === "number",
151+
typeof value === "string" || typeof value === "number" || typeof value === "boolean",
152152
chalk`{blueBright ${jobName}.services[${i}]} has invalid variables hash of key value pairs. ${key}=${value}`
153153
);
154154
jobData.services[i].variables[key] = String(value);

tests/test-cases/invalid-variables-bool/.gitlab-ci.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/test-cases/invalid-variables-bool/integration.invalid-variables-bool.test.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)