divnix / std

A DevOps framework for the SDLC with the power of Nix and Flakes. Good for keeping deadlines!
https://std.divnix.com
391 stars 43 forks source link

feat(kubectl): publish diff if on github ci as PR comment #343

Closed blaggacao closed 1 year ago

blaggacao commented 1 year ago

Context

For a change to remote state, a reviewer may do a process audit or a result audit.

A process audit requires the entire context of the rendering routine loaded in every detail as a prerequisite of the audit.

A result audit, in turn, requires only context of the data description language and the api being mutated.

Therefore, a result audit is more ergonomic in many instances, and thus, more effective and reliable.

Proposed solution

This PR implements the feature of posting a comment with the expected kubectl diff to the PR, if the required environment variables are being set (see code) for example in GitHub actions and if gh binary is detected in the environment.

Note: similar solutions may be adopted for other Block Types in addition to kubectl in the future.