{"id":18603416,"url":"https://github.com/frrouting/netdef-ci-github-app","last_synced_at":"2025-04-10T19:31:47.854Z","repository":{"id":191277667,"uuid":"684296573","full_name":"FRRouting/netdef-ci-github-app","owner":"FRRouting","description":"Github App for NetDEF CI FRR Pull Request Testing","archived":false,"fork":false,"pushed_at":"2025-04-04T14:51:22.000Z","size":1466,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T15:36:42.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FRRouting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-08-28T21:12:40.000Z","updated_at":"2025-04-04T14:51:26.000Z","dependencies_parsed_at":"2023-08-29T06:06:35.457Z","dependency_job_id":"7e922ac6-6c4c-4ea7-bd3b-f57fb89a0859","html_url":"https://github.com/FRRouting/netdef-ci-github-app","commit_stats":null,"previous_names":["frrouting/netdef-ci-github-app"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRRouting%2Fnetdef-ci-github-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRRouting%2Fnetdef-ci-github-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRRouting%2Fnetdef-ci-github-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FRRouting%2Fnetdef-ci-github-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FRRouting","download_url":"https://codeload.github.com/FRRouting/netdef-ci-github-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281409,"owners_count":21077423,"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":[],"created_at":"2024-11-07T02:14:25.187Z","updated_at":"2025-04-10T19:31:47.843Z","avatar_url":"https://github.com/FRRouting.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Hook Server\nAllows a GitHub application to communicate with a server and \nthat server can trigger executions on a CI and control the \ncreation of Check Suite and Run for each new creation and \ncommit in a PR.\n\n# Installation\n\n### Packages\nThe first step before running the system is to install these programs:\n\n- Ruby (+2.7 or +3.0)\n- PostgreSQL (any version)\n- Git\n- Redis (https://redis.io/)\n\n### Gems\nThe project does not use any Ruby versioning services (RVM or Rbenv) and \nthe gems must be available as Debian packages.\nWe have a Gemfile to install the gems, but any gem must be available as a package.\n\nProduction / Development\n- puma\n- ruby-json\n- ruby-jwt\n- ruby-netrc\n- ruby-octokit\n- ruby-otr-activerecord\n- ruby-pg\n- ruby-sidekiq\n- ruby-sidekiq-cron\n- ruby-sinatra\n\nTest\n\nIn addition to the gems listed above, we need these to run the tests locally:\n\n- rubocop\n- ruby-database-cleaner\n- ruby-factory-bot\n- ruby-faker\n- ruby-rack-test\n- ruby-rubocop-performance\n- ruby-rspec\n- ruby-webmock\n\n# Database Configuration\n\nThis document provides instructions on how to configure the database for the GitHub Hook Server project.\n\n## Prerequisites\n\nEnsure you have the following installed on your system:\n- PostgreSQL (any version)\n\n## Configuration Steps\n\n1. **Install PostgreSQL**:\n   Follow the instructions for your operating system to install PostgreSQL. You can find the installation guide on the [official PostgreSQL website](https://www.postgresql.org/download/).\n\n2. **Create a Database**:\n   After installing PostgreSQL, create a new database for the project. You can do this using the `psql` command-line tool or any PostgreSQL client.\n\n   ```bash\n   RAKE_ENV=development psql -c \"CREATE DATABASE github_hook_server_development;\"\n   ```\n3. **Configure Database Connection**:\n    Update the `config/database.yml` file with the database connection details. You can use the following configuration as a template:\n    \n    ```yaml\n    development:\n      adapter: postgresql\n      encoding: unicode\n      database: github_hook_server_development\n      pool: 5\n      username: postgres\n      password: password\n      host: localhost\n      port: 5432\n    ```\n    \n    Replace the `username`, `password`, `host`, and `port` values with your PostgreSQL connection details.\n\n4. **Run Database Migrations**:\nAfter configuring the database, run the database migrations to set up the necessary tables and schema.  \n ```bash\n  bundle exec rake db:migrate\n ```\n\n5. **Verify the Configuration**:\n   Start the application and verify that it can connect to the database without any errors.\n```bash\nRAILS_ENV=development rackup -o 0.0.0.0 -p 9292 config.ru\n```\n\n# Usage\n\n### Production\n\nGitHub Hook is initialized at production mode running the following command:\n`RAILS_ENV=production RACK_ENV=production rackup config.ru -o 0.0.0.0 -p 4667`\n\nIt is important that you have registered an application with GitHub for this tool to work correctly.\n\n### Development\n\nJust run the command: `rackup -o 0.0.0.0 -p 9292 config.ru`\n\n# Testing\n\nRubocop can be executed with the following command: `rubocop -A`.\n\nThe '-A' parameter will automatically fix some code mistakes.\n\nRspec be executed with the following command: `rspec ./spec --pattern '**/*_spec.rb'`\n\n# Installing RVM (Ruby Version Manager)\n\nThis guide will walk you through the steps to install RVM (Ruby Version Manager) on your system.\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed on your system:\n- `curl`\n- `gpg`\n- `openssl`\n- `libssl-dev`\n- `libpq-dev`\n\nYou can install these using your package manager. For example, on Debian-based systems, you can use:\n\n```shell\nsudo apt update\nsudo apt install -y curl gpg libssl-dev libpq-dev\n```\n\n## Installation Steps\n\n1. Install RVM\n   To install RVM, run the following command:\n\n```shell\n\\curl -sSL https://get.rvm.io | bash -s stable\n```\n\n2. Load RVM Scripts\n   After the installation, you need to load the RVM scripts. Add the following line to your shell profile (~/.bashrc, ~/.zshrc, etc.):\n\n```shell\nsource ~/.rvm/scripts/rvm\n```\nThen, reload your shell profile:\n```shell\nsource ~/.bashrc  # or source ~/.zshrc\n```\n\n3. Verify the Installation\n   To verify that RVM is installed correctly, run:\n\n```shell\nrvm --version\n```\n\nYou should see the RVM version information.  \n\n## Installing Ruby\nOnce RVM is installed, you can use it to install Ruby versions.\n1. Install a Ruby Version\n   To install a specific version of Ruby, use the following command:\n\n```shell\nrvm autolibs disable\nrvm install 3.3.1\n```\n\n2. Use a Ruby Version\n   To use a specific version of Ruby, run:\n\n```shell\nrvm use 3.3.1 --default\n```\nThis sets the specified Ruby version as the default for your shell.\n\n3. Verify the Ruby Installation\n   To verify that Ruby is installed correctly, run:\n\n```shell \nruby --version\n```   \nYou should see the version of Ruby that you installed.\n\n## Managing Multiple Ruby Versions\nRVM allows you to manage multiple Ruby versions. You can switch between them as needed.  \nList Installed Ruby Versions\nTo list all installed Ruby versions, run:\n\n```shell\nrvm list\n```\n\nSwitch Ruby Versions\nTo switch to a different Ruby version, use:\n\n```shell \nrvm use \u003cversion\u003e\n```\n\nUninstalling RVM\nIf you need to uninstall RVM, you can do so with the following command:\n\n```shell\nrvm implode\n```\n\n# Installing RbEnv (Ruby Environment Version)\n\nThis guide will walk you through the steps to install RbEnv (Ruby Environment Version) on your system.\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed on your system:\n- `curl`\n- `gpg`\n- `openssl`\n- `rbenv`\n- `libpq-dev`\n\n```shell\napt install rbenv\n```\n\n## Installation Steps\n\nMove to project directory and run the following command:\n\n```shell\nrbenv init\n````\n\nThis will create a `.rbenv` directory in your home directory.\nThen, add the following lines to your shell profile (~/.bashrc, ~/.zshrc, etc.):\n```\neval \"$(rbenv init -)\"\n```\n\n```shell\nrbenv install 3.1.2\nrbenv local 3.1.2\n```\n\nAfter that, run the following command:\n\n```shell\nbundle install\n```\n\n# Multiple Repositories\n\n## GitHub Repositories\n\nThe GitHub Hook Server is designed to work with multiple repositories.\nTo add a new repository, you need to create a new entry in the `config.yml` file.\nThe `config.yml` file is located in the root directory of the project.\n\n### Example Configuration\n\n```yaml\ngithub_apps:\n  - login: 1234567\n    cert: github_private_key.pem\n    repo: 'opensourcerouting/frr-ci-test'\n\n  - login: 9876543\n    cert: github_private_key.pem\n    repo: 'RodrigoMNardi/frr' \n```\n\n### Configuration Parameters\n- `login`: The GitHub login for the application.\n- `cert`: The path to the private key file for the GitHub application.\n- `repo`: The GitHub repository to monitor.\n\n# Console\n\nThe bin/console script allows you to interact with the application in an interactive Ruby (IRB) session. \nThis can be useful for debugging, running commands, and interacting with the application's models and database.\n\n## Available Commands\n\n- find_organization(name)  \n  - Description: Finds an organization by its name.\n  - Parameters:\n    - name: The name of the organization to find.\n\n- create_organization(name, attributes = {})  \n  - Description: Creates a new organization with the given attributes.\n  - Parameters:\n    - name: The name of the organization to create.\n    - attributes: A hash of attributes for the organization.\n    - contact_email: The contact email of the organization (string).\n    - contact_name: The contact name of the organization (string).\n    - url: The URL of the organization (string).\n    \n- edit_organization(name, attributes = {})  \n  - Description: Edits an existing organization with the given attributes.\n  - Parameters:\n    - name: The name of the organization to edit.\n    - attributes: A hash of attributes to update for the organization.\n    - contact_email: The contact email of the organization (string).\n    - contact_name: The contact name of the organization (string).\n    - url: The URL of the organization (string).\n\n- find_github_user(login)  \n  - Description: Finds a GitHub user by their login.\n  - Parameters:\n    - login: The GitHub login of the user to find.\n\n- add_user_in_organization(login, organization_name)  \n  - Description: Adds a GitHub user to an organization.\n  - Parameters:\n    - login: The GitHub login of the user to add.\n    - organization_name: The name of the organization to add the user to.\n\n- remove_user_from_organization(login)  \n  - Description: Removes a GitHub user from their organization.\n  - Parameters:\n    - login: The GitHub login of the user to remove.\n\n- add_github_user_slack_user(github_login, slack_user)  \n  - Description: Links a GitHub user to a Slack user.\n  - Parameters:\n    - github_login: The GitHub login of the user to link.\n    - slack_user: The Slack username to link to the GitHub user.\n\nExamples\n- Find an organization by name:  \n   - find_organization('NetDEF')\n   - \n- Create a new organization:  \n  - create_organization('NetDEF', contact_name: 'Rodrigo Nardi')\n\n- Edit an existing organization:  \n  - edit_organization('NetDEF', contact_name: 'Martin Winter')\n\n- Find a GitHub user by login:  \n  - find_github_user('rodrigonardi')\n\n- Add a user to an organization:  \n  - add_user_in_organization('rodrigonardi', 'NetDEF')\n\n- Remove a user from an organization:  \n  - remove_user_from_organization('rodrigonardi')\n\n- Link a GitHub user to a Slack user:\n  - add_github_user_slack_user('rodrigonardi', 'slack_user')","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrrouting%2Fnetdef-ci-github-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrrouting%2Fnetdef-ci-github-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrrouting%2Fnetdef-ci-github-app/lists"}