Skip to content

Commit 1fff8f7

Browse files
authored
Merge pull request #3 from Praqma/fix/lint-md
Linted markdown
2 parents 21a32ce + 33dd60c commit 1fff8f7

File tree

1 file changed

+42
-19
lines changed

1 file changed

+42
-19
lines changed

README.md

+42-19
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
11
# git-artifact
22

33
## The rational for storing artifacts in git
4+
45
I have, over the years in the embbeded enterprise industry, constantly come across many scenarios where zipping, downloading and unzipping generic dependencies and maintaining workspace
56
has slowed down turn around time for developers and CI system. Git is a fantastic zipper it self and you get integrity of workspaces for free.
67

7-
Git has always been mentioned to be bad for storing artifacts due to the block chain technology and distrubuted architecture. `git-artifact` make sure this problem is handled by storing commits "horisontally" using tags rather than the default "stacked" way. It gives a few advantages compared to standard usage of git:
8+
Git has always been mentioned to be bad for storing artifacts due to the block chain technology and distrubuted architecture. `git-artifact` makes sure this problem is handled by storing commits "horisontally" using tags rather than the default "stacked" way. It gives a few advantages compared to standard usage of git:
89
- Firstly; You can garbage collect intermidiate artifacts by just deleting the tag
910
- Secondly; You only fetch what you need - even without using shallow.
1011

1112
### CI/CD integration
13+
1214
Triggering of new builds or tests are done the normal way as known from triggering your pipelines of source code - push or pull - simple..
1315

1416
### Save money
17+
1518
You can save additional license and maintainance cost and/or coqnative load by maintaining and using an additional system for artifacts. You can handle it with your current git repository manager.
1619

1720
### Producer of artifacts
18-
A few remarks, aspects and thoughts when storing the artifacts
21+
22+
A few remarks, aspects and thoughts when storing the artifacts
23+
1924
- easy to append artifacts as stages evolves with more artifacts
2025
- no need to zip before upload - just commit as the artifact should be used.
2126
- easy to add information, environment, tools and git source sha1 in the artifact for traceability and later reproduction
2227
- add the source code as a dependency to the artifact. It will then be easy restore the source for diff and debugging
2328

2429
### Consumer of the artifacts
25-
A few remarks, aspects and thoughts when retrieving the artifacts
30+
31+
A few remarks, aspects and thoughts when retrieving the artifacts
32+
2633
- The consumer do not need anything than standard git
2734
- Pipelines just consumes the artifact unzip and ready to use as they were produced
2835
- Use your favorit git dependency system like submodules(this is the correct way for submodule usage btw ), repo tool or ..
2936
- Even a consumer can be a producer by adding further artifacts on top the consumed commit with a new commit and tag
3037
- git understand the content in workspace and git clean does not remove artifacts in contrast to downloaded artifacts
3138

3239
## How is it done
40+
3341
Git normally stacks the history hence you cannot delete commit in the middle of the history. `git-artifact` make a "horizontal" history - i.e the commits are not stacked on top of each other, but next to each other.
3442

35-
The history is basically like this
43+
The history is basically like this:
3644

3745
``` mermaid
3846
%%{init: {
@@ -66,96 +74,111 @@ gitGraph:
6674
commit id: "2.0/test" tag: "2.0/test"
6775
```
6876

77+
### Prerequisites
6978

70-
`git-artifact` has all the functions available that make the above history natural workflow.
71-
72-
### Prerequisites
7379
The tool uses tags hence the producer need to tag push-rights. It is also beneficial to have tag delete-rights to clean old artifacts.
7480

7581
It can also run in branch mode. It can maintain a `latest` branch which needs to be force pushed or delete + push rights. The concept is similar to docker concept of `<image>/latest`. It is only important if you want to use tracking branches without using `git-artifact`. It could be in context of `submodules` or `repo manifests`.
7682

7783
### Installation
84+
7885
Download or clone this repo (`git-artifact`) and add make it available in the PATH. Given that `git-artifact` is in the PATH, then `git` can use it as an command like `git artifact`. It is now integrated with git and git is extended.
7986

8087
## Getting started
88+
8189
First you need to create a repository in your git repository manager. You can either choose to initialize the repo, but `git artifact` also have command to do that and it states that this repository is "special" repository containing git artifacts.
8290

