diego-release icon indicating copy to clipboard operation
diego-release copied to clipboard

Convert components to a go module

Open winkingturtle-vmw opened this issue 2 months ago • 5 comments

Proposed Change

As a developer I would like the ability to build diego-release's components (e.g. bbs) as a standalone module So that when I run go install code.cloudfoundry.org/bbs/cmd/bbs@latest and it will install the latest version of the binary

diego-release components were built at a time before go modules existence. It was built with the assumption of GOPATH. As a result, most modules import each other, creating a circular dependencies where bbs needs to import locket and lcoket needs to import bbs. This is because it was easier to use helper libraries that each repo created originally. In order to be able to do this work we need to do the following to break out the circular import and allow each of those modules to be independent.

Here are the list of components that will have to be converted

auction
auctioneer
bbs
buildpackapplifecycle
cacheddownloader
cfdot
diego-ssh
dockerapplifecycle
ecrhelper
executor
fileserver
healthcheck
inigo
localdriver
locket
operationq
rep
route-emitter
volman
vizzini
workpool
  • For each of the repo above, we need to figure where it's being imported (e.g. bbs). Some of these imports are happening silently in releases that are not showing up in pkg.go.dev.
  • We then need to figure out why these internal repos are importing diego's repositories. In the case of bbs, most of the consumers are just looking for models or sqlhelpers. In this case, we would extract out the logic into it's own independent repository and update downstream consumers.
  • For a given repo, we then need to break out circular imports. In the case of bbs, it's importing locket, auctioneer, ecrhelper, executor, inigo, and workpool. Here is a branch for bbs and a branch for locket that removed the circular dependency between the two of them.
  • After we finish migrating each component, we then need to change the diego-release to import these modules via it's main go-module instead of submodules.

Acceptance criteria

diego-release will no longer have any submodules and I can deploy diego-release with cf-deployment, so that I cf push and run all acceptance tests.

Related links

  • Similar Discussion https://github.com/cloudfoundry/bbs/pull/97
  • Related work previously https://github.com/cloudfoundry/bbs/tree/with-go-mod

winkingturtle-vmw avatar May 30 '24 13:05 winkingturtle-vmw