Add custom executor
What does this MR do?
Supersedes !1115 (diffs).
Create a new executor called custom to allow users to create their own executors as described in #2885 (closed).
Below is a sample of the configuration:
[[runners]]
name = "custom"
url = "https://gitlab.com"
token = "TOKEN"
executor = "custom"
builds_dir = "/builds"
cache_dir = "/cache"
[runners.custom]
config_exec = "/path/to/config.sh"
config_args = [ "SomeArg" ]
config_exec_timeout = 200
prepare_exec = "/path/to/script.sh"
prepare_args = [ "SomeArg" ]
prepare_exec_timeout = 200
run_exec = "/path/to/binary"
run_args = [ "SomeArg" ]
cleanup_exec = "/path/to/executable"
cleanup_args = [ "SomeArg" ]
cleanup_exec_timeout = 200
graceful_kill_timeout = 200
force_kill_timeout = 200
This follows the following format:
- Creates a temp directory in which each script is executed in,
- Sets all GitLab Runner variables marked as
internalorpublicasCUSTOM_ENV_, as they can be read by the script itself, likeCUSTOM_ENV_CI_ID, - Executes
prepare_scriptandcleanup_scriptwith any arguments that are passed toprepare_args&cleanup_args - Executes
run_exec /path/to/script.with_extension stage_name.
It implements a deadline and kills:
- Sends
SIGTERMto script if one of the deadlines from configuration is met. - Send
SIGKILLif thegraceful_kill_timeoutdeadline is met. - The
run_execcan run timeout defined by project or runner, and is subject to job abort.
Adding support for Terminal would be exposing additional script that would run concurrently: terminal_script.
Documentation for this executor was added in a separate MR: !1416 (merged)
Next items
Expose for run_script information about all job configurations: image:, services:, etc.
This should be per-run_script instead of prepare_script or cleanup_script.
Likely the format would be:
CUSTOM_ENV_OPTIONS_IMAGE=ruby:2.1
CUSTOM_ENV_OPTIONS_SERVICES_0_IMAGE=mysql:1.0
...
Two follow up issues are created for this:
Why was this MR needed?
Implement: #2885 (closed).
Does this MR meet the acceptance criteria?
-
Documentation created/updated -
Added tests for this feature/bug -
In case of conflicts with master- branch was rebased
What are the relevant issue numbers?
closes #2885 (closed)
Documentation at: !1416 (merged)