FIX 测试giteawebhook

This commit is contained in:
Jasder 2020-07-21 12:35:26 +08:00
parent 5fcb4a5500
commit 15fc5de3de
4 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,6 @@
class ::DevOps::BuildsController < ApplicationController
before_action :require_login
before_action :find_repo
before_action :require_login, except: :test_webhook
before_action :find_repo, except: :test_webhook
def index
cloud_account = @repo.dev_ops_cloud_account
@ -36,6 +36,11 @@ class ::DevOps::BuildsController < ApplicationController
render json: result
end
def test_webhook
logger.info "==============已经回调成功了....."
render_ok
end
private
def find_repo
@repo = ::Repository.find params[:id]

View File

@ -1,9 +1,9 @@
class DevOps::CreateCloudAccountForm
include ActiveModel::Model
attr_accessor :project_id, :ip_num, :account, :secret
attr_accessor :repo_id, :ip_num, :account, :secret
validates :project_id, :account, :secret, presence: true
validates :repo_id, :account, :secret, presence: true
validates :ip_num, presence: true, format: { with: CustomRegexp::IP, multiline: true, message: 'IP 地址格式不对' }
end

View File

@ -14,7 +14,7 @@ class DevOps::Drone::Client
def run
`docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DRONE_RPC_SERVER=drone-server-#{client_id}:9000 \
-e DRONE_PRC_HOST=drone-server-#{client_id}:9000 \
-e DRONE_RPC_SECRET=#{rpc_secret} \
-e DRONE_RUNNER_NAME=#{drone_ip} \
--restart always \
@ -27,7 +27,7 @@ class DevOps::Drone::Client
def generate_cmd
"docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DRONE_RPC_SERVER=drone-server-#{client_id}:9000 \
-e DRONE_PRC_HOST=#{drone_ip}-#{client_id}:9000 \
-e DRONE_RPC_SECRET=#{rpc_secret} \
-e DRONE_RUNNER_NAME=#{drone_ip} \
--restart always \

View File

@ -28,6 +28,7 @@ Rails.application.routes.draw do
post ':number', to: 'builds#restart', as: 'restart'
delete ':number', to: 'builds#delete', as: 'delete'
get ':number/logs/:stage/:step', to: 'builds#detail', as: 'logs'
post 'test_webhook', to: 'builds#test_webhook', as: 'test_webhook'
end
end
end