Jsonnet Project Template

    This project template serves as a starting point to use GitLab CI Dynamic Child Pipelines with Jsonnet to generate complex gitlab-ci.yml files at runtime.

    Jsonnet provides functions, variables, loops, and conditionals that allow for fully paramaterized YAML configuration.


    This project contains two files:


    This simple example contains a Jsonnet script that generates two unique jobs for a scenario where you might want to dynamically generate your testing jobs:

    • rspec
    • rspec 2

    local param_job serves as the template for all the jobs. It also takes advantage of the parallel keyword to create two copies of each job.

    From here you can use Jsonnet to generate CI YAML in an easy way. To learn more about Jsonnet, check out its tutorial or getting started guide. The complete GitLab CI YAML Configuration Reference is also available to help.


    The .gitlab-ci.yml file contains two important jobs:


    This job fetches the Jsonnet package from apk and runs it to create the generated-config.yml, which is the emitted YAML. The generated-config.yml is stored as an artifact to make it available for triggering in the next step.


    trigger-tests is a trigger job responsible for starting the dynamic child pipeline. It takes the YAML artifact from the previous jsonnet job and starts the dynamic pipeline.


    An example showing how to use Jsonnet with GitLab dynamic child pipelines



    贡献者 2

    J Jason Yavorska @Jason Yavorska
    K Kamil Trzcinski @Kamil Trzcinski


    • Jsonnet 100.0 %