5

I have three Scala packages being built as separate sbt projects in separate repos with a dependency graph like this:

  M---->D
  ^     ^
  |     |
  +--+--+
     ^
     |
     S

S is a service. M is a set of message classes shared between S and another service. D is a DAL used by S and the other service, and some of its model appears in the shared messages.

If I make a breaking change to all three, and push them up to my Git repo, a build of S will be kicked off in Jenkins. The build will only be successful if, when S is pushed, M and D have already been pushed. Otherwise, Jenkins will find it doesn't have the right dependent package versions available. Even pushing them simultaneously wouldn't be enough -- the dependencies would have to be built and published before the dependent job was even started. Making the jobs dependent in Jenkins isn't enough, because that would just cause the previous version to be built, resulting in an artifact that doesn't have the needed version.

Is there a way to set things up so that I don't have to remember to push things in the right order?

The only way I can see it working is if there was a way that a build could go into a pending state if its dependencies weren't available yet.

I feel like there's a simple solution I'm missing. Surely people deal with this a lot?

  • 1
    The scenario is certainly familiar, but I don't think you will like our solution: expect and tolerate some broken builds. If the build for S is configured to periodically recheck for dependencies and retry on failure, then eventually things come out in the wash. – Ernest Friedman-Hill Aug 8 '14 at 11:24
1

You could also take a look at this Jenkins plugin: https://wiki.jenkins-ci.org/display/JENKINS/Build+Blocker+Plugin.

I would recommend re-architecting your app. As a general approach and good practice, I would recommend versioning your projects/components. Each component will depend on a specific version of the other component. In this way you have full control on which dependency is being considered for the current build.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.