-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add --shell-executor option. (#1447).
Allows forcing to always use the shell executor even when there are images declared somewhere. Avoids image downloads and updates when you want a speedy pipeline
- Loading branch information
1 parent
f27c97e
commit 5337c1b
Showing
6 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
test-job: | ||
image: alpine:latest | ||
stage: test | ||
script: | ||
- echo "Heya from default-image" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { WriteStreamsMock } from "../../../src/write-streams.js"; | ||
Check failure on line 1 in tests/test-cases/shell-executor/integration.test.ts
|
||
import { handler } from "../../../src/handler.js"; | ||
Check failure on line 2 in tests/test-cases/shell-executor/integration.test.ts
|
||
|
||
test("shell-executor false default-image alpine", async () => { | ||
const writeStreams = new WriteStreamsMock(); | ||
await handler({ | ||
pullPolicy: "if-not-present", | ||
cwd: "tests/test-cases/shell-executor/", | ||
shellExecutor: false, | ||
defaultImage: "alpine:latest", | ||
job: ["test-job"], | ||
noColor: true, | ||
}, writeStreams); | ||
|
||
expect(writeStreams.stdoutLines.join("\n")).toMatch(/test-job starting alpine:latest \(test\)/); | ||
}); | ||
|
||
test("shell-executor false default-image null but job image alpine", async () => { | ||
const writeStreams = new WriteStreamsMock(); | ||
await handler({ | ||
pullPolicy: "if-not-present", | ||
cwd: "tests/test-cases/shell-executor/", | ||
shellExecutor: false, | ||
defaultImage: null, | ||
job: ["test-job"], | ||
noColor: true, | ||
}, writeStreams); | ||
|
||
expect(writeStreams.stdoutLines.join("\n")).toMatch(/test-job starting alpine:latest \(test\)/); | ||
}); | ||
|
||
test("shell-executor true default-image doesnt-matter", async () => { | ||
const writeStreams = new WriteStreamsMock(); | ||
await handler({ | ||
pullPolicy: "if-not-present", | ||
cwd: "tests/test-cases/shell-executor/", | ||
shellExecutor: true, | ||
defaultImage: "doesnt-matter", | ||
job: ["test-job"], | ||
noColor: true, | ||
}, writeStreams); | ||
|
||
expect(writeStreams.stdoutLines.join("\n")).toMatch(/test-job starting shell \(test\)/); | ||
expect(writeStreams.stderrLines.join("\n")).toMatch(/WARN\s\s--default-image does not work with --shell-executor=true/); | ||
}); |