- Run GitLab QA Against Your Development Environment
- Use Customers Portal Staging in GitLab
- OpenShift GitLab Development Setup
Setting up your development environment
Development of Omnibus GitLab maybe done using an existing package available from Downloads page. To know how to setup a build environment to build these packages and use them, please read Setting up a Build Environment
-
Set up a container
To provide isolation and to prevent rebuilding of the package for each and every change, it is preferred to use a Container for development. The following example uses Docker on a Debian host with a Debian 10 (Buster) image. The steps are similar for other OSs; only the commands differ.
-
Install Docker for your OS as per official Docker installation docs.
-
Pulling a Debian Buster image
docker pull debian:buster
-
Running Docker image with a shell prompt
docker run -it debian:buster bash
This will cause the Docker to run the buster image and you will fall into a bash prompt, where the following steps are applied to.
-
-
Install basic necessary tools
Basic tools used for developing Omnibus GitLab may be installed using the following command
sudo apt-get install git
-
Getting GitLab CE nightly package and installing it
Get the latest GitLab CE nightly package (of the OS you are using) from Nightly Build repository and install it using the instructions given on that page. Once you configure and start GitLab. Check if you can access it from your host browser on
<ip address of host>
.Note
: Nightly packages versioning is incorrect which can cause a confusion. This issue is reported in #864. For the time being, consider the date of pushing (which is available next to the package name in the repository page) to find the latest package version.On Ubuntu Xenial, you may have to install tzdata. This issue is reported in #4769. -
Getting source of Omnibus GitLab
Get the source code of Omnibus GitLab from the repository on GitLab.com
git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git ~/omnibus-gitlab
We will be doing the development inside the
~/omnibus-gitlab
directory. -
Instructing GitLab to apply the changes we make to the cookbooks.
During development, we need the changes we make to the cookbooks to be applied immediately to the running GitLab instance. So, we have to instruct GitLab to use those cookbooks instead of the ones shipped during installation. This involves backing up of the existing cookbooks directory and symlinking the directory where we make modifications to its location.
sudo mv /opt/gitlab/embedded/cookbooks/gitlab /opt/gitlab/embedded/cookbooks/gitlab.$(date +%s) sudo ln -s ~/omnibus-gitlab/files/gitlab-cookbooks/gitlab /opt/gitlab/embedded/cookbooks/gitlab
-
Docker container specific items
Before running
reconfigure
, you need to start runsv./opt/gitlab/embedded/bin/runsvdir-start &
After running
reconfigure
, you may have sysctl errors. There is a workaround in the common installation problems doc.
Now, you can make necessary changes in the
~/omnibus-gitlab/files/gitlab-cookbooks/gitlab
folder and run sudo gitlab-ctl reconfigure
for those changes to take effect.
Run GitLab QA Against Your Development Environment
You can run GitLab QA tests against your development instance.
This ensures that your new work is behaving as expected, and not breaking anything else. You can even add your own tests to QA to validate what you are working on.
-
Create a user account on your development instance for GitLab QA to use
Then, from any machine that can reach your development instance:
-
Clone the GitLab EE repository
git clone git@gitlab.com:gitlab-org/gitlab.git
-
Change to the
qa
directorycd gitlab/qa
-
Install the required gems
bundle install
-
Run the tests
GITLAB_USERNAME=$USERNAME GITLAB_PASSWORD=$PASSWORD bundle exec bin/qa Test::Instance $DEV_INSTANCE_URL
Use Customers Portal Staging in GitLab
To connect your GitLab instance to Customers Portal Staging, you can set the following
custom environment variables
in /etc/gitlab/gitlab.rb
by supplying them in a gitlab_rails['env']
hash. Set:
-
GITLAB_LICENSE_MODE
totest
-
CUSTOMER_PORTAL_URL
tohttps://customers.stg.gitlab.com
For example:
gitlab_rails['env'] = {
"GITLAB_LICENSE_MODE" => "test",
"CUSTOMER_PORTAL_URL" => "https://customers.stg.gitlab.com"
}
OpenShift GitLab Development Setup
See Omnibus GitLab development setup documentation.