8391
### Initialize the repository
92+
8493
Let us now initialized a repo:
85-
```
94+
95+
```bash
8696
git artifact init --url=<remote_url> --path my-git-artifact-path
8797
```
8898

8999
### Add the artifact
100+
90101
The repository and path initialize above ready to use. Copy the artifacts to your path in the folder structure the "constumer" desire it. There is not reason to tar or zip it. Git will handling this for optimized storage and easiness.
91102

92-
```
103+
```bash
93104
cd my-git-artifact-path
94105
cp -rf <build-dir>/my.lib /include .
95106
git artifact add-n-push -t v1.0
96107
```
108+
97109
The artifact v1.0 is now commited, pushed _and_ importantly - the workspace is set back to the default branch of the remote repository. It is now ready to make a new artifact based on the default branched
98110

99111
## Finding and getting artifacts
112+
100113
Firstly clone the git artifact repository. Note that you only clone and get the default branch
101-
```
114+
115+
```bash
102116
git artifact clone --url=<remote> --path my-git-artifact-path
103117
cd my-git-artifact-path
104118
````
105119

106120
### Find the latest using pattern
107-
```
121+
122+
```bash
108123
git artifact find-latest -r 'v*.*'
109124
```
125+
110126
### Download and checkout the latest
111-
```
127+
128+
```bash
112129
git artifact fetch-co-latest --regex 'v*.*'
113130
```
114131

115132
## Appending to an artifact
133+
116134
You can append to an artifact with advantage. Let say you create a library and you run a lot of tests in a later stage and the result is a test report. You can then just add that on top of the library tag.
117135

118136
- Download and checkout the artifact ( see above )
119137
- Add a new artifact ( see above )
120138

121139
You should of course consider this in your naming convension. Consider something like this:
122-
```
140+
141+
```bash
123142
vX.Y.Z/release-note
124143
vX.Y.Z/test
125144
vX.Y.Z/src
126145
vX.Y.Z/lib
127146
```
128147

129148
### Add the source code that was used to build the artifact
149+
130150
The source code in many companies and open-source projects are free to view, debug and edit. You can make it easy accessable by adding the source code as submodule and sha1 in to the artifact history. It sounds odd, but it gives the developers easy access to checkout the correct version that was used to build artifact.
131151

132152
This way it actually possible to create a full block-chain of everything that was involved in producing a product.
133153

134154
## Add information to the annotated tag
155+
135156
TODO: option for file or string
136157

137158
## Pruning / cleaning artifacts
138-
TODO: based on count..
139-
140159

160+
TODO: based on count..
141161

142162
## Advanced
143163

144164
### LFS
145-
`git artifact` work great out of the box without any extensions like LFS. It can though still be interesting to commit an `git-lfs` configuration to the default branch.
146-
- Artifact sets that can many common binary/large files from version to version will then be able to detect that it already have have this file in the LFS storage and do not have to fetch/push it again.
165+
166+
`git artifact` work great out of the box without any extensions like LFS. It can though still be interesting to commit an `git-lfs` configuration to the default branch
167+
168+
- Artifact sets that can many common binary/large files from version to version will then be able to detect that it already have have this file in the LFS storage and do not have to fetch/push it again.
147169
- You can download all tags without checkout and then you can search for meta-data in the annotated tags without suffering large data transfer and storage in order to clean.
148170

149171
### Promotions
172+
150173
There are genrally default two ways to you can do promotions.
151174
Building new artifacts for the release is like a new artifact using the above patterns, which can either be a new or appended artifacts.
152175

153176
Promotion decision should also be seen in connection related to pruning of tag which is not valid of any interest anymore. It should be simple and easy to prune without fear of deleting tags that should not be deleted
154177

155178
#### Using different repository
179+
156180
This way is like promotion in normal artifact managemnet systems, where you promote to from one project/repository to another. You basically download the tag from the original repository and then push the tag to promotion reposity. This way you can control access and keep different URL's for candidates and releases.
157181
158182
#### Using same repository
159-
This way requires you to create a tag using a release tag pattern. The tag can either be a new unrelated tag or it can be append on top if a release candidate tag.
160-
161183
184+
This way requires you to create a tag using a release tag pattern. The tag can either be a new unrelated tag or it can be append on top if a release candidate tag.

0 commit comments

Comments
 (0)