しばらく私のGitLabインスタンスからウェブフックを実行できませんでした。最初はGitLab upgrade〜10.0リリースやiptablesに関連するものだと思っていましたが、今では、Rubyのように、Shippableエンドポイントが呼び出される方法と一緒にRubyのものが増えると思います。失敗した要求のサイトでRubyがShippable webhookエンドポイントを呼び出せません
私は、次の情報を見ることができます:失敗の
- 理由は
execution expired
- URLが
https://[username:password]@api.shippable.com/projects/[project id]/newBuild
です - それは、プロジェクト - X-Gitlab・イベントのタイプを有効に自動的に出荷可能で生成されています
Push Hook
- リクエストボディのJSONもあります。
まず、私は実際に私はそれがiptablesのの問題ではないと思わ作ら
curl --verbose -X POST -H "Content-Type: application/json" -H "X-Gitlab-Event: $event" --data "$json" $url
リクエストが成功したサーバーからの出荷可能と接続することができます枯れをテストした(ただし、私がチェックしていない、何のiptablesのルールが設定されていません) 。
は、その後、私は/opt/gitlab/embedded/bin/irb
内でその要求を再作成しようとした。興味深いことに同じようなことが私のローカルマシン上で起こる
Net::OpenTimeout: execution expired
from /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:880:in `initialize'
from /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:880:in `open'
from /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:880:in `block in connect'
from /opt/gitlab/embedded/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
from /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:878:in `connect'
from /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
from /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:852:in `start'
from (irb):142
from embedded/bin/irb:11:in `<main>'
:カールは、Rubyながら成功
require 'net/http'
require 'net/https'
uri = URI.parse(url)
username = uri.userinfo.split(':')[0]
password = uri.userinfo.split(':')[1]
req = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json', 'X-Gitlab-Event' => event})
req.basic_auth username, password
req.body = json
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
response = http.start { |http| http.request(req) }
そして、それはでちょうどGitLabのように失敗しましたスロー。
さらに、基本認証、SSL、POSTの問題ではないことを確認しました.Shippable webhookエンドポイントと同じ方法でBitbucketのスニペットをサーバーのirbから正常にPOSTしました。私は実際には同じリクエスト形式でShockableリクエストを私の模擬サーバーに投稿しました。
この時点で私はそのような動作の原因となる可能性があり、それをさらにデバッグする方法が不思議です。私が見つけた唯一の2つの要因は、すべての失敗したケースで一定であったということです。目標(出荷可能なURI)とクライアント(RubyのNet :: HTTP)です。あなたが私にチェックするよう他に何を提案しますか?