From aa86ac307f030d557535a95588004b8b5d5556fb Mon Sep 17 00:00:00 2001 From: gomezchavez Date: Tue, 21 Sep 2021 11:42:25 +0000 Subject: [PATCH 1/5] Improved OSM tools usability for developers --- 01-workflow-osm-tools.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/01-workflow-osm-tools.md b/01-workflow-osm-tools.md index 4cafcae..b992d3c 100644 --- a/01-workflow-osm-tools.md +++ b/01-workflow-osm-tools.md @@ -28,7 +28,7 @@ If you need any help, contact us at ## Contributing code -### Clone your project +### Clone your project (https) 1. Clone a git repository, for example: ```bash @@ -61,6 +61,24 @@ More information about the Gerrit commit-msg hook can be found [here](https://gi 3. Click on "List" menu. 4. Select a product to see the available cloning URLs. +### Clone your project (ssh) + +1. Authenticate your local host with Gerrit + + 1. Create a SSH public-private key pair locally. Git offers this tool for linux and windows users (via Git Bash) **ssh-keygen -o** but you need to ensure that the user.name and the user.email picked up by the terminal matches the settings from Gerrit (Check with **git config -l**). Accept all the default settings that the prompt will ask until it finishes. By the end you should see a **id_rsa** file (private key) and a **id_rsa.pub** file (public key) created under your host's **.ssh/** folder. + 2. Open the id_rsa.pub file with any text editor and copy its content. + 3. Login to Gerrit (ETSI account) and access the settings page https://osm.etsi.org/gerrit/#/settings/ + 4. Go to the **SSH Public Keys** tab and add the public key to the registered key lists + +2. Access Gerrit and find the repository that you need. In this example, the **Features** repo is found here https://osm.etsi.org/gerrit/#/admin/projects/osm/Features +3. Copy the clone command choosing **ssh** and **clone with commit-msg hook** option. +4. Paste the command in your Git Bash terminal within the folder in which you want the repository. + +```bash +git clone "ssh://$USERNAME@osm.etsi.org:29418/osm/Features" && (cd "Features" && curl https://osm.etsi.org/gerrit/tools/hooks/commit-msg > .git/hooks/commit-msg ; chmod +x .git/hooks/commit-msg) +``` +**Note**: Replace $USERNAME with your ETSI username. + ### Configure your Git environment 1. Configure your git username globally: @@ -254,6 +272,8 @@ Link: (you can navigate there 1. **Jenkins** builds, tests the new contribution, and reports the result on its web interface. 2. **Jenkins** votes on the contribution using **“Code-Verif”** (-1, +1) on **Gerrit**. +Jenkins is configured to relaunch the CI pipelines when a new patch is pushed to the review commit and by manually adding a comment with the keyword "retrigger" to the commit review UI. + ### Code Review 1. Other **contributors** and **MDG Committers** can comment the new contribution and vote using **“Code-Review”** (-1, 0, +1) on **Gerrit**. @@ -433,12 +453,13 @@ When amending code from a different author, reviewer and original author should This will download the change, put it in a branch called review/AUTHOR/change (if the change has no tag, the sequence number will be used instead), and switch to that branch. 3. After that, you can amend the downloaded change to improve it. Finally, push it again: ```bash - #$ git add # add the changes - #$ git commit --amend # do not touch the Change-Id. The Change-Id is the way for gerrit to keep track what belongs to what development stream as a new patch set. - #$ git commit --amend --author # if you want to mark the changes as yours. + #$ git add # add the changes + #$ git commit --amend # do not touch the Change-Id. The Change-Id is the way for gerrit to keep track what belongs to what development stream as a new patch set. + #$ git commit --amend --author="username \"** #The username and email must contain the exact names from your ETSI account (the <> notation around the email is compulsory) #$ git review -c -R # The -R is important, since it tells git-review to not rebase your change against master. ``` **NOTE**: Don't use the -m flag to specify a commit message, since it will override the previous message and regenerate the Change-Id. Instead, use the text editor to change the commit message if needed, and keep the Change-Id line intact. + **NOTE**: If the original author appears as uploader and assignee in gerrit you will need to request support to <> asking for permission to change the assigned user to the commit. Once confirmed, you should be able to amend the user from the commit and push. 4. Delete the branch once you have finished: ```bash $ git branch -D review/garciadeblas/1280 -- GitLab From d59b0ebb294d7a9e0660e44b2bf7fbc2b7c18778 Mon Sep 17 00:00:00 2001 From: gomezchavez Date: Tue, 21 Sep 2021 11:50:23 +0000 Subject: [PATCH 2/5] added gitlab-ci --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a5960a0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,17 @@ +stages: + - build + +build_documentation: + stage: build + image: python:3.7-slim + script: + - pip install -r requirements.txt + - make clean + - make html SPHINXOPTS="-W --keep-going -n" + - ./fix_cross_references.sh + # only: + # - master + # - merge_requests + artifacts: + paths: + - _build/html -- GitLab From 73577642a1635e25d5e1294c05b359489c9a4497 Mon Sep 17 00:00:00 2001 From: gomezchavez Date: Tue, 21 Sep 2021 11:53:54 +0000 Subject: [PATCH 3/5] build essentials to build documentation --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5960a0..e9524bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,12 @@ stages: build_documentation: stage: build image: python:3.7-slim + before_script: + - apt-get update + - apt-get install build-essential -y + - apt-get purge -y --auto-remove + - rm -rf /var/lib/apt/lists/* + - find /usr/local/lib/python3.7 -name "*.pyc" -type f -delete script: - pip install -r requirements.txt - make clean -- GitLab From 2066a60744ad037f7c7fbbd97e4959a39fbac882 Mon Sep 17 00:00:00 2001 From: gomezchavez Date: Tue, 21 Sep 2021 11:57:50 +0000 Subject: [PATCH 4/5] CI in documentation --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e9524bf..efe808a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,9 +15,9 @@ build_documentation: - make clean - make html SPHINXOPTS="-W --keep-going -n" - ./fix_cross_references.sh - # only: - # - master - # - merge_requests + only: + - master + - merge_requests artifacts: paths: - _build/html -- GitLab From 64cc2fdaa4dcce918c5683f1405824bd559ad81b Mon Sep 17 00:00:00 2001 From: gomezchavez Date: Tue, 21 Sep 2021 12:04:18 +0000 Subject: [PATCH 5/5] fixed email from osm support --- 01-workflow-osm-tools.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/01-workflow-osm-tools.md b/01-workflow-osm-tools.md index b992d3c..98ff648 100644 --- a/01-workflow-osm-tools.md +++ b/01-workflow-osm-tools.md @@ -455,11 +455,11 @@ When amending code from a different author, reviewer and original author should ```bash #$ git add # add the changes #$ git commit --amend # do not touch the Change-Id. The Change-Id is the way for gerrit to keep track what belongs to what development stream as a new patch set. - #$ git commit --amend --author="username \"** #The username and email must contain the exact names from your ETSI account (the <> notation around the email is compulsory) + #$ git commit --amend --author="username \"** # The username and email must contain the exact names from your ETSI account (the <> notation around the email is compulsory) #$ git review -c -R # The -R is important, since it tells git-review to not rebase your change against master. ``` **NOTE**: Don't use the -m flag to specify a commit message, since it will override the previous message and regenerate the Change-Id. Instead, use the text editor to change the commit message if needed, and keep the Change-Id line intact. - **NOTE**: If the original author appears as uploader and assignee in gerrit you will need to request support to <> asking for permission to change the assigned user to the commit. Once confirmed, you should be able to amend the user from the commit and push. + **NOTE**: If the original author appears as uploader and assignee in gerrit you will need to request support to **osmsupport@etsi.org** asking for permission to change the assigned user to the commit. Once confirmed, you should be able to amend the user from the commit and push. 4. Delete the branch once you have finished: ```bash $ git branch -D review/garciadeblas/1280 -- GitLab