Skip to content

Improve project

Song Huang请求将feature/refactor-event-gitlab-cn合并到master

What does this MR do and why?

Do something to import project, like debug mode, uniform naming etc. Details changes:

  1. Change to cleaner method of JiHu group and project.
    def from_gitlab_org?
      event_from_group?(Triage::GITLAB_ORG_GROUP)
    end
    
    def from_gitlab_org_gitlab?
      with_project_id?(GITLAB_PROJECT_ID)
    end
    
    # Changes
    def from_gitlab_cn?
      event_from_group?(Triage::GITLAB_CN_GROUP)
    end
    
    # Changes
    def from_gitlab_cn_gitlab?
      project_path_with_namespace == Triage::GITLAB_CN_GITLAB
    end
  2. Remove the members job of upstream. This will send a uesless API request, and there will be an error on server start:
    {"name":"sucker_punch","hostname":"MBP2021.local","pid":52020,"severity":"INFO","time":"2022-05-20T15:53:45.934+08:00","message":"Keeping the cache warm..."}
    * Listening on http://0.0.0.0:8080
    Use Ctrl-C to stop
    {"name":"sucker_punch","hostname":"MBP2021.local","pid":52020,"severity":"ERROR","time":"2022-05-20T15:53:47.084+08:00","message":"Server responded with code 404, message: 404 Group Not Found. Request URI: http://localhost:3000/api/v4/groups/jihulab/members","err":{"name":"Gitlab::Error::NotFound","message":"Server responded with code 404, message: 404 Group Not Found. Request URI: http://localhost:3000/api/v4/groups/jihulab/members","stack":"/Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-4.18.0/lib/gitlab/request.rb:71:in `validate'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-4.18.0/lib/gitlab/request.rb:55:in `block (2 levels) in <class:Request>'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/gitlab-4.18.0/lib/gitlab/client/groups.rb:71:in `group_members'\n  /Users/songhuang/repos/triage-ops/triage/triage.rb:115:in `fresh_group_members'\n  /Users/songhuang/repos/triage-ops/triage/triage.rb:102:in `block in group_members'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/mini_cache-1.1.0/lib/mini_cache/store.rb:62:in `set'\n  /Users/songhuang/repos/triage-ops/triage/triage.rb:101:in `public_send'\n  /Users/songhuang/repos/triage-ops/triage/triage.rb:101:in `group_members'\n  /Users/songhuang/repos/triage-ops/triage/triage.rb:88:in `group_member_attrs'\n  /Users/songhuang/repos/triage-ops/triage/triage.rb:75:in `block (3 levels) in singleton class'\n  /Users/songhuang/repos/triage-ops/triage/job/keep_cache_warm_job.rb:16:in `public_send'\n  /Users/songhuang/repos/triage-ops/triage/job/keep_cache_warm_job.rb:16:in `block (2 levels) in perform'\n  /Users/songhuang/repos/triage-ops/triage/job/keep_cache_warm_job.rb:15:in `each'\n  /Users/songhuang/repos/triage-ops/triage/job/keep_cache_warm_job.rb:15:in `block in perform'\n  /Users/songhuang/repos/triage-ops/triage/job/keep_cache_warm_job.rb:14:in `each'\n  /Users/songhuang/repos/triage-ops/triage/job/keep_cache_warm_job.rb:14:in `perform'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/sucker_punch-3.0.1/lib/sucker_punch/job.rb:63:in `__run_perform'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/sucker_punch-3.0.1/lib/sucker_punch/job.rb:38:in `block in perform_async'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'\n  /Users/songhuang/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'"},"klass":"Triage::KeepCacheWarmJob","args":[]}
  3. Add debug in development environment. Now we can use byebug in development and test environment without temporarily add these code every time:
    require 'byebug'
  4. Fix artifacts:reports:cobertura.
Song Huang 编辑于

合并请求报告