Strategy Object hosts a dedicated space on GitLab for joint private projects with client countries: https://gitlab.com/strategyobject/countries.
GitLab is a web-based service for hosting software projects and supporting a secure and collaborative work on them. Based on Git, it offers distributed version control and source code management.
GitLab accounts of the developers involved have to be added with access to that project for submitting, reviewing and approving changes.
It is essential that all the changes to that project are submitted via merge requests and approved by all member developers.
Your GitLab project will be set up in the following way:
Your modules will be uploaded in a private project space provided by Strategy Object and hosted on GitLab.
A team of developers to access and work on that project will be created.
The project will have two main branches:
master - holds the current production version;
devel - accepts new features and bug fixes via merge requests.
The project will be created as Protected so all the changes would have to be submitted explicitly through merge requests.
There are several ways to connect to and interact with GitLab repositories.
The sections below cover the most common account settings in GitLab.
In order to be able to work with GitLab it is recommended to connect to GitLab using SSH keys.
Follow the steps below to add your SSH key.
Go to your account settings in GitLab by pressing the icon of your user account (in the top right corner) and selecting the Preferences option from the drop-down menu, that will appear:
Then on the menu in the left side of the browser, select the SSH Keys option:
A page with a form to add SSH keys will appear. Enter the public key’s value in the Key field and press the blue Add key button.
For interaction with registries you might also need an access token. Follow the steps below to generate one.
Go to your account settings in GitLab by pressing the icon of your user account (in the top right corner) and selecting the Preferences option from the drop-down menu, that will appear:
Then on the menu, in the left side of the browser, select the Access Tokens option:
A page with a form for generating access tokens will appear. Give this token a name that will provide a hint for its purpose; fill it in the Token name field. Check the last two options in the Select scope list to have read and write access to the repository. Then click the blue Create personal access token button.
Each time someone wants to make any changes to the devel branch, they will have to first clone/pull changes from the devel branch and then make a checkout into a new branch, naming it following this convention:
If a new feature is being added: feature/changes-made;
If a bug is being fixed: bugfix/what-was-fixed.
Then, upon submitting the branch with the changes, the developer will get a web link. They have to open this link in a web-browser in order to access the GitLab’s web interface to create a merge request and add reviewers and approvers.
Afterwards the developers added as reviewers and approvers will review the submitted changes and the code. They will either make comments and remarks for improvement or approve the merge of the branch with the changes to the devel branch. After approval the developer should merge their branch with changes. This action can also be performed using the GitLab’s web interface.
- via HTTPS using username and password for your GitLab account:
All changes are first made to the devel branch. They are made using so called merge requests (MR), and not via a direct push to the devel branch.
To create a merge request, first you have to create a branch from the devel branch. Give it a name that describes the changes that you are going to make and submit to the project.
After you make the necessary changes, you can submit them in your branch and create a merge request for them to be reviewed, approved and merged with the devel branch.
Follow the steps below to create a merge request in GitLab using terminal commands. You can also get acquainted with the Git options and tools provided by the IDE that you are using for development.
https://gitlab.com/strategyobject/countries/country/merge_requests/new?merge_request%5Bdevel%5D=my-changes-branch
. Copy and open that link a Web browser and add viewers and approvers using the GitLab's web interface. After receiving approval of the changes, you have to merge the request with the devel branch.Merge requests to the master branch are also possible, though not common, upon the need of the so called hot fixes to a recently released version.
Tags give you the option to mark specific points in project’s timeline as important.
In GitLab you can use both lightweight and annotated tags.
Lightweight tags are used for marking milestones of the project development. The example below will add a lightweight tag to the last commit made to the project:
Releases in GitLab are kind of snapshots of significant stable states of your project. Use semantic versioning in tags to prepare the project for a release.
When a project reaches a stable state in the devel branch, a release branch is created out of it, which is then tagged with the semantic version number and merged with the master branch.
It is also recommended to include release notes to the new version describing all the changes made. You can write those in the tag’s annotation message.