sapcc / go-api-declarations

Reusable declarations for Go types appearing in our APIs
Apache License 2.0
3 stars 0 forks source link

import CADF types from Hermes #3

Closed majewsky closed 2 years ago

majewsky commented 2 years ago

In sapcc/hermes#56, we considered Talal's proposal to restructure the github.com/sapcc/hermes/pkg/cadf package to reduce the amount of dependencies that applications inherit transitively from Hermes. Since then, another problem with the current package layout has surfaced: We are now using Renovate Bot everywhere, so every change in Hermes will trigger several Renovate PRs to bump the Hermes dependency over in our services, even though those updates will usually not actually change any inherited code. We also had the same problem in Limes, and our way to solve it is this repo. As it says in the README over here,

This Go module contains reusable declarations for types appearing in our APIs. This repository is designed to have as little dependencies as possible and contain as little application logic as possible. Also, by using versioned tags, we avoid excessive auto-updates for this dependency in downstream repositories. (This is in contrast to most of our Go repositories, which usually use continuous delivery and do not tag releases.)

I have already moved all the type declarations for Limes into this repo and adjusted all other repos to import them from here instead (including Limes).

In this PR, I'm importing all the parts of github.com/sapcc/hermes/pkg/cadf that do not have dependencies on other modules. With these types declared over here, we will be able to remove the dependency on github.com/sapcc/hermes from applications and libraries consuming the Hermes API (i.e. Castellum, Limes, Keppel, as well as go-bits/audittools). Hermes would then also consume the type declarations from here via dependency.

@notque I'm specifically looking for approval from you since this affects the code architecture of Hermes.

If you want to merge this directly to adjust the Hermes side, feel free to do so. But note that this repository has tags, so you will have to create a new tag (e.g. with git tag v1.1.0 && git push --tags) in order to consume it downstream.

majewsky commented 2 years ago

Thanks for the pointer @talal. I've adjusted this PR to have type Action and type Outcome as enums.

majewsky commented 2 years ago

Nathan gave a 👍 via Slack DM. He will not have time to make the requisite adjustments right away in Hermes, but we will move ahead with the adjustments on our side to reduce the Renovate noise.