Skip to content

Commit bbc9805

Browse files
committed
add command option also to docker job type
1 parent 38fdc4c commit bbc9805

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

docs/doc.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The job type docker is one of the most important jobs. You can use it to run any
2525
"type": "docker",
2626
"name": "build",
2727
"docker_file": "infrabox/build-and-test/Dockerfile",
28+
"command": ["echo", "hello world"]
2829
"resources": { "limits": { "cpu": 1, "memory": 1024 } },
2930
"build_only": false,
3031
"build_context": "...",
@@ -46,6 +47,7 @@ The job type docker is one of the most important jobs. You can use it to run any
4647
|type|true|string||Has to be "docker" to run a single Docker container|
4748
|name|true|string||Name of the job|
4849
|docker_file|true|string||Path to the `Dockerfile`|
50+
|command|false|string||The command in [exec form](https://docs.docker.com/engine/reference/builder/#cmd) to be used when the container is run. Ignored if `build_only=false`|
4951
|resources|true|[Resource Configuration](#resource-configuration)||Specify the required resources for your job|
5052
|build_only|true|boolean|true|If set to true the container will only be build but not run. Use it if you only want to build a container and push it to a registry. See here for how to push to a docker registry.|
5153
|build_context|false|string||Specify the docker build context. If not set the directory containing the `infrabox.json` file will be used.|

src/pyinfrabox/infrabox/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def parse_docker_image(d, path):
246246
def parse_docker(d, path):
247247
check_allowed_properties(d, path, ("type", "name", "docker_file", "depends_on", "resources",
248248
"build_only", "environment",
249-
"build_arguments", "deployments", "timeout", "security_context",
249+
"build_arguments", "deployments", "timeout", "security_context", "command",
250250
"build_context", "cache", "repository", "cluster", "services", "registries"))
251251
check_required_properties(d, path, ("type", "name", "docker_file", "resources"))
252252
check_name(d['name'], path + ".name")
@@ -292,6 +292,9 @@ def parse_docker(d, path):
292292
if 'registries' in d:
293293
parse_registries(d['registries'], path + '.registries')
294294

295+
if 'command' in d:
296+
check_string_array(d['command'], path + ".command")
297+
295298
def parse_docker_compose(d, path):
296299
check_allowed_properties(d, path, ("type", "name", "docker_compose_file", "depends_on",
297300
"environment", "resources", "cache", "timeout", "cluster", "repository"))

0 commit comments

Comments
 (0)