GitLab Documentation

Setting up a build environment

Setting up a build environment

Omnibus GitLab provides docker images for all the OS versions that it supports and these are available in the Container Registry. Users can use these images to setup the build environment. The steps are as follows

  1. Install Docker. Visit official docs for more details.

  2. Pull the docker image for the OS you need to build package for GitLab Omnibus builder registry contains images for all the supported OSs and versions. You can use one of them to build a package for it. For example, to prepare a build environment for Debian Stretch, you have to pull its image. The revision of the image to be used is specified in BUILDER_IMAGE_REVISION variable in .gitlab-ci.yml file. Make sure you substitute that value to ${BUILDER_IMAGE_REVISION} in the following commands.

    docker pull registry.gitlab.com/gitlab-org/gitlab-omnibus-builder:debian_9-${BUILDER_IMAGE_REVISION}
    
  3. Start the container and enter its shell:

    docker run -it registry.gitlab.com/gitlab-org/gitlab-omnibus-builder:debian_9-${BUILDER_IMAGE_REVISION} bash
    
  4. Clone the Omnibus GitLab source and change to the cloned directory:

    git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git ~/omnibus-gitlab
    cd ~/omnibus-gitlab
    
  5. Omnibus GitLab is optimized to use the internal repositories from dev.gitlab.org. These repositories are specified in the .custom_sources.yml file (specified by remote key) in the root of the source tree and will be used by default. Since these repositories are not publicly usable, for personal builds you have to use public alternatives of these repos. The alternatives are also provided in the same file, specified by alternative key. The selection between these two is controlled by ALTERNATIVE_SOURCES environment variable, which can be set either true or false. If that variable is set true, the repositories marked by alternative key will be used. Similarly, if you want to use your custom forks as sources, modify the .custom_sources.yml file and specify them as alternate and set the ALTERNATIVE_SOURCES variable to true.

  6. Install the dependencies and generate binaries:

    bundle install --path .bundle --binstubs
    
  7. Run the build command to initiate a build process:

    bin/omnibus build gitlab
    

    You can see the results of the build in the pkg folder at the root of the source tree.

Was this helpful? Do you think that something is unclear? Use the comments area below and leave your feedback. For support and other enquiries, see getting help.