For example.
My repo contains a three folders: "project1" "project2" and "core".
When I change a files under "core" folder I want trigger "npm run test Project1" and "npm run test project2".
If I changed the "project1" files I want test only "project 1".
If I changed the "poject2" - I want test only "project2".
I don't want to separate this folders on separate repositories, or use git submodules and subthrees. And also I don't want to every time test everything.
I heard that in teamcity such task is called triggers.
Does the "bitbucket pipeline" support this a kind of feature?
Hi Andrey,
I can't think of an easy way to achieve exactly what you're after in Pipelines. However have you considered running the tests for each project in separate parallel steps?
https://confluence.atlassian.com/bitbucket/parallel-steps-946606807.html
This would allow your pipeline to complete faster than running all the tests in a single step.
Obviously there are also disadvantages to this approach (primarily that you will use more build minutes relative to running just one set of tests at a time).
Otherwise it may be possible to write a custom script to do what you want using git commands, depending on your workflow. For instance if your workflow involves always squashing your commits into a single commit before pushing then you could use git commands to work out which projects are affected by the last commit. For instance the following commands output the number 1 if the corresponding project is affected by the last commit and 0 otherwise:
git diff-tree --no-commit-id --name-only HEAD core | wc -l
git diff-tree --no-commit-id --name-only HEAD project1 | wc -l
git diff-tree --no-commit-id --name-only HEAD project2 | wc -l
Cheers,
Steven
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.