Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Dynamic Workflows

So far all build definitions have been quite static. You define one or multiple infrabox.json files and use them in you project. This of course has some limitations. In some situations it is helpful to define the jobs dynamically. Let's say you don't want to run all your tests if you only changed the documentation of your project. Or you would like to have some special keywords in your commit message to trigger more/less tests. Or other scenarios where a statically defined workflow is just not sufficient.

For this InfraBox supports dynamic workflows. Every job in a build may create child jobs at runtime. All you have to to is to create a infrabox.json file with the jobs you would like to run as children of your current job and save it to /infrabox/output/infrabox.json. The jobs will automatically depend on your current job. So you don't have to explicitly add it to depends_on.

The Dockerfile of the parent to create a child a runtime (indented for readability):

FROM alpine

CMD echo '{
    "jobs": [{
        "name": "dynamic-child",
        "type": "docker",
        "build_context": "../..",
        "build_only": false,
        "resources": {"limits": {"cpu": 1, "memory": 1024}},
        "docker_file": "infrabox/dynamic-child/Dockerfile"
}' > /infrabox/output/infrabox.json

Feel free to write more complicated logic to generate your workflows.

You can’t perform that action at this time.