This commit is contained in:
parent
0434f75660
commit
b8590f3871
|
@ -388,6 +388,14 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def che_request
|
||||
begin
|
||||
send_to_che
|
||||
rescue Exception => e
|
||||
raise(e.backtrace.join("\n"))
|
||||
end
|
||||
end
|
||||
|
||||
def settings
|
||||
# 顶部导航
|
||||
@project_menu_type = 10
|
||||
|
|
|
@ -487,14 +487,6 @@ update
|
|||
redirect_to :controller => 'repositories', :action => 'show', :id => @project.id, to: 'gitlab'
|
||||
end
|
||||
|
||||
def che_request
|
||||
begin
|
||||
send_to_che
|
||||
rescue Exception => e
|
||||
raise(e.backtrace.join("\n"))
|
||||
end
|
||||
end
|
||||
|
||||
# 权限:
|
||||
# 如果项目隐藏了版本库,则非项目成员及项目报告人员不能够访问版本库
|
||||
# 如果没有隐藏版本库,只要项目公开,其它成员都可以看到版本库
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
include AvatarHelper
|
||||
include StudentWorkHelper
|
||||
include ApiHelper
|
||||
|
@ -549,4 +553,122 @@ module ProjectsHelper
|
|||
end
|
||||
result
|
||||
end
|
||||
|
||||
def send_to_che()
|
||||
#发送地址
|
||||
send_che_uri = URI.parse('http://106.75.119.131:8080')
|
||||
|
||||
params = {
|
||||
"attributes": {
|
||||
},
|
||||
"description": "string",
|
||||
"environments": {
|
||||
"default": {
|
||||
"recipe": {
|
||||
"type": "dockerimage",
|
||||
"content": "eclipse/ubuntu_jdk8"
|
||||
},
|
||||
"machines": {
|
||||
"dev-machine": {
|
||||
"env": {},
|
||||
"servers": {
|
||||
"tomcat8-debug": {
|
||||
"attributes": {},
|
||||
"protocol": "http",
|
||||
"port": "8000"
|
||||
},
|
||||
"codeserver": {
|
||||
"attributes": {},
|
||||
"protocol": "http",
|
||||
"port": "9876"
|
||||
},
|
||||
"tomcat8": {
|
||||
"attributes": {},
|
||||
"protocol": "http",
|
||||
"port": "8080"
|
||||
}
|
||||
},
|
||||
"installers": [
|
||||
"org.eclipse.che.exec",
|
||||
"org.eclipse.che.terminal",
|
||||
"org.eclipse.che.ws-agent",
|
||||
"org.eclipse.che.ls.java"
|
||||
],
|
||||
"volumes": {
|
||||
"m2": {
|
||||
"path": "/home/user/.m2"
|
||||
},
|
||||
"javadata": {
|
||||
"path": "/home/user/jdtls/data"
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"memoryLimitBytes": "2147483648"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"projects": [
|
||||
{
|
||||
"source": {
|
||||
"location": "https://github.com/looly/hutool.git",
|
||||
"type": "git",
|
||||
"parameters": {}
|
||||
},
|
||||
"links": [],
|
||||
"problems": [],
|
||||
"mixins": [
|
||||
"pullrequest"
|
||||
],
|
||||
"name": "hutool",
|
||||
"type": "blank",
|
||||
"path": "/hutool",
|
||||
"attributes": {
|
||||
"contribute_to_branch": [
|
||||
"v4-master"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"commandLine": "mvn clean install -f ${current.project.path}",
|
||||
"name": "build",
|
||||
"attributes": {
|
||||
"goal": "Build",
|
||||
"previewUrl": ""
|
||||
},
|
||||
"type": "mvn"
|
||||
},
|
||||
{
|
||||
"commandLine": "echo \"hello\"",
|
||||
"name": "newCustom",
|
||||
"attributes": {
|
||||
"goal": "Run",
|
||||
"previewUrl": ""
|
||||
},
|
||||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"defaultEnv": "default",
|
||||
"name": "create-from-api",
|
||||
"links": []
|
||||
}
|
||||
|
||||
http = Net::HTTP.new(send_che_uri.host, send_che_uri.port)
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
http.use_ssl = true
|
||||
begin
|
||||
Rails.logger.info("#############info: #{send_che_uri.request_uri}")
|
||||
request = Net::HTTP::Post.new(send_che_uri.request_uri)
|
||||
request.set_form_data(params)
|
||||
request['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'
|
||||
response = http.start { |http| http.request(request) }
|
||||
ActiveSupport::JSON.decode(response.body)
|
||||
rescue =>err
|
||||
Rails.logger.error("#############sendYunpian_error: #{err.message}")
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
module RepositoriesHelper
|
||||
if Rails.env.development?
|
||||
ROOT_PATH="/private/tmp/"
|
||||
|
@ -412,124 +408,6 @@ module RepositoriesHelper
|
|||
end
|
||||
max_space
|
||||
end
|
||||
|
||||
def send_to_che()
|
||||
#发送地址
|
||||
send_che_uri = URI.parse('http://106.75.119.131:8080')
|
||||
|
||||
params = {
|
||||
"attributes": {
|
||||
},
|
||||
"description": "string",
|
||||
"environments": {
|
||||
"default": {
|
||||
"recipe": {
|
||||
"type": "dockerimage",
|
||||
"content": "eclipse/ubuntu_jdk8"
|
||||
},
|
||||
"machines": {
|
||||
"dev-machine": {
|
||||
"env": {},
|
||||
"servers": {
|
||||
"tomcat8-debug": {
|
||||
"attributes": {},
|
||||
"protocol": "http",
|
||||
"port": "8000"
|
||||
},
|
||||
"codeserver": {
|
||||
"attributes": {},
|
||||
"protocol": "http",
|
||||
"port": "9876"
|
||||
},
|
||||
"tomcat8": {
|
||||
"attributes": {},
|
||||
"protocol": "http",
|
||||
"port": "8080"
|
||||
}
|
||||
},
|
||||
"installers": [
|
||||
"org.eclipse.che.exec",
|
||||
"org.eclipse.che.terminal",
|
||||
"org.eclipse.che.ws-agent",
|
||||
"org.eclipse.che.ls.java"
|
||||
],
|
||||
"volumes": {
|
||||
"m2": {
|
||||
"path": "/home/user/.m2"
|
||||
},
|
||||
"javadata": {
|
||||
"path": "/home/user/jdtls/data"
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"memoryLimitBytes": "2147483648"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"projects": [
|
||||
{
|
||||
"source": {
|
||||
"location": "https://github.com/looly/hutool.git",
|
||||
"type": "git",
|
||||
"parameters": {}
|
||||
},
|
||||
"links": [],
|
||||
"problems": [],
|
||||
"mixins": [
|
||||
"pullrequest"
|
||||
],
|
||||
"name": "hutool",
|
||||
"type": "blank",
|
||||
"path": "/hutool",
|
||||
"attributes": {
|
||||
"contribute_to_branch": [
|
||||
"v4-master"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"commandLine": "mvn clean install -f ${current.project.path}",
|
||||
"name": "build",
|
||||
"attributes": {
|
||||
"goal": "Build",
|
||||
"previewUrl": ""
|
||||
},
|
||||
"type": "mvn"
|
||||
},
|
||||
{
|
||||
"commandLine": "echo \"hello\"",
|
||||
"name": "newCustom",
|
||||
"attributes": {
|
||||
"goal": "Run",
|
||||
"previewUrl": ""
|
||||
},
|
||||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"defaultEnv": "default",
|
||||
"name": "create-from-api",
|
||||
"links": []
|
||||
}
|
||||
|
||||
http = Net::HTTP.new(send_che_uri.host, send_che_uri.port)
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
http.use_ssl = true
|
||||
begin
|
||||
Rails.logger.info("#############info: #{send_che_uri.request_uri}")
|
||||
request = Net::HTTP::Post.new(send_che_uri.request_uri)
|
||||
request.set_form_data(params)
|
||||
request['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'
|
||||
response = http.start { |http| http.request(request) }
|
||||
ActiveSupport::JSON.decode(response.body)
|
||||
rescue =>err
|
||||
Rails.logger.error("#############sendYunpian_error: #{err.message}")
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<% end %>
|
||||
|
||||
<%# if @project.id == 3993 %>
|
||||
<a href="<%= che_request_project_repositories_path(@project) %>" data-remote="true" class="btn_zipdown fl ml10">CHE环境</a>
|
||||
<a href="<%= che_request_project_path(@project) %>" data-remote="true" class="btn_zipdown fl ml10">CHE环境</a>
|
||||
<%# end %>
|
||||
|
||||
<div class="fr ">
|
||||
|
|
|
@ -964,6 +964,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'search_public_orgs_not_in_project'
|
||||
match 'copy', :via => [:get, :post]
|
||||
match 'set_public_or_private', :via => [:post]
|
||||
get 'che_request'
|
||||
end
|
||||
|
||||
collection do
|
||||
|
@ -1092,9 +1093,6 @@ RedmineApp::Application.routes.draw do
|
|||
put 'to_gitlab'
|
||||
# get 'create', :via=>[:get, :post]
|
||||
end
|
||||
collection do
|
||||
get 'che_request'
|
||||
end
|
||||
end
|
||||
|
||||
match 'wiki/index', :via => :get
|
||||
|
|
Loading…
Reference in New Issue