GitHub PullRequestReviewCommentEvent at 2014-10-01 22:24:23
Repository: gitlab-ci
Actor: houndci
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/comments/18312369","id":18312369,"diff_hunk":"@@ -0,0 +1,52 @@\n+require 'travis/yaml'\n+require 'travis/yaml/nodes/language'\n+\n+class GenerateBuildsByConfigService\n+  attr_accessor :parameters, :params_for_combinations\n+  def builds(build_config_params, default_build, custom_attributes, &block)\n+    raise 'block must be specified' unless block_given?\n+``\n+\n+    @parameters = Travis::Yaml.parse(build_config_params)\n+\n+    if @parameters.branches\n+      if @parameters.branches.only\n+        return unless @parameters.branches.only.include? default_build.branch\n+      elsif @parameters.branches.except\n+        return if @parameters.branches.except.include? default_build.branch\n+      end\n+    end\n+\n+    Travis::Yaml.matrix(build_config_params).each do |matrix_entry|\n+      matrix_build_config = {}\n+      matrix_entry.mapping.each_key do |key|\n+        # call method to get matrix entry specialization for each mapped key\n+        # because Matrix::Entry redefines method for modified keys\n+        matrix_build_config[key] = matrix_entry.method(key).call()\n+      end\n+\n+      if matrix_entry.respond_to? :matrix_attributes\n+        matrix_env = matrix_entry.matrix_attributes[:env]\n+        matrix_attributes = matrix_entry.matrix_attributes\n+      else\n+        matrix_env = @parameters.env.matrix if @parameters.env\n+        matrix_attributes = nil\n+      end\n+\n+      # workaround for broken matrix_entry.global\n+      inherited_env = @parameters.env.global if @parameters.env\n+      matrix_build_config['env'] = [*matrix_env, *inherited_env].compact\n+\n+      # use eval to convert back to simple represtentation\n+      matrix_attributes = eval(matrix_attributes.to_s) if matrix_attributes\n+\n+      # make it as data\n+      matrix_build_data = {}\n+      matrix_build_data['config'] = matrix_build_config","path":"app/services/generate_builds_by_config_service.rb","position":45,"original_position":45,"commit_id":"0e025f843c44a14543a5973f1d332388d1aa8dfe","original_commit_id":"0e025f843c44a14543a5973f1d332388d1aa8dfe","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=2","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2014-10-01T22:24:23Z","updated_at":"2014-10-01T22:24:23Z","html_url":"https://github.com/gitlabhq/gitlab-ci/pull/462#discussion_r18312369","pull_request_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462","_links":{"self":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/comments/18312369"},"html":{"href":"https://github.com/gitlabhq/gitlab-ci/pull/462#discussion_r18312369"},"pull_request":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462"}}},"pull_request":{"url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462","id":19675050,"html_url":"https://github.com/gitlabhq/gitlab-ci/pull/462","diff_url":"https://github.com/gitlabhq/gitlab-ci/pull/462.diff","patch_url":"https://github.com/gitlabhq/gitlab-ci/pull/462.patch","issue_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues/462","number":462,"state":"open","locked":false,"title":"Added Travis-CI compatibility layer","user":{"login":"ayufan","id":2419009,"avatar_url":"https://avatars.githubusercontent.com/u/2419009?v=2","gravatar_id":"","url":"https://api.github.com/users/ayufan","html_url":"https://github.com/ayufan","followers_url":"https://api.github.com/users/ayufan/followers","following_url":"https://api.github.com/users/ayufan/following{/other_user}","gists_url":"https://api.github.com/users/ayufan/gists{/gist_id}","starred_url":"https://api.github.com/users/ayufan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayufan/subscriptions","organizations_url":"https://api.github.com/users/ayufan/orgs","repos_url":"https://api.github.com/users/ayufan/repos","events_url":"https://api.github.com/users/ayufan/events{/privacy}","received_events_url":"https://api.github.com/users/ayufan/received_events","type":"User","site_admin":false},"body":"WARNING: This is WIP, please do not merge. This is preliminary work which still requires significant changes: i.e. better handling build matrix in terms of database representation and views.\r\n\r\nThis Pull Request adds Travis-CI support in GitLab CI. Most of the features already work: build matrices, languages, OSes. In order to test these changes at least this PR is required: https://github.com/gitlabhq/gitlab-ci-runner/pull/99. It uses Travis-CI libraries: https://github.com/travis-ci/travis-build and https://github.com/travis-ci/travis-yaml to create build matrix and generate shell script. Travis images can be built using https://github.com/travis-ci/travis-images or using my script: https://github.com/ayufan/travis-images/blob/master/build_docker_templates.\r\n\r\n- Use Travis::YAML to generate build matrices\r\n- Use Travis::Build to generate build scripts\r\n- Fetch .travis.yml from GitLab repository\r\n- Support for limiting runners with OS and Language support\r\n- Support for runners which can handle only build for project\r\n- Added 'Build Now' view which allows to force build\r\n- When using 'Deploy' in 'Build Now' try to fetch .release.yml first\r\n\r\n","created_at":"2014-08-12T17:01:15Z","updated_at":"2014-10-01T22:24:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c1991718d8983bc2e70e6740bf4cc77628196a9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462/commits","review_comments_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462/comments","review_comment_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/comments/{number}","comments_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues/462/comments","statuses_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/statuses/0e025f843c44a14543a5973f1d332388d1aa8dfe","head":{"label":"ayufan:topic/travis_support","ref":"topic/travis_support","sha":"0e025f843c44a14543a5973f1d332388d1aa8dfe","user":{"login":"ayufan","id":2419009,"avatar_url":"https://avatars.githubusercontent.com/u/2419009?v=2","gravatar_id":"","url":"https://api.github.com/users/ayufan","html_url":"https://github.com/ayufan","followers_url":"https://api.github.com/users/ayufan/followers","following_url":"https://api.github.com/users/ayufan/following{/other_user}","gists_url":"https://api.github.com/users/ayufan/gists{/gist_id}","starred_url":"https://api.github.com/users/ayufan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayufan/subscriptions","organizations_url":"https://api.github.com/users/ayufan/orgs","repos_url":"https://api.github.com/users/ayufan/repos","events_url":"https://api.github.com/users/ayufan/events{/privacy}","received_events_url":"https://api.github.com/users/ayufan/received_events","type":"User","site_admin":false},"repo":{"id":22503242,"name":"gitlab-ci","full_name":"ayufan/gitlab-ci","owner":{"login":"ayufan","id":2419009,"avatar_url":"https://avatars.githubusercontent.com/u/2419009?v=2","gravatar_id":"","url":"https://api.github.com/users/ayufan","html_url":"https://github.com/ayufan","followers_url":"https://api.github.com/users/ayufan/followers","following_url":"https://api.github.com/users/ayufan/following{/other_user}","gists_url":"https://api.github.com/users/ayufan/gists{/gist_id}","starred_url":"https://api.github.com/users/ayufan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayufan/subscriptions","organizations_url":"https://api.github.com/users/ayufan/orgs","repos_url":"https://api.github.com/users/ayufan/repos","events_url":"https://api.github.com/users/ayufan/events{/privacy}","received_events_url":"https://api.github.com/users/ayufan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ayufan/gitlab-ci","description":"Continuous integration server for gitlabhq | Coordinator","fork":true,"url":"https://api.github.com/repos/ayufan/gitlab-ci","forks_url":"https://api.github.com/repos/ayufan/gitlab-ci/forks","keys_url":"https://api.github.com/repos/ayufan/gitlab-ci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ayufan/gitlab-ci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ayufan/gitlab-ci/teams","hooks_url":"https://api.github.com/repos/ayufan/gitlab-ci/hooks","issue_events_url":"https://api.github.com/repos/ayufan/gitlab-ci/issues/events{/number}","events_url":"https://api.github.com/repos/ayufan/gitlab-ci/events","assignees_url":"https://api.github.com/repos/ayufan/gitlab-ci/assignees{/user}","branches_url":"https://api.github.com/repos/ayufan/gitlab-ci/branches{/branch}","tags_url":"https://api.github.com/repos/ayufan/gitlab-ci/tags","blobs_url":"https://api.github.com/repos/ayufan/gitlab-ci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ayufan/gitlab-ci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ayufan/gitlab-ci/git/refs{/sha}","trees_url":"https://api.github.com/repos/ayufan/gitlab-ci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ayufan/gitlab-ci/statuses/{sha}","languages_url":"https://api.github.com/repos/ayufan/gitlab-ci/languages","stargazers_url":"https://api.github.com/repos/ayufan/gitlab-ci/stargazers","contributors_url":"https://api.github.com/repos/ayufan/gitlab-ci/contributors","subscribers_url":"https://api.github.com/repos/ayufan/gitlab-ci/subscribers","subscription_url":"https://api.github.com/repos/ayufan/gitlab-ci/subscription","commits_url":"https://api.github.com/repos/ayufan/gitlab-ci/commits{/sha}","git_commits_url":"https://api.github.com/repos/ayufan/gitlab-ci/git/commits{/sha}","comments_url":"https://api.github.com/repos/ayufan/gitlab-ci/comments{/number}","issue_comment_url":"https://api.github.com/repos/ayufan/gitlab-ci/issues/comments/{number}","contents_url":"https://api.github.com/repos/ayufan/gitlab-ci/contents/{+path}","compare_url":"https://api.github.com/repos/ayufan/gitlab-ci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ayufan/gitlab-ci/merges","archive_url":"https://api.github.com/repos/ayufan/gitlab-ci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ayufan/gitlab-ci/downloads","issues_url":"https://api.github.com/repos/ayufan/gitlab-ci/issues{/number}","pulls_url":"https://api.github.com/repos/ayufan/gitlab-ci/pulls{/number}","milestones_url":"https://api.github.com/repos/ayufan/gitlab-ci/milestones{/number}","notifications_url":"https://api.github.com/repos/ayufan/gitlab-ci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ayufan/gitlab-ci/labels{/name}","releases_url":"https://api.github.com/repos/ayufan/gitlab-ci/releases{/id}","created_at":"2014-08-01T09:24:50Z","updated_at":"2014-08-01T09:27:07Z","pushed_at":"2014-10-01T22:24:05Z","git_url":"git://github.com/ayufan/gitlab-ci.git","ssh_url":"git@github.com:ayufan/gitlab-ci.git","clone_url":"https://github.com/ayufan/gitlab-ci.git","svn_url":"https://github.com/ayufan/gitlab-ci","homepage":"https://www.gitlab.com/gitlab-ci/","size":2726,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gitlabhq:master","ref":"master","sha":"1db1755b3b3e38abae4408383dab9b5be127b851","user":{"login":"gitlabhq","id":1086321,"avatar_url":"https://avatars.githubusercontent.com/u/1086321?v=2","gravatar_id":"","url":"https://api.github.com/users/gitlabhq","html_url":"https://github.com/gitlabhq","followers_url":"https://api.github.com/users/gitlabhq/followers","following_url":"https://api.github.com/users/gitlabhq/following{/other_user}","gists_url":"https://api.github.com/users/gitlabhq/gists{/gist_id}","starred_url":"https://api.github.com/users/gitlabhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitlabhq/subscriptions","organizations_url":"https://api.github.com/users/gitlabhq/orgs","repos_url":"https://api.github.com/users/gitlabhq/repos","events_url":"https://api.github.com/users/gitlabhq/events{/privacy}","received_events_url":"https://api.github.com/users/gitlabhq/received_events","type":"Organization","site_admin":false},"repo":{"id":6154653,"name":"gitlab-ci","full_name":"gitlabhq/gitlab-ci","owner":{"login":"gitlabhq","id":1086321,"avatar_url":"https://avatars.githubusercontent.com/u/1086321?v=2","gravatar_id":"","url":"https://api.github.com/users/gitlabhq","html_url":"https://github.com/gitlabhq","followers_url":"https://api.github.com/users/gitlabhq/followers","following_url":"https://api.github.com/users/gitlabhq/following{/other_user}","gists_url":"https://api.github.com/users/gitlabhq/gists{/gist_id}","starred_url":"https://api.github.com/users/gitlabhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitlabhq/subscriptions","organizations_url":"https://api.github.com/users/gitlabhq/orgs","repos_url":"https://api.github.com/users/gitlabhq/repos","events_url":"https://api.github.com/users/gitlabhq/events{/privacy}","received_events_url":"https://api.github.com/users/gitlabhq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gitlabhq/gitlab-ci","description":"Continuous integration server for gitlabhq | Coordinator","fork":false,"url":"https://api.github.com/repos/gitlabhq/gitlab-ci","forks_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/forks","keys_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/teams","hooks_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/hooks","issue_events_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues/events{/number}","events_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/events","assignees_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/assignees{/user}","branches_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/branches{/branch}","tags_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/tags","blobs_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/git/refs{/sha}","trees_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/statuses/{sha}","languages_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/languages","stargazers_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/stargazers","contributors_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/contributors","subscribers_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/subscribers","subscription_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/subscription","commits_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/commits{/sha}","git_commits_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/git/commits{/sha}","comments_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/comments{/number}","issue_comment_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues/comments/{number}","contents_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/contents/{+path}","compare_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/merges","archive_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/downloads","issues_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues{/number}","pulls_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls{/number}","milestones_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/milestones{/number}","notifications_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/labels{/name}","releases_url":"https://api.github.com/repos/gitlabhq/gitlab-ci/releases{/id}","created_at":"2012-10-10T09:00:53Z","updated_at":"2014-09-29T14:58:16Z","pushed_at":"2014-10-01T15:07:11Z","git_url":"git://github.com/gitlabhq/gitlab-ci.git","ssh_url":"git@github.com:gitlabhq/gitlab-ci.git","clone_url":"https://github.com/gitlabhq/gitlab-ci.git","svn_url":"https://github.com/gitlabhq/gitlab-ci","homepage":"https://www.gitlab.com/gitlab-ci/","size":6327,"stargazers_count":1175,"watchers_count":1175,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":285,"mirror_url":null,"open_issues_count":114,"forks":285,"open_issues":114,"watchers":1175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462"},"html":{"href":"https://github.com/gitlabhq/gitlab-ci/pull/462"},"issue":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues/462"},"comments":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/issues/462/comments"},"review_comments":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462/comments"},"review_comment":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/pulls/462/commits"},"statuses":{"href":"https://api.github.com/repos/gitlabhq/gitlab-ci/statuses/0e025f843c44a14543a5973f1d332388d1aa8dfe"}}}}