I am trying to set up the Consumer Driven Contracts workflow while storing stubs in Git.
I think it works best if branch name in the pull request of the contracts repo matches exactly the branch name in the consumer/producer pull request. So, I can just use the current branch name (inside consumer/producer repository) as the branch needed in the contracts repository. That works great, but when consumer/producer wants to develop something not related to API changes, then their CI will fail because of this:
Execution default of goal org.springframework.cloud:spring-cloud-contract-maven-plugin:2.1.2.RELEASE:generateTests failed: org.eclipse.jgit.api.errors.RefNotFoundException: Ref feature/BUG-123_null_pointer cannot be resolved
It would be very nice if in that case Spring Cloud Contract could just print a warning and use "master" instead of failing the build.
Can you describe your producer / consumer / external repo setup cause I don't understand your flow yet.
In contracts Git repo:
new_endpoint and push new_endpoint.yml and new_endpoint_stub.json (contracts and mappings directories).In producer Git repo:
new_endpoint and run the spring-cloud-contract-maven-plugin:generateTests maven goal with contractsProperties.git.branch = new_endpoint (with maven configuration).feature/BUG-123_null_pointer and run the spring-cloud-contract-maven-plugin:generateTests maven goal with contractsProperties.git.branch = feature/BUG-123_null_pointer (with maven configuration).I would like in step 3 to just fallback to master branch.
P.S. I am using git-commit-id-plugin to get the git.branch property, which I can then feed into the contract plugin.
As a workaround, I am now specifying the branch manually. Hopefully, I don't forget to set it back to master when the endpoint is done
I want to try to work on this! gracehopperOSD 👩💻
Most helpful comment
I want to try to work on this! gracehopperOSD 👩💻