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

fix: refetching lightweight tags from origin #349

Closed miki725 closed 2 weeks ago

miki725 commented 2 weeks ago

Issue

fixes https://github.com/crashappsec/chalk/issues/345

Description

If repo is checked out incorrectly locally, a tag can be lightweight but annotated in origin. To guarantee chalk sees up-to-date tags, chalk refetches lightweight tags to ensure it reports correct metadata about the "latest" tag.

This was noticed via checkout github action which if triggered from a tag build it looses any tag annotations.

Testing

➜ make tests args="test_git.py::test_refetch_tag --logs --pdb"
miki725 commented 2 weeks ago

so far annotated tags have a preference over lightweight tags as they have a concrete ordering without doing any tag name comparisons as tag formats are wildly different with semver, dates, etc so nothing concrete to sort by. if there are no annotated tags then it falls back to regular tags

miki725 commented 2 weeks ago

for reference:

https://github.com/crashappsec/chalk/blob/cd68f2d71553ad97994706d68e9909fd3747a3b2/src/plugins/vctlGit.nim#L588-L588