Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
f7bf892c
Commit
f7bf892c
authored
Nov 18, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "gitlab shell works if multiple rubies installed"
This reverts commit
533f4cdf
.
parent
cfee95d0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
98 deletions
+40
-98
GITLAB_SHELL_VERSION
GITLAB_SHELL_VERSION
+1
-1
config/application.rb
config/application.rb
+0
-2
config/gitlab.yml.example
config/gitlab.yml.example
+1
-1
config/initializers/gitlab_shell_secret_token.rb
config/initializers/gitlab_shell_secret_token.rb
+19
-1
features/project/forked_merge_requests.feature
features/project/forked_merge_requests.feature
+14
-12
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+0
-21
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+3
-9
spec/support/test_env.rb
spec/support/test_env.rb
+2
-51
No files found.
GITLAB_SHELL_VERSION
View file @
f7bf892c
2.
3
.0
2.
2
.0
config/application.rb
View file @
f7bf892c
...
...
@@ -92,7 +92,5 @@ module Gitlab
redis_config_hash
[
:namespace
]
=
'cache:gitlab'
config
.
cache_store
=
:redis_store
,
redis_config_hash
ENV
[
'GITLAB_PATH_OUTSIDE_HOOK'
]
=
ENV
[
'PATH'
]
end
end
config/gitlab.yml.example
View file @
f7bf892c
...
...
@@ -307,7 +307,7 @@ test:
enabled: true
gitlab:
host: localhost
port:
3001
port:
80
# When you run tests we clone and setup gitlab-shell
# In order to setup it correctly you need to specify
...
...
config/initializers/gitlab_shell_secret_token.rb
View file @
f7bf892c
Gitlab
::
Shell
.
setup_secret_token
# Be sure to restart your server when you modify this file.
require
'securerandom'
# Your secret key for verifying the gitlab_shell.
secret_file
=
Rails
.
root
.
join
(
'.gitlab_shell_secret'
)
gitlab_shell_symlink
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
path
,
'.gitlab_shell_secret'
)
unless
File
.
exist?
secret_file
# Generate a new token of 16 random hexadecimal characters and store it in secret_file.
token
=
SecureRandom
.
hex
(
16
)
File
.
write
(
secret_file
,
token
)
end
if
File
.
exist?
(
Gitlab
.
config
.
gitlab_shell
.
path
)
&&
!
File
.
exist?
(
gitlab_shell_symlink
)
FileUtils
.
symlink
(
secret_file
,
gitlab_shell_symlink
)
end
\ No newline at end of file
features/project/forked_merge_requests.feature
View file @
f7bf892c
...
...
@@ -11,18 +11,20 @@ Feature: Project Forked Merge Requests
And
I submit the merge request
Then
I should see merge request
"Merge Request On Forked Project"
@javascript
Scenario
:
I
can edit a forked merge request
Given
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
And
I fill out a
"Merge Request On Forked Project"
merge request
And
I submit the merge request
And
I should see merge request
"Merge Request On Forked Project"
And
I click link edit
"Merge Request On Forked Project"
Then
I see the edit page prefilled for
"Merge Request On Forked Project"
And
I update the merge request title
And
I save the merge request
Then
I should see the edited merge request
# TODO: Improve it so it does not fail randomly
#
#@javascript
#Scenario: I can edit a forked merge request
#Given I visit project "Forked Shop" merge requests page
#And I click link "New Merge Request"
#And I fill out a "Merge Request On Forked Project" merge request
#And I submit the merge request
#And I should see merge request "Merge Request On Forked Project"
#And I click link edit "Merge Request On Forked Project"
#Then I see the edit page prefilled for "Merge Request On Forked Project"
#And I update the merge request title
#And I save the merge request
#Then I should see the edited merge request
@javascript
Scenario
:
I
cannot submit an invalid merge request
...
...
lib/gitlab/backend/shell.rb
View file @
f7bf892c
require
'securerandom'
module
Gitlab
class
Shell
class
AccessDenied
<
StandardError
;
end
...
...
@@ -15,25 +13,6 @@ module Gitlab
@version_required
||=
File
.
read
(
Rails
.
root
.
join
(
'GITLAB_SHELL_VERSION'
)).
strip
end
# Be sure to restart your server when you modify this method.
def
setup_secret_token
secret_file
=
Rails
.
root
.
join
(
'.gitlab_shell_secret'
)
gitlab_shell_symlink
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
path
,
'.gitlab_shell_secret'
)
unless
File
.
exist?
secret_file
# Generate a new token of 16 random hexadecimal characters
# and store it in secret_file.
token
=
SecureRandom
.
hex
(
16
)
File
.
write
(
secret_file
,
token
)
end
if
File
.
exist?
(
Gitlab
.
config
.
gitlab_shell
.
path
)
&&
!
File
.
exist?
(
gitlab_shell_symlink
)
FileUtils
.
symlink
(
secret_file
,
gitlab_shell_symlink
)
end
end
end
# Init new repository
...
...
lib/tasks/gitlab/shell.rake
View file @
f7bf892c
...
...
@@ -22,14 +22,10 @@ namespace :gitlab do
# Make sure we're on the right tag
Dir
.
chdir
(
target_dir
)
do
# Allows to change the origin URL to the fork
# when developing gitlab-shell.
sh
(
*
%W(git remote set-url origin
#{
args
.
repo
}
)
)
# First try to checkout without fetching
# to avoid stalling tests if the Internet is down.
reset
=
"
(rev=
\"
$(git describe
#{
args
.
tag
}
|| git describe
\"
origin/
#{
args
.
tag
}
\"
)
\"
&& git reset --hard
\"
$rev
\"
)"
sh
"
#{
reset
}
||
(git fetch --tags origin &&
#{
reset
}
)
"
reset
=
"
git reset --hard $(git describe
#{
args
.
tag
}
|| git describe origin/
#{
args
.
tag
}
)"
sh
"
#{
reset
}
||
git fetch origin &&
#{
reset
}
"
config
=
{
user:
user
,
...
...
@@ -41,7 +37,7 @@ namespace :gitlab do
bin:
%x{which redis-cli}
.
chomp
,
namespace:
"resque:gitlab"
}.
stringify_keys
,
log_level:
Rails
.
env
.
test?
?
'DEBUG'
:
'INFO'
,
log_level:
"INFO"
,
audit_usernames:
false
}.
stringify_keys
...
...
@@ -70,8 +66,6 @@ namespace :gitlab do
File
.
open
(
File
.
join
(
home_dir
,
".ssh"
,
"environment"
),
"w+"
)
do
|
f
|
f
.
puts
"PATH=
#{
ENV
[
'PATH'
]
}
"
end
Gitlab
::
Shell
.
setup_secret_token
end
desc
"GITLAB | Setup gitlab-shell"
...
...
spec/support/test_env.rb
View file @
f7bf892c
require
'rspec/mocks'
require
'webrick'
module
TestEnv
extend
self
...
...
@@ -25,6 +24,8 @@ module TestEnv
disable_mailer
if
opts
[
:mailer
]
==
false
# Clean /tmp/tests
tmp_test_path
=
Rails
.
root
.
join
(
'tmp'
,
'tests'
)
if
File
.
directory?
(
tmp_test_path
)
Dir
.
entries
(
tmp_test_path
).
each
do
|
entry
|
unless
[
'.'
,
'..'
,
'gitlab-shell'
,
factory_repo_name
].
include?
(
entry
)
...
...
@@ -38,8 +39,6 @@ module TestEnv
# Setup GitLab shell for test instance
setup_gitlab_shell
setup_internal_api_mock
# Create repository for FactoryGirl.create(:project)
setup_factory_repo
end
...
...
@@ -109,52 +108,4 @@ module TestEnv
def
factory_repo_name
'gitlab-test'
end
def
tmp_test_path
Rails
.
root
.
join
(
'tmp'
,
'tests'
)
end
def
internal_api_mock_pid_path
File
.
join
(
tmp_test_path
,
'internal_api_mock.pid'
)
end
# This mock server exists because during testing GitLab is not served
# on any port, but gitlab-shell needs to ask the GitLab internal API
# if it is OK to push to repositories. This can happen during blob web
# edit tests. The server always replies yes: this should not modify affect
# web interface tests.
def
setup_internal_api_mock
begin
server
=
WEBrick
::
HTTPServer
.
new
(
BindAddress
:
'0.0.0.0'
,
Port
:
Gitlab
.
config
.
gitlab
.
port
,
AccessLog
:
[],
Logger
:
WEBrick
::
Log
.
new
(
'/dev/null'
)
)
rescue
=>
ex
ex
.
message
.
prepend
(
'could not start mock server on configured port. '
)
raise
ex
end
fork
do
trap
(
:INT
)
{
server
.
shutdown
}
server
.
mount_proc
(
'/'
)
do
|
_req
,
res
|
res
.
status
=
200
res
.
body
=
'true'
end
WEBrick
::
Daemon
.
start
do
File
.
write
(
internal_api_mock_pid_path
,
Process
.
pid
)
end
server
.
start
end
# Ideally this should be called from `config.after(:suite)`,
# but on Spinach when user hits Ctrl+C the server does not get killed
# if the hook is set up with `Spinach.hooks.after_run`.
at_exit
do
# The file should exist on normal operation,
# but certain errors can lead to it not existing.
if
File
.
exists?
(
internal_api_mock_pid_path
)
Process
.
kill
(
:INT
,
File
.
read
(
internal_api_mock_pid_path
).
to_i
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment