crashappsec / chalk

Chalk allows you to follow code from development, through builds and into production.
https://crashoverride.com/
GNU General Public License v3.0
322 stars 11 forks source link

refactor: docker inspection refactor #266

Closed miki725 closed 1 month ago

miki725 commented 2 months ago

Issue

This is prep work for adding provenance support

https://github.com/crashappsec/chalk/issues/180

Description

Provenance will require inspecting image from the registry manifest. This PR split out docker functionality into various independent pieces among which is the manifest handling refactor. We now parse the manifest json and return appropriate nim data-structures for easy handling of the manifest lists/images/configs/layers. This will allow us to easily interact with the registry to collect metadata from the registry, same as we do for local docker image inspect ....

In addition all the inspection logic was in multiple files across docker_base/codecDocker, etc which was very hard to follow so all of the inspection logic was moved to independent files under docker/. important files:

Testing

make tests args="test_docker.py --logs"

Next Steps

Next PR all the build logic can be redone to support provinance which will remove all the magic docker build command flag handling.

ee7 commented 1 month ago

And nit for merging: our PR template has:

and that specifies:

The refactor type is used to identify development changes related to modifying the codebase, which neither adds a feature nor fixes a bug - such as removing redundant code, simplifying the code, renaming variables, etc.

where the types of changes are categorized as:

  • Development - sort of maintenance types which classify changes, intended the developers, that don’t actually affect the production code but rather the development environment and workflow internally
  • Production - sort of enhancement types which classify changes, intended the end users, that solely affect the production code

but this PR does technically make user-facing changes (fixing a bug, and adding/removing keys). I don't know what our convention for commit message prefixes, but we might want to either:

Whatever. Just to point it out, in case the merged commit prefix is supposed to have some significance.