Could you please implement an option to keep values of inputs for builds of the same branch?
We use that to filter tests to run, and often we use the same filter when iterating on the same branch. this feature can be handy to not type/remember the filter again on every build.
Hey @Nabil,
This can be approached by using the environment hook to set environment variables based on specific conditions. An example of this application can be seen in our documentation.
The example below export environment variables based on the branch
hooks/environment
#!/bin/bash
set -euo pipefail
if [[ "$BUILDKITE_BRANCH" == "main" ]]; then
export version="v5.7.0"
export environment="prod"
elif [[ "$BUILDKITE_BRANCH" == "test" ]]; then
export version="v5.8.0"
export environment="test"
else
export version="v5.6.0"
export environment="dev"
fi
Thanks Stephanie for your reply,
To be honest I don’t see how we can use the environnent hook in order to re-inject the input values set in the previous build of the same branch.
To be more specific, in our use case, branches are mostly corresponding to feature branches. So we can’t predict the branch name, neither the input values.
Here is a usual scenario:
- developer creates a new branch “foo” corresponding to a new feature.
- He will create a PR corresponding to the foo branch.
- Once he made some progress, he will push into foo and trigger a build in Buildkite.
- In the very first step of the build, we wait for the user action through a block step.
- once the user has triggered the block step, he will be shown a text box (input step) to fill a filter to select tests to run. Eg: * for running all tests. Or test-1* for running all tests starting with test-1.
- as a user, it will be more convenient to reuse the previously used filter. Instead of retyping it again and again ln every new build.
I hope this was more clear.
Hi Nabil,
Thanks for providing the detailed use case. I raised your scenario with the product team as a feature request. We will keep you updated!
Thank you,
Hey Nabil,
I’m from the product team at Buildkite, Thank you for the feature request and the details in the use case.
We are currently working on some improvements to the Blocksteps so they can retain previously entered values across a build.
We hadn’t considered persisting them across builds at this stage, but I’ll take it to the team and will be consider it as a next phase to these upgrades.
Thank you
Liam Clancy