1

I'm looking for a feature in Buildkite, similar to Gitlab's rules: change:, where a pipeline step is only executed if a specific file has been changed in the commit.

Something like this would be ideal, but doesn't seem to be available:

steps:
  command: "package_dependencies.sh"
  change: "./requirements.txt"

A built-in Buildkite solution is a plus, but any custom solution using bash or python scripts would do.

DV82XL
  • 5,350
  • 5
  • 30
  • 59

1 Answers1

1

Within a bash script that builds your pipeline, you could potentially run the git log command to see if a specific file has changed and then capture that in a variable to use when you are creating a step.

For example:

file_changed = $(git log -n 1 --oneline | grep <name-of-file>)

With this variable you can have a condition to only create the step if the variable has contents.

Git log documentation link: https://git-scm.com/docs/git-log

CB Hoffman
  • 191
  • 6