Get default repository from BuildContext

I’m using CustomBuildProcessor to run some tasks pre/post Build. I have a need to identify the project key of the repo that is being used by the build. So we use Linked Repositories through our Bitbucket Server almost exclusively so its only GIT.

Its looks like somethings have changed from some google search examples i have found and the methods off BuildContext (com.atlassian.bamboo.v2.build) I can get to getBuildDefinition()
which only gives we a way to getRepositoryIdDefiningWorkingDir(). I would assume i could use the returned Long to ‘lookup’ the associated repo, but i can’t seem to see the service for that either…

The buildProcessor actually spawns off a process on the agent (bash script) which i need it to be aware of the project key (from bitbucket)… I know bamboo sets some environment variables, but i though it might be easier to parse the URL in java than in bash knowing that bash doesn’t for sure what environment (test or production) instance of bamboo i’m calling it from…

Any suggestions?