Adaptive CI Pipelines with Dynamic Tasks

CI/CD
May 31, 2024
Adaptive CI Pipelines with Dynamic Tasks

In most CI platforms, tasks needs to be defined statically when the run starts. This limits the flexibility in workflows, especially as projects become more advanced and yaml configuration gets more complicated. It's especially unfortunate to have this limitation in a dev tool built for engineers.

Engineers are adept at writing code to solve problems. That's why when we built Mint, we knew we wanted to support dynamic tasks. We wanted to give engineers the ability to define tasks at runtime, utilizing any programming language and logic that they wanted.

Dynamic tasks enable building CI pipelines which are adaptive based on things like the commit contents or data from external data sources. They unlock a lot of possibilities for building highly performant CI pipelines.

#Task Data Structures

YAML gets a lot of criticism in its use for configuring infrastructure. It's usually not YAML itself that's the issue though. YAML is just a format for serializing data. The pain points around YAML configuration are usually more centered around

having to git push to run workflows, not being able to debug, and implementing complex logic in embedded expressions rather than just writing code.

To generate dynamic tasks in Mint, you can use any programming language to build an array of task definitions, and then serialize it as YAML.

Here's a simple example using bash:

1
tasks:
2
- key: generate-dynamic-task
3
run: |
4
cat << EOF | tee $MINT_DYNAMIC_TASKS/tasks.yml
5
- key: dynamic-task-1
6
run: echo this is the first dynamic task
7
- key: dynamic-task-2
8
run: echo this is the second dynamic task
9
EOF

You probably don't want to use bash to generate dynamic tasks, although we've used it in some of our own workflows by leveraging envsubst with template files.

Here's a more practical example using Ruby;

1
tasks:
2
- key: ruby
3
call: mint/install-ruby 1.0.9
4
with:
5
ruby-version: 3.3.1
6
7
- key: generate-dynamic-tasks
8
use: [ruby]
9
run: |
10
ruby -e '
11
require "yaml"
12
tasks = [
13
{
14
"key" => "dynamic-task",
15
"run" => "echo this task was generated from ruby"
16
}
17
]
18
puts YAML.dump(tasks)
19
' | tee $MINT_DYNAMIC_TASKS/tasks.yaml

We showed implementing this Ruby script inline with the task definition, but it's more common to check the script in as a separate file, such as .mint/generate-tasks.rb and then call ruby .mint/generate-tasks.rb > $MINT_DYNAMIC_TASKS/tasks.yaml in your Mint task definition.

For more information, see the documentation on generating dynamic tasks in Mint.

#Demo

Here's a 3 minute video on how easy it is to generate dynamic tasks in Mint.

Never miss an update

Get the latest releases and news about RWX and our ecosystem with our newsletter.

Share this post

Enjoyed this post? Please share it on your favorite social network!

Related posts

Read more on updates and advice from the RWX engineering team

See all posts
RWX November 2025 Recap: container image builds, git patching runs, OTEL, and more
CI/CD

RWX November 2025 Recap: container image builds, git patching runs, OTEL, and more

At RWX, we use our own product to rapidly prototype, develop, and ship features all the time. Here's what we've built recently...

Dec 2, 2025
Read now
We deleted our Dockerfiles: a better, faster way to build container images
CI/CD

We deleted our Dockerfiles: a better, faster way to build container images

Two weeks ago, we deleted the Dockerfile for our application, and we deleted the step in our CI pipelines that previously ran docker build.

Nov 24, 2025
Read now
rwx run - development without the push and pull
CI/CD

rwx run - development without the push and pull

Beginning with version v2, rwx run can now launch a build directly from your terminal - local code changes included.

Nov 20, 2025
Read now