{"id":21991930,"url":"https://github.com/elct9620/ruby-gitlab-ci","last_synced_at":"2025-06-11T11:20:39.154Z","repository":{"id":42493407,"uuid":"432713763","full_name":"elct9620/ruby-gitlab-ci","owner":"elct9620","description":"The GitLab CI templates for Ruby project","archived":false,"fork":false,"pushed_at":"2025-03-25T14:03:04.000Z","size":201,"stargazers_count":13,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T14:22:35.560Z","etag":null,"topics":["docker","gitlab","rails","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elct9620.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-28T13:01:49.000Z","updated_at":"2025-03-25T14:03:07.000Z","dependencies_parsed_at":"2023-12-30T15:25:29.367Z","dependency_job_id":"c7991b3b-1fee-41d7-b25e-47c59861d11d","html_url":"https://github.com/elct9620/ruby-gitlab-ci","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fruby-gitlab-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fruby-gitlab-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fruby-gitlab-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fruby-gitlab-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elct9620","download_url":"https://codeload.github.com/elct9620/ruby-gitlab-ci/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fruby-gitlab-ci/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259253754,"owners_count":22829151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","gitlab","rails","ruby","ruby-on-rails"],"created_at":"2024-11-29T20:12:12.735Z","updated_at":"2025-06-11T11:20:39.113Z","avatar_url":"https://github.com/elct9620.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Ruby GitLab CI\n===\n\nThis is GitLab CI templates for Ruby and Rails project.\n\n## Requirements\n\nGitLab 15.0+\n\n\u003e The `cobertura` is not supported by GitLab 15.0 to continue work with 14.3+ override `artifacts` to let it worked.\n\n## Usage\n\nInclude YAML in your `.gitlab-ci.yml` and apply `variables` and `rules` to control it.\n\n```yaml\ninclude:\n  remote: https://github.com/elct9620/ruby-gitlab-ci/raw/main/rails.yml\n\nvariables:\n  RUBY_VERSION: 2.7.4\n  ASSETS_PRECOMPILE: 'yes'\n\nbrakeman:\n  rules:\n    - if: $CI_MERGE_REQUEST_ID\n```\n\n\u003e [!WARNING]\n\u003e For previous version use `raw/v1` instead of `raw/main` in the URL.\n\n### Webdrivers\n\nTo 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`.\n\nThe Capybara should register customize driver with `--no-sandbox` options\n\n```ruby\nCapybara.register_driver :gitlab_ci do |app|\n  version = Capybara::Selenium::Driver.load_selenium\n  options_key = Capybara::Selenium::Driver::CAPS_VERSION.satisfied_by?(version) ? :capabilities : :options\n  browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|\n    opts.add_argument('--headless')\n    opts.add_argument('--disable-gpu') if Gem.win_platform?\n    # Workaround https://bugs.chromium.org/p/chromedriver/issues/detail?id=2650\u0026q=load\u0026sort=-id\u0026colspec=ID%20Status%20Pri%20Owner%20Summary\n    opts.add_argument('--disable-site-isolation-trials')\n    opts.add_argument('--no-sandbox')\n  end\n\n  Capybara::Selenium::Driver.new(app, **{ :browser =\u003e :chrome, options_key =\u003e browser_options })\nend\n\nCapybara.default_driver = if ENV.fetch('CI', false)\n                            :gitlab_ci\n                          else\n                            :selenium_chrome_headless\n                          end\n```\n\n## Options\n\nThe options are usually based on the `rules` keyword to enable the task. If you overwrite the `rules` the variables are not necessary to configure.\n\n| Type       | Environment Name        | Default   | Description                                                                                                       |\n|------------|-------------------------|-----------|-------------------------------------------------------------------------------------------------------------------|\n| Ruby       | `RUBY_VERSION`          | `3.2.2`   | The ruby image version                                                                                            |\n| Ruby       | `SORBET_ENABLED`        | Unset     | Enable Sorbet gem to type check                                                                                   |\n| Ruby       | `RSPEC_JUNIT_REPORT`    | Unset     | Export JUnit report for GitLab CI with [RSpec JUnit Formatter](https://github.com/sj26/rspec_junit_formatter) gem |\n| JavaScript | `NODE_PACKAGE_REQUIRED` | `yes`     | If not use Webpack the node packages are not required for Rails that can be disabled                              |\n| Node       | `NODE_VERSION`          | `18.16.0` | The node image version                                                                                            |\n| Rails      | `ASSETS_PRECOMPILE`     | Unset     | Run Rails Assets Precompile and save into artifacts                                                               |\n| Rails      | `RAILS_PRODUCTION_KEY`  | Unset     | When assets precompile we may need to replace `RAILS_MASTER_KEY` to production version                            |\n| Docker     | `DOCKER_VERSION`        | `24.0`    | The docker version used to build docker image                                                                     |\n| Docker     | `DOCKER_ENABLED`        | Unset     | Run `docker build .`                                                                                              |\n| Docker     | `TRIVY_ENABLED`         | Unset     | Use [trivy](https://github.com/aquasecurity/trivy) to scan container                                              |\n| E2E        | `BROWSER_REQUIRED`      | `no`      | Install Browser for E2E testing                                                                                   |\n| E2E        | `INSTALL_CHROME`        | `yes`     | Install Chrome for Cucumber E2E testing                                                                           |\n| E2E        | `CHROME_VERSION`        | Unset     | Specify Chrome version that match chromedriver version, e.g. `114.0.5735.90-1`\n\n### S3\n\nUpload to AWS S3 or Minio to provide CDN for your applicatoin.\n\n| Environment Name       | Default | Description                                                                                   |\n|------------------------|---------|-----------------------------------------------------------------------------------------------|\n| `UPLOAD_TO_S3`         | Unset   | When set to `yes` and `ASSETS_PRECOMPILE` is `yes` will run `assets:s3` job                   |\n| `S3_ENDPOINT`          | Unset   | If use Minio, set to your Minio endpoint                                                      |\n| `S3_ACCESS_KEY_ID`     | Unset   | If you have another `AWS_ACCESS_KEY_ID` in your tasks, use `S3_` version to overwrite it.     |\n| `S3_SECRET_ACCESS_KEY` | Unset   | If you have another `AWS_SECRET_ACCESS_KEY` in your tasks, use `S3_` version to overwrite it. |\n| `S3_BUCKET`            | Unset   | The bucket name to upload your static assets                                                  |\n| `S3_SYNC_DELETE`       | `no`    | Delete remote bucket files if local source not present                                        |\n\n## Deployment\n\nThe GitLab allows to create Review Apps when you create a merge request, we can use it for better QA flow.\n\n### Options\n\n| Environment Name     | Default                               | Description                                                                     |\n|----------------------|---------------------------------------|---------------------------------------------------------------------------------|\n| `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` |\n| `DEPLOY_NAME`        | `$CI_PROJECT_ID-$CI-ENVIRONMENT_SLUG` | The name used to be Docker Swarm stack name or Kubernetes namespace             |\n| `DEPLOY_DOMAIN`      | `$DEPLOY_NAME.$DEPLOY_BASE_DOMAIN`    | Only work for Docker Swarm with Traefik will be set to environment url          |\n\n### Docker Swarm\n\nBased on [Docker Swarm Rocks](https://dockerswarm.rocks/) example, we can use [Traefik](https://dockerswarm.rocks/traefik/) and [GitLab Runner](https://dockerswarm.rocks/gitlab-ci/) runs on Docker Swarm to support Review Apps.\n\nP.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.\n\nPlease reference to the `examples/review.yml` as example to configure your GitLab CI and `examples/review/docker-compose.yml` for you stack file.\n\n#### Docker Swarm Options\n\n| Environment Name     | Default                               | Description                                                                     |\n|----------------------|---------------------------------------|---------------------------------------------------------------------------------|\n| `DEPLOY_STACK_FILE`  | `docker-compose.yml`                  | The Docker Swarm stack file for deployment                                      |\n| `DEPLOY_WAIT_TIME`   | `60`                                  | Time to wait for check Docker Swarm deploy status                               |\n\n### Sentry\n\nThe Sentry can associate commit with repository, we can use it to track the error and performance.\n\n| Environment Name    | Default | Description                                                     |\n|---------------------|---------|-----------------------------------------------------------------|\n| `SENTRY_AUTH_TOKEN` | Unset   | The Sentry Auth Token to upload source map and associate commit |\n\n### GitOps\n\nThe [GitOps](https://about.gitlab.com/topics/gitops/) allow us to management deployment by git and make it trackable.\n\n#### GitOps Options\n\n| Environment Name   | Default  | Description                                                |\n|--------------------|----------|------------------------------------------------------------|\n| `CI_GITOPS_USER`   | `gitops` | The username to access Git repository                      |\n| `CI_GITOPS_TOKEN`  | `\"\"`     | The token or password to access Git repository             |\n| `CI_GITOPS_REPO`   | Unset    | The repository URL (e.g. `gitlab.com/elct9620/gitops.git`) |\n| `CI_GITOPS_BRANCH` | `main`   | The branch to push                                         |\n\n#### Examples\n\n* `examples/gitops/kustomize.yml`\n\n## Roadmap\n\n* [x] Ruby support\n  * [x] Rubocop\n  * [x] RSpec\n  * [x] Cucumber\n  * [x] Bundler Audit\n  * [x] Bundler Leak\n* [ ] Add GitLab CI `workflow` to control jobs\n* [ ] Rails support\n  * [x] Brakeman\n  * [x] Assets Precompile\n  * [x] S3 Upload for CDN\n  * [ ] Database\n    * [x] PostgreSQL\n    * [ ] MySQL\n* [ ] JavaScript support\n  * [ ] ESLint\n  * [x] Yarn Audit\n  * [ ] Jest\n* [ ] Containerize support\n  * [x] Docker\n  * [x] Trivy Scanner\n    * [ ] Replace with GitLab version to generate report\n  * [ ] Registry\n    * [x] GitLab Registry\n    * [ ] AWS ECR\n* [ ] Deployment\n  * [x] Docker Swarm\n  * [x] Kubernetes\n    * [x] ArgoCD (Kustomize)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felct9620%2Fruby-gitlab-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felct9620%2Fruby-gitlab-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felct9620%2Fruby-gitlab-ci/lists"}