I have many Microservices in Java.
The idea is to create just one pipeline(bitbucket-pipelines.yml) for all the same projects, and put what is common.
So, with that, we can change in just one file, instead of a change in every .yml.
For example in gitlab it's possible with include: file:
AFAIK Bitbucket Pipelines has no pre-processor that can import/include YAML partials before being executed.
YAML doesn't have either.
So no, not possible the way it's done in Gitlab on Bitbucket.
But that's perhaps looking at the wrong side of the problem.
Have you considered to use the same build container for this many micro services project?
It should have what is common, just the sane defaults.
You could also favor convention over configuration.
Hi, thanks for your answer.
I've got a base image for all these MS(microservices).
I tried Pipes but still are not good enough.
I tried a different approach right now.
Because the problem/difficulty was on CI not on the approach of the MS.
If it works well I'll come back here and answer.
Thanks a lot.
No concrete idea about your problem, if you need bootstrapping that is shared across multiple pipelines (like a one-size-fits-it-all approach) configured in a central repository:
Similar to the Gitlab includes is that it is an include, just thinly implemented for Atlassian Bitbucket Pipelines.
A downside is, that you need to implement this your own (not configurable within the bitbucket-pipelines.yml file directly but a bit more indirectly as instead on the level of yaml, it's an "include" command in the step script. The simpler this is, normally the better.
I somewhat tend to git sub-modules here despite they are a bit bulky and tend to appear to stand in the way. And specifically on Bitbucket they need some configuration work. Nevertheless look into them.
On the plus side you have more control and by using a git repository as sub-module a much more controlled environment compared to the Gitlab include feature (think security, versioning and configuration management).
Your mileage may vary, just idea/options outlines here.
What I normally do is having a script in the repository that is getting called in a step script line. This keeps the yaml file clean and gives more flexibility (change a process instead of the yaml file [overall build process]. In your scenario it could do the bootstrapping and then execute a shared payload across multiple repositories).
The dirtiest resolution would be to download a script and execute it directly. Take care with such an approach, it has severe implications. Same applies to the Gitlab approach IMHO, I'm not sure that it is actually not flawed as it circumvents many of the pre-cautions that are to be considered.
Only it works often doesn't mean it's done. Take care and looking forward to your feedback and comments.
...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events