Ruby Gitlab Ci

The GitLab CI templates for Ruby project
Alternatives To Ruby Gitlab Ci
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Gitlabhq23,370
13 hours ago34otherRuby
GitLab CE Mirror | Please open new issues in our issue tracker on GitLab.com
Zealot796
4 days ago5mitRuby
开源自部署移动应用和 macOS 应用分发平台,提供 iOS、Android SDK、fastlane 等丰富组件库 | Self-hosted Beta App Distribution for Android, iOS and macOS apps
Gitlab Shell506
a day ago51mitGo
Replacement for gitolite. This repo is a mirror of https://gitlab.com/gitlab-org/gitlab-shell/
Rails_admin_toggleable334085 years ago17June 05, 20182mitRuby
Toggleable field for rails admin
Gitlabfaq21
3 months ago
🐧 Gitlab常见问题和有用信息、链接 📝
Mdn Compat Data Explorer18
3 years ago28mitRuby
A simple Rails app for exploring MDN Browser Compatibility Data
Ruby Gitlab Ci11
2 months ago1apache-2.0
The GitLab CI templates for Ruby project
Gitlab Ci Configuration11
10 months ago
Example of configuration Gitlab CI for Rails Application
Notiboard8
6 years agoRuby
Notice boards to follow and get notified for new stuffs with multiple integrations. | This is mirror repo, please use GitLab repo instead
Nextdeploy6
5 years ago1mitRuby
NextDeploy project
Alternatives To Ruby Gitlab Ci
Select To Compare


Alternative Project Comparisons
Readme

Ruby GitLab CI

This is GitLab CI templates for Ruby and Rails project.

Requirements

GitLab 15.0+

The cobertura is not supported by GitLab 15.0 to continue work with 14.3+ override artifacts to let it worked.

Usage

Include YAML in your .gitlab-ci.yml and apply variables and rules to control it.

include:
  remote: https://github.com/elct9620/ruby-gitlab-ci/raw/main/rails.yml

variables:
  RUBY_VERSION: 2.7.4
  ASSETS_PRECOMPILE: 'yes'

brakeman:
  rules:
    - if: $CI_MERGE_REQUEST_ID

Webdrivers

To support E2E testing, the default WD_INSTALL_DIR will be configured to tmp/webdrivers with the cache. You can use webdrivers gem without extra download cost with Capybara or others which depend on webdrivers.

The Capybara should register customize driver with --no-sandbox options

Capybara.register_driver :gitlab_ci do |app|
  version = Capybara::Selenium::Driver.load_selenium
  options_key = Capybara::Selenium::Driver::CAPS_VERSION.satisfied_by?(version) ? :capabilities : :options
  browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
    opts.add_argument('--headless')
    opts.add_argument('--disable-gpu') if Gem.win_platform?
    # Workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2650&q=load&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary
    opts.add_argument('--disable-site-isolation-trials')
    opts.add_argument('--no-sandbox')
  end

  Capybara::Selenium::Driver.new(app, **{ :browser => :chrome, options_key => browser_options })
end

Capybara.default_driver = if ENV.fetch('CI', false)
                            :gitlab_ci
                          else
                            :selenium_chrome_headless
                          end

Options

The options are usually based on the rules keyword to enable the task. If you overwrite the rules the variables are not necessary to configure.

Type Environment Name Default Description
Ruby RUBY_VERSION 3.2.2 The ruby image version
Ruby SORBET_ENABLED Unset Enable Sorbet gem to type check
Ruby RSPEC_JUNIT_REPORT Unset Export JUnit report for GitLab CI with RSpec JUnit Formatter gem
JavaScript NODE_PACKAGE_REQUIRED yes If not use Webpack the node packages are not required for Rails that can be disabled
Node NODE_VERSION 18.16.0 The node image version
Rails ASSETS_PRECOMPILE Unset Run Rails Assets Precompile and save into artifacts
Rails RAILS_PRODUCTION_KEY Unset When assets precompile we may need to replace RAILS_MASTER_KEY to production version
Docker DOCKER_VERSION 24.0 The docker version used to build docker image
Docker DOCKER_ENABLED Unset Run docker build .
Docker TRIVY_ENABLED Unset Use trivy to scan container
E2E BROWSER_REQUIRED no Install Browser for E2E testing
E2E INSTALL_CHROME yes Install Chrome for Cucumber E2E testing
E2E CHROME_VERSION Unset Specify Chrome version that match chromedriver version, e.g. 114.0.5735.90-1

S3

Upload to AWS S3 or Minio to provide CDN for your applicatoin.

Environment Name Default Description
UPLOAD_TO_S3 Unset When set to yes and ASSETS_PRECOMPILE is yes will run assets:s3 job
S3_ENDPOINT Unset If use Minio, set to your Minio endpoint
S3_ACCESS_KEY_ID Unset If you have another AWS_ACCESS_KEY_ID in your tasks, use S3_ version to overwrite it.
S3_SECRET_ACCESS_KEY Unset If you have another AWS_SECRET_ACCESS_KEY in your tasks, use S3_ version to overwrite it.
S3_BUCKET Unset The bucket name to upload your static assets
S3_SYNC_DELETE no Delete remote bucket files if local source not present

Deployment

The GitLab allows to create Review Apps when you create a merge request, we can use it for better QA flow.

Docker Swarm

Based on Docker Swarm Rocks example, we can use Traefik and GitLab Runner runs on Docker Swarm to support Review Apps.

P.S. You have to run a GitLab CI runner in the same host with the Swarm manager and use it to deploy to the Swarm cluster.

Please reference to the examples/review.yml as example to configure your GitLab CI and examples/review/docker-compose.yml for you stack file.

Options

Environment Name Default Description
DEPLOY_BASE_DOMAIN 127.0.0.1.xip.io When deploy we will use it as a base domain, e.g. 100-branch.127.0.0.1.xip.io
DEPLOY_NAME $CI_PROJECT_ID-$CI-ENVIRONMENT_SLUG The name used to be Docker Swarm stack name or Kubernetes namespace
DEPLOY_DOMAIN $DEPLOY_NAME.$DEPLOY_BASE_DOMAIN Only work for Docker Swarm with Traefik will be set to environment url
DEPLOY_STACK_FILE docker-compose.yml The Docker Swarm stack file for deployment
DEPLOY_WAIT_TIME 60 Time to wait for check Docker Swarm deploy status

Roadmap

  • [x] Ruby support
    • [x] Rubocop
    • [x] RSpec
    • [x] Cucumber
    • [x] Bundler Audit
    • [x] Bundler Leak
  • [ ] Add GitLab CI workflow to control jobs
  • [ ] Rails support
    • [x] Brakeman
    • [x] Assets Precompile
    • [x] S3 Upload for CDN
    • [ ] Database
      • [x] PostgreSQL
      • [ ] MySQL
  • [ ] JavaScript support
    • [ ] ESLint
    • [x] Yarn Audit
    • [ ] Jest
  • [ ] Containerize support
    • [x] Docker
    • [x] Trivy Scanner
      • [ ] Replace with GitLab version to generate report
    • [ ] Registry
      • [x] GitLab Registry
      • [ ] AWS ECR
  • [ ] Deployment
    • [x] Docker Swarm
    • [ ] Kubernetes (Not decided to add)
Popular Gitlab Projects
Popular Ruby On Rails Projects
Popular Version Control Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Ruby
Docker
Ruby On Rails
Gitlab