I'm not sure if I can provide enough information over here in my first question, but I gonna try:
At my company we use Stash. My project is a multi-repository project (Client, Server, Common). We use Gitflow as branching model. The modules itself are all in Java, build via Ant and ivy is used for dependency management. So far, we use our Jenkins instances "only" to run our tests and perform static code analysis, as our build process requires the builds to be performed in a dedicated environment. Therefore we have a Jenkins instance setup to build from develop. The common project is a shared dependency between the server and client project. Our Jenkins projects are therefore setup with a downstream Dependency between common → {server, client}. The common project contains an after-build task to publish the build common project at our company internal artifactory (JFrogg). This will then be used during the execution of the client and server jenkins projects (ivy).
OK, I hope this gives a good overview. Now my actual question:
We are currently playing around with the Stash Pull request plug in for jenkins to run builds for our feature branches when we generated a pull request for them. However, due to our setup of dependencies I want to achieve the following:
1) if we have a feature branch for the same ticket (Jira ticket number is used in branch) in Common and (Client or Server) - build common first - publish common at artifactory with jira ticket number attached - build downstream pull request with correct dependency (use the just published build on artifactory with specific branch)
2) if we have a feature branch only in the common project - build common - publish common at artifactory with jira ticket number attached - build downstream Develop branch with above dependency (use the just published build on artifactory with specific branch)
3) If we have a feature branch only in the downstream projects: - build feature branch on server / client using the published common project from artifactory.
With the default setup (which already works) we actually do the last option for all builds right now which results in problems as soon as we introduce new features in the common project that are used by the client or Server projects, as the builds for the feature branches will always fail until we merged the feature branch in common and the build executed once.
So I thought of a solution like this:
- on common build, publish the build at artifactory with the branch information attached to it.
- on common build, trigger client and server builds as downstream dependencies
- in downstream projects try to use the Dependency for common from the same feature branch, if this is not available, fallback to develop version.
Does anyone know a solution to this kind of issues or could point me into a direction how to approach this problem?
Many thanks for your help and sorry for the long text.
Best,
Sebastian