1 of 14

GitLab CI Cloud Service

Group 3

2 of 14

Service Overview

3 of 14

GitLab CE

  • GitLab Commercial Edition
    • Open source (free).
    • Everyone can host on his server.
  • Has similar user experience to GitHub.
  • User can own unlimited public/private repositaries.

4 of 14

GitLab CI

  • GitLab Continuous Integration
    • This feature is part of GitLab CE.
  • Automatically run builds when a commit is pushed to GitLab.
    • User shell configure the way to make builds in .gitlab-ci.yml, which is placed under the root of the repositary.
  • GitLab CI requires a runner server to run builds.

5 of 14

Architecture

Net04_ext

Gitlab_subnet

Gitlab_Server

Provide GitLab service:

  • Host git repositaries.

Runner_Server

As a shared runner for “Gitlab_Server”

  • Run builds for all configured repositaries when a commit is pushed to “Gitlab_Server”.

Associate floating IP

router

Register a runner to Gitlab_Server.

  • With a registration token.

6 of 14

Steps for the Stack Creation

Gitlab_Server

Runner_Server

Net04_ext

Gitlab_subnet

Associate floating IP

router

  • Create network environment.

(The order is automatically handled by hidden dependency)

2. Launch instance “Gitlab_Server”.

(Wait with a wait condition for retrieving a registration token)

3. Launch instance “Runner_Server”

(Register to Gitlab_Server)

7 of 14

Estimated Time for Stack Creation

  • About 8 minutes for GitLab to ready.
    • Accessiable on the given floating IP.
      • ex: http://140.113.240.8
    • User can register accounts, create repositaries, and make git push/pull…
  • About 15 minutes for GitLab CI to serve.
    • Commits pushed to GitLab_Server will trigger builds according to the configuration in .gitlab-ci.yml.

8 of 14

The Implementation

9 of 14

The Heat Template (YAML)

1. Parameters

a. root_passwd,key,image,flavor,network,dns…

2. Resources

a. Server1/Server2

b. port

c. user_data

3. Outputs

a. Private_key

10 of 14

User_data for Instance “Gitlab_Server”

  • Install GitLab.
    • Following the instruction on the official website.
  • Configure GitLab.
    • Setting the external URL, the floating IP associated to the instance, for GitLab.
  • Retrieve the registration token.
  • Set root’s password for GitLab.
    • Clear the expiration and make the service ready.
  • Notify the wait condition
    • along with the registration token.

11 of 14

User_data for Instance “Runner_Server”

  • Install “gitlab-ci-multi-runner”.
    • Following the official instruction.

  • Register the runner to “Gitlab_Server”.
    • providing
      • URL (the floating IP associated to Gitlab_Server)
      • Registration token

12 of 14

Difficulties Encountered (1)

  • Registration token is not stored in any file, so there is no way to retrieve it execpt for browsing the website.
    • Modify the source code of GitLab. (with sed)
  • Starting processes of GitLab detach immediately after the command is made, so it is unaware of when these processes will complete.
    • Use a FIFO to wait for these processes finishing.

13 of 14

Difficulties Encountered (2)

  • The registration process on Runner_Server must start after the Gitlab_Server can serve.
    • Use OS::Heat::WaitCondition and OS::Heat::WaitConditionHandle
  • “apt-get install” ask questions interacitively, so shellscript may be blocked.
    • Use “debconf-set-selections” to answer these questions before executing “apt-get”.

14 of 14

Demo