author-meta | date-meta | pagetitle | url-gh | url-gino-keva | url-demo | url-talk | major-minor-patch | build-metadata | arrow-both | arrow-left | arrow-right | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 30, 2021 |
How (not) to store build metadata in Git |
<span style="color:MediumSeaGreen">MAJOR.MINOR.PATCH</span> |
<span style="color:DodgerBlue">BUILD METADATA</span> |
<span style="color:Orange;font-size:125%">⇄</span> |
<span style="color:Orange;font-size:125%">⇇</span> |
<span style="color:Orange;font-size:125%">⇉</span> |
DevOpsCon Munich Online
:::: {.element: class="fragment" data-fragment-index="1"}
Build metadata is fancy for build ID.
::::
:::: {.element: class="fragment" data-fragment-index="2"}
It identies a build and the artifacts it generates.
::::
::: notes
Artifacts could be:
- Container
- Package
:::
::: notes
- How to store
- How to use build metadata to create a component-based CI/CD pipeline
- Components are built independent, each with their own artifact
- Only rebuild what has changed
:::
{width=20%}
<$url-gh$>
Senior Devops Engineer
{width=50px}
- Uses fancy words
- Is opinionated
- Includes a live demo
::: notes
- Uses fancy words to make up for my lack of confidence
- State my opinion as facts. I believe it will trigger more reaction/thinking
:::
- Git
- Containers
- Build pipelines
- (my) Humour
::: {.container}
:::: {.col .element: class="fragment" data-fragment-index="1"}
- Describes public API
- Incremented manually
- Relatively static ::::
:::: {.col .element: class="fragment" data-fragment-index="2"}
- Links artifacts to commits
- Determined by the system
- Changes all the time :::: :::
:::: {.element: class="fragment" data-fragment-index="3"}
Semantic Versioning 2.0.0 - https://semver.org
::::
::: notes
Versioning of Artifacts:
Major.minor.patch:
-
External
-
Stored in
- versionInfo.json (old school)
- Git tag
Build metadata:
- Internal
- Where and how to store?
:::
commit
::: notes
Two reasons; we're going to look at arrows in both directions
:::
- commit
$arrow-left$ artifacts- 💤 Boring 💤
::: notes Traceability means you can always find the version of code for any artifact/release/installer/installation. In open source, this concept is not that important anymore since distribution of build output is just for convenience :::
- commit
$arrow-right$ artifacts- Only build what changed
- 🎈 Fun! 🎈
::: notes
Historically, not all that exciting. Every change requires a build anyway. It's fun, especially with multiple parts as will see
:::
:::: {.element: class="fragment" data-fragment-index="1"} New feature, build 46 ::::
:::: {.element: class="fragment" data-fragment-index="2"}
::::
::: notes
Determine changes:
- Identifies what has changed
Build:
- Each component has an independent build, which can run in parallel
- Also run tests for each component
- Output is a docker container
Release:
- Collect all containers
- Release them
:::
- Where to store it
- How to manipulate it
- In Git
- ...but not in commits
- Git tags?
- Git notes!
::: notes
- Using versionInfo.json here is a very silly idea
- Since one end of the link is a git commit, storing in git makes a lot of sense
- A commit would be horrible; it pollutes the history and doesn't even work
- Tags have 2 drawbacks: Explosion of tags and doesn't support concurrent use
- Git notes are perfect!
:::
Supplement a commit message without changing the commit itself
git notes add|remove|show|list
- Stored as commits in refs/notes/
Gino Keva - A simple Git Notes Key Value store <$url-gino-keva$>
- Store key/values in a note
- List key/values for a commit
::: notes
- Implemented using event sourcing pattern
- Create materialized view with all events
:::