Commit 192a151d authored by Jan Včelák's avatar Jan Včelák 🚀
Browse files

Update README, non-real URLs in default config

parent c58f6fa1
# gitlab2jenkins
Gitlab2jenkins is a simple web application, which makes a proxy between Gitlab and Jenkins CI.
Gitlab2jenkins is a simple web application, which provides a bridge between [GitLab]( and [Jenkins CI]( server.
The application exposes API, which looks the same as API used by [GitLab CI]( server. However all requests are processed and proxied to Jenkins. This is useful especially when your testing infrastructure is complicated and GitLab CI cannot satisfy your requirements — for instance, multi-host builds, triggering of other tasks, etc.
It is written in Ruby (Sinatra) and is capable of running on OpenShift cloud.
It is written in Ruby (using [Sinatra]( web micro framework) and is ready to be run on OpenShift cloud.
**Demo**, actually used in production:
[Knot DNS - gitlab2jenkins]( at CZ.NIC Labs.
OpenShift with Ruby 1.9, MySQL 5.1, and Foreman
## Deployment
Quick start
### Local deployment
Clone the repository, install required gems, edit the configuration, and start the server:
1. `git clone`
2. `cd gitlab2jenkins`
3. `bundle install`
4. edit `config.rb` (provide connection to MySQL database, GitLab URL, and Jenkins URL)
5. `foreman start`
### Deployment on OpenShift
Create the application directly using `rhc`. Notice that the application requires third party cartridge with Foreman.
rhc app create gitlab2jenkins ruby-1.9 mysql-5.1 --from-code
rhc app create <appname> ruby-1.9 mysql-5.1 \ \
Jenkins job: remember name, build with parameters (needs secret token), parameters commit and branch
## Configuration
### Configure target Jenkins job
1. Create new or update existing target Jenkins job.
2. In build configuration, enable *This build is parametrized* checkbox and add two parameters: `commit` and `branch`.
3. Set up source code checkout from GitLab Git repository and use `$commit` value as a branch to build.
4. In build triggers, enable *Trigger builds remotely* and set random *Authentication token*.
### Register Jenkins job in Gitlab2jenkins
Use provided `add_project.rb` script to register target Jenkins task.
For local deployment, run:
rhc ssh gitlab2jenkins 'cd app-root/repo && bundle exec ./add_project.rb "Awesome Project" awesome_project secret-token'
Project: Awesome Project
Jenkins: awesome_project (token secret-token)
Token: gitlab2jenkins-generated-token
./add_project.rb "Project Name" "jenkins-job-name" "jenkins-secret-token"
Generated token is used for Gitlab authentication to gitlab2jenkins.
Gitlab CI url should be set to `http://gitlab2jenkins-<namespace><project-id>`.
For OpenShift deployment, run:
rhc ssh <appname> 'cd app-root/repo && bundle exec ./add_project.rb "Project Name" "jenkins-job-name" "jenkins-secret-token"'
Manual trigger for new builds in Jenkins (should not be needed):
The summary should be printed out. New secret token for authenticate to Gitlab2jenkins will be generated.
rhc ssh gitlab2jenkins 'cd app-root/repo && bundle exec ./update_builds.rb once'
Project: Project Name
Jenkins: jenkins-job-name (token jenkins-secret-token)
Token: gitlab2jenkins-generated-token
Open Gitlab2jenkis in web browser, link to the project should be on the main page.
### Configure GitLab to use the proxy
1. In the project settings in GitLab select *Services* and *GitLab CI*.
2. Enable the service by checking the *Activate* checkbox.
3. Set *Token* token a value generated by `add_project.rb` script.
4. Set *Project url* to project page in Gitlab2jenkins. In case of OpenShift, it will be something like `http://<app-name>-<namespace><project-id>`.
## Troubleshooting
New builds are pulled from Jenkins periodically. If it does not work, try updating the builds manually:
```./update_builds.rb once``` or `rhc ssh gitlab2jenkins 'cd app-root/repo && bundle exec ./update_builds.rb once'`
......@@ -8,7 +8,7 @@ else
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment