All is working fine. I’m getting all changesets from all cloned repositories, but I want to limit a build when some files change only.
I know I can use:
when {
changeset: "**/somefile"
}
but I want to limit this when somefile change in one cloned repo or any file change on another. Something like (it is not working, for obvious reasons):
As far as I know, the changeset condition in the when directive is used to control whether the stage should be executed based on changes in the source code.
However, I don’t think it supports filtering by specific Git repositories when multiple repositories are used in the same pipeline.
A workaround for this limitation would maybe to use a script step to manually check for changes in the specific repositories.
You could use Git commands to check for changes in the specific files or directories you’re interested in.
In this example, the expression condition in the when directive is used to execute a shell script that checks for changes in the specific files or directories.
The git diff --quiet HEAD HEAD~1 command is used to check for changes between the current commit and the previous commit.
The **/somefile pattern is used to check for changes in a specific file, and the returnStatus: true option is used to return the exit status of the command instead of failing the build if the command fails.
I know it’s pretty verbose and not elegant; you may find a much better solution later on.