Difference between revisions of "MISC-TN-028: GitLab-based workflow"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{InfoBoxTop}} Category:MISC-AN-TN Category:MISC-TN {{InfoBoxBottom}} __FORCETOC__ == History == {| class="wikitable" border="1" !Version !Date !Notes |- |1.0.0 |Augu...")
 
Line 19: Line 19:
 
DAVE Embedded Systems uses GitLab as primary source code management platform. This Technical Note describes the typical GitLab-based workflow we use and that our partners are strongly encouraged to adopt as well.
 
DAVE Embedded Systems uses GitLab as primary source code management platform. This Technical Note describes the typical GitLab-based workflow we use and that our partners are strongly encouraged to adopt as well.
  
==
+
==Essential steps of the workflow==
 +
We will show the steps the workflow is composed of by using a very simple example. To this end, we created an ad hoc empty repository, named <code>test0</code>. The goal is to write the first release of the code by following the recommended workflow.
 +
 
 +
Once the repository is created, we create an issue. Every implementation should start with this step: first of all, create an issue!
 +
 
 +
In this case, we call the issue "First release" as shown by the following picture:
 +
 
 +
Then, we create a merge request associated with the issue. We instruct GitLab to automatically create a branch associated with this issue as well. Please note that the merge options are so that the branch will be deleted when the merge request is accepted. This usually makes sense because we don't need to keep the branch we the job is done. If you are asking, don't worry: although the branch will be deleted, commits will not be lost. Therefore, the history of changes will be preserved.
 +
 
 +
On GitLab side everything is in place, so we can work on our local host to write our code. For the sake of simplicity, we will just edit one file, README.md.
 +
 
 +
$ git clone git@gitlab.com:DAVEEmbeddedSystems/test/test0.git
 +
Cloning into 'test0'...
 +
remote: Enumerating objects: 3, done.
 +
remote: Counting objects: 100% (3/3), done.
 +
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
 +
Receiving objects: 100% (3/3), done.
 +
$ cd test0/
 +
/test0$ git branch -a
 +
* master
 +
  remotes/origin/1-first-release
 +
  remotes/origin/HEAD -> origin/master
 +
  remotes/origin/master
 +
/test0$ git checkout 1-first-release
 +
Branch '1-first-release' set up to track remote branch '1-first-release' from 'origin'.
 +
Switched to a new branch '1-first-release'
 +
/test0$ ll
 +
total 12
 +
drwxrwxr-x 3 llandre llandre 4096 ago 16 22:06 ./
 +
drwxrwxr-x 3 llandre llandre 4096 ago 16 22:06 ../
 +
drwxrwxr-x 8 llandre llandre 4096 ago 16 22:07 .git/
 +
-rw-rw-r-- 1 llandre llandre    0 ago 16 22:06 README.md
 +
/test0$ git diff
 +
diff --git a/README.md b/README.md
 +
index e69de29..901353b 100644
 +
--- a/README.md
 +
+++ b/README.md
 +
@@ -0,0 +1 @@
 +
+This is the first release.
 +
/test0$ git add README.md
 +
/test0$ git commit -m "Change README.md"
 +
[1-first-release ce31afa] Change README.md
 +
1 file changed, 1 insertion(+)
 +
/test0$ git push
 +
Enumerating objects: 5, done.
 +
Counting objects: 100% (5/5), done.
 +
Writing objects: 100% (3/3), 277 bytes | 277.00 KiB/s, done.
 +
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
 +
remote:
 +
remote: View merge request for 1-first-release:
 +
remote:  https://gitlab.com/DAVEEmbeddedSystems/test/test0/-/merge_requests/1
 +
remote:
 +
To gitlab.com:DAVEEmbeddedSystems/test/test0.git
 +
  e382410..ce31afa  1-first-release -> 1-first-release

Revision as of 20:25, 16 August 2023

Info Box


History[edit | edit source]

Version Date Notes
1.0.0 August 2023 First public release

Introduction[edit | edit source]

DAVE Embedded Systems uses GitLab as primary source code management platform. This Technical Note describes the typical GitLab-based workflow we use and that our partners are strongly encouraged to adopt as well.

Essential steps of the workflow[edit | edit source]

We will show the steps the workflow is composed of by using a very simple example. To this end, we created an ad hoc empty repository, named test0. The goal is to write the first release of the code by following the recommended workflow.

Once the repository is created, we create an issue. Every implementation should start with this step: first of all, create an issue!

In this case, we call the issue "First release" as shown by the following picture:

Then, we create a merge request associated with the issue. We instruct GitLab to automatically create a branch associated with this issue as well. Please note that the merge options are so that the branch will be deleted when the merge request is accepted. This usually makes sense because we don't need to keep the branch we the job is done. If you are asking, don't worry: although the branch will be deleted, commits will not be lost. Therefore, the history of changes will be preserved.

On GitLab side everything is in place, so we can work on our local host to write our code. For the sake of simplicity, we will just edit one file, README.md.

$ git clone git@gitlab.com:DAVEEmbeddedSystems/test/test0.git Cloning into 'test0'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (3/3), done. $ cd test0/ /test0$ git branch -a

  • master
 remotes/origin/1-first-release
 remotes/origin/HEAD -> origin/master
 remotes/origin/master

/test0$ git checkout 1-first-release Branch '1-first-release' set up to track remote branch '1-first-release' from 'origin'. Switched to a new branch '1-first-release' /test0$ ll total 12 drwxrwxr-x 3 llandre llandre 4096 ago 16 22:06 ./ drwxrwxr-x 3 llandre llandre 4096 ago 16 22:06 ../ drwxrwxr-x 8 llandre llandre 4096 ago 16 22:07 .git/ -rw-rw-r-- 1 llandre llandre 0 ago 16 22:06 README.md /test0$ git diff diff --git a/README.md b/README.md index e69de29..901353b 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +This is the first release. /test0$ git add README.md /test0$ git commit -m "Change README.md" [1-first-release ce31afa] Change README.md

1 file changed, 1 insertion(+)

/test0$ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 277 bytes | 277.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: View merge request for 1-first-release: remote: https://gitlab.com/DAVEEmbeddedSystems/test/test0/-/merge_requests/1 remote: To gitlab.com:DAVEEmbeddedSystems/test/test0.git

  e382410..ce31afa  1-first-release -> 1-first-release