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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
98b54d27
Commit
98b54d27
authored
Mar 07, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into 5029-support-cluster-metrics
parents
cac6a6d9
674be13f
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
207 additions
and
227 deletions
+207
-227
.gitlab-ci.yml
.gitlab-ci.yml
+114
-131
app/assets/javascripts/commons/vue.js
app/assets/javascripts/commons/vue.js
+1
-0
app/models/concerns/deployment_platform.rb
app/models/concerns/deployment_platform.rb
+1
-0
app/models/environment.rb
app/models/environment.rb
+4
-4
app/models/repository.rb
app/models/repository.rb
+4
-4
app/views/groups/issues.html.haml
app/views/groups/issues.html.haml
+0
-3
app/views/projects/cycle_analytics/show.html.haml
app/views/projects/cycle_analytics/show.html.haml
+0
-2
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+0
-3
app/views/projects/environments/index.html.haml
app/views/projects/environments/index.html.haml
+0
-3
app/views/projects/issues/index.html.haml
app/views/projects/issues/index.html.haml
+0
-3
app/views/projects/merge_requests/index.html.haml
app/views/projects/merge_requests/index.html.haml
+0
-3
app/views/projects/pipelines/show.html.haml
app/views/projects/pipelines/show.html.haml
+0
-3
app/views/projects/registry/repositories/index.html.haml
app/views/projects/registry/repositories/index.html.haml
+0
-2
app/views/projects/settings/repository/show.html.haml
app/views/projects/settings/repository/show.html.haml
+0
-3
app/views/shared/boards/_show.html.haml
app/views/shared/boards/_show.html.haml
+0
-1
config/webpack.config.js
config/webpack.config.js
+0
-2
doc/administration/geo/disaster_recovery/bring_primary_back.md
...dministration/geo/disaster_recovery/bring_primary_back.md
+13
-7
ee/app/models/concerns/ee/deployment_platform.rb
ee/app/models/concerns/ee/deployment_platform.rb
+3
-0
ee/app/views/admin/geo_nodes/index.html.haml
ee/app/views/admin/geo_nodes/index.html.haml
+0
-2
ee/app/views/groups/epics/show.html.haml
ee/app/views/groups/epics/show.html.haml
+0
-3
ee/app/views/groups/roadmap/show.html.haml
ee/app/views/groups/roadmap/show.html.haml
+0
-2
ee/app/views/ide/index.html.haml
ee/app/views/ide/index.html.haml
+0
-1
ee/app/views/shared/empty_states/_epics.html.haml
ee/app/views/shared/empty_states/_epics.html.haml
+0
-2
ee/app/views/shared/empty_states/_roadmap.html.haml
ee/app/views/shared/empty_states/_roadmap.html.haml
+0
-2
lib/gitlab/git/gitlab_projects.rb
lib/gitlab/git/gitlab_projects.rb
+3
-2
lib/gitlab/gitaly_client/repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+2
-2
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+5
-5
lib/gitlab/utils.rb
lib/gitlab/utils.rb
+0
-8
spec/javascripts/environments/environments_app_spec.js
spec/javascripts/environments/environments_app_spec.js
+8
-7
spec/lib/gitlab/git/gitlab_projects_spec.rb
spec/lib/gitlab/git/gitlab_projects_spec.rb
+16
-4
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
+14
-0
spec/lib/gitlab/shell_spec.rb
spec/lib/gitlab/shell_spec.rb
+19
-13
No files found.
.gitlab-ci.yml
View file @
98b54d27
This diff is collapsed.
Click to expand it.
app/assets/javascripts/commons/vue.js
View file @
98b54d27
import
Vue
from
'
vue
'
;
import
'
../vue_shared/vue_resource_interceptor
'
;
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
Vue
.
config
.
productionTip
=
false
;
...
...
app/models/concerns/deployment_platform.rb
View file @
98b54d27
module
DeploymentPlatform
# EE would override this and utilize the extra argument
def
deployment_platform
(
environment:
nil
)
@deployment_platform
||=
find_cluster_platform_kubernetes
||
...
...
app/models/environment.rb
View file @
98b54d27
...
...
@@ -137,10 +137,6 @@ class Environment < ActiveRecord::Base
end
end
def
deployment_platform
project
.
deployment_platform
(
environment:
self
)
end
def
has_terminals?
deployment_platform
.
present?
&&
available?
&&
last_deployment
.
present?
end
...
...
@@ -232,6 +228,10 @@ class Environment < ActiveRecord::Base
self
.
environment_type
||
self
.
name
end
def
deployment_platform
project
.
deployment_platform
(
environment:
self
)
end
private
# Slugifying a name may remove the uniqueness guarantee afforded by it being
...
...
app/models/repository.rb
View file @
98b54d27
...
...
@@ -915,20 +915,20 @@ class Repository
raw_repository
.
ancestor?
(
ancestor_id
,
descendant_id
)
end
def
fetch_as_mirror
(
url
,
forced:
false
,
refmap: :all_refs
,
remote_name:
nil
)
def
fetch_as_mirror
(
url
,
forced:
false
,
refmap: :all_refs
,
remote_name:
nil
,
prune:
true
)
unless
remote_name
remote_name
=
"tmp-
#{
SecureRandom
.
hex
}
"
tmp_remote_name
=
true
end
add_remote
(
remote_name
,
url
,
mirror_refmap:
refmap
)
fetch_remote
(
remote_name
,
forced:
forced
)
fetch_remote
(
remote_name
,
forced:
forced
,
prune:
prune
)
ensure
async_remove_remote
(
remote_name
)
if
tmp_remote_name
end
def
fetch_remote
(
remote
,
forced:
false
,
ssh_auth:
nil
,
no_tags:
false
)
gitlab_shell
.
fetch_remote
(
raw_repository
,
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
)
def
fetch_remote
(
remote
,
forced:
false
,
ssh_auth:
nil
,
no_tags:
false
,
prune:
true
)
gitlab_shell
.
fetch_remote
(
raw_repository
,
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
,
prune:
prune
)
end
def
async_remove_remote
(
remote_name
)
...
...
app/views/groups/issues.html.haml
View file @
98b54d27
...
...
@@ -2,9 +2,6 @@
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
params
.
merge
(
rss_url_options
),
title:
"
#{
@group
.
name
}
issues"
)
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
-
if
group_issues_count
(
state:
'all'
).
zero?
=
render
'shared/empty_states/issues'
,
project_select_button:
true
-
else
...
...
app/views/projects/cycle_analytics/show.html.haml
View file @
98b54d27
-
@no_container
=
true
-
page_title
"Cycle Analytics"
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'common_vue'
)
#cycle-analytics
{
class:
container_class
,
"v-cloak"
=>
"true"
,
data:
{
request_path:
project_cycle_analytics_path
(
@project
)
}
}
-
if
@cycle_analytics_no_data
...
...
app/views/projects/edit.html.haml
View file @
98b54d27
...
...
@@ -3,9 +3,6 @@
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
expanded
=
Rails
.
env
.
test?
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'common_vue'
)
.project-edit-container
%section
.settings.general-settings.no-animate
{
class:
(
'expanded'
if
expanded
)
}
.settings-header
...
...
app/views/projects/environments/index.html.haml
View file @
98b54d27
...
...
@@ -2,9 +2,6 @@
-
page_title
"Environments"
-
add_to_breadcrumbs
(
"Pipelines"
,
project_pipelines_path
(
@project
))
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
"common_vue"
)
#environments-list-view
{
data:
{
environments_data:
environments_list_data
,
"can-create-deployment"
=>
can?
(
current_user
,
:create_deployment
,
@project
).
to_s
,
"can-read-environment"
=>
can?
(
current_user
,
:read_environment
,
@project
).
to_s
,
...
...
app/views/projects/issues/index.html.haml
View file @
98b54d27
...
...
@@ -4,9 +4,6 @@
-
page_title
"Issues"
-
new_issue_email
=
@project
.
new_issuable_address
(
current_user
,
'issue'
)
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
params
.
merge
(
rss_url_options
),
title:
"
#{
@project
.
name
}
issues"
)
...
...
app/views/projects/merge_requests/index.html.haml
View file @
98b54d27
...
...
@@ -6,9 +6,6 @@
-
page_title
"Merge Requests"
-
new_merge_request_email
=
@project
.
new_issuable_address
(
current_user
,
'merge_request'
)
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
%div
{
class:
container_class
}
=
render
'projects/last_push'
...
...
app/views/projects/pipelines/show.html.haml
View file @
98b54d27
...
...
@@ -10,6 +10,3 @@
=
render
"projects/pipelines/with_tabs"
,
pipeline:
@pipeline
.js-pipeline-details-vue
{
data:
{
endpoint:
project_pipeline_path
(
@project
,
@pipeline
,
format: :json
)
}
}
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'common_vue'
)
app/views/projects/registry/repositories/index.html.haml
View file @
98b54d27
...
...
@@ -14,8 +14,6 @@
.col-lg-12
#js-vue-registry-images
{
data:
{
endpoint:
project_container_registry_index_path
(
@project
,
format: :json
)
}
}
=
webpack_bundle_tag
(
'common_vue'
)
.row.prepend-top-10
.col-lg-12
.panel.panel-default
...
...
app/views/projects/settings/repository/show.html.haml
View file @
98b54d27
...
...
@@ -2,9 +2,6 @@
-
page_title
"Repository"
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'common_vue'
)
=
render
"projects/push_rules/index"
=
render
"projects/mirrors/show"
...
...
app/views/shared/boards/_show.html.haml
View file @
98b54d27
...
...
@@ -7,7 +7,6 @@
-
page_title
"Boards"
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
-# haml-lint:disable InlineJavaScript
%script
#js-board-template
{
type:
"text/x-template"
}=
render
"shared/boards/components/board"
...
...
config/webpack.config.js
View file @
98b54d27
...
...
@@ -49,8 +49,6 @@ function generateEntries() {
const
manualEntries
=
{
common
:
'
./commons/index.js
'
,
common_vue
:
'
./vue_shared/vue_resource_interceptor.js
'
,
locale
:
'
./locale/index.js
'
,
main
:
'
./main.js
'
,
raven
:
'
./raven/index.js
'
,
webpack_runtime
:
'
./webpack.js
'
,
...
...
doc/administration/geo/disaster_recovery/bring_primary_back.md
View file @
98b54d27
...
...
@@ -6,11 +6,13 @@ restore your original configuration. This process consists of two steps:
1.
Making the old primary a secondary
1.
Promoting a secondary to a primary
> *Warning:* If you have any doubts about the consistency of the data on this node, we recommend to set up it from scratch.
## Configure the former primary to be a secondary
Since the former primary will be out of sync with the current primary, the first step is
to bring the former primary up to date. Note, deletion of data stored on disk like
repositories and uploads will not be replayed when bringing the former primary in back
Since the former primary will be out of sync with the current primary, the first step is
to bring the former primary up to date. Note, deletion of data stored on disk like
repositories and uploads will not be replayed when bringing the former primary in back
into sync, which may result in increased disk usage.
Alternatively, you can
[
setup a new secondary GitLab instance
][
setup-geo
]
to avoid this.
...
...
@@ -23,12 +25,16 @@ To bring the former primary up to date:
sudo gitlab-ctl start
```
NOTE: **Note:** If you [disabled primary permanently][disaster-recovery-disable-primary],
>**Note 1:** If you [disabled primary permanently][disaster-recovery-disable-primary],
you need to undo those steps now. For Debian/Ubuntu you just need to run
`sudo systemctl enable gitlab-runsvdir`. For Cent
o
OS 6, you need to install
`sudo systemctl enable gitlab-runsvdir`. For CentOS 6, you need to install
the GitLab instance from scratch and setup it as a secondary node by
following [Setup instructions][setup-geo].
In this case you don't need to follow the next step.
following [Setup instructions][setup-geo]. In this case you don't need to follow the next step.
>**Note 2:** If you [changed the DNS records](index.md#step-4-optional-updating-the-primary-domains-dns-record)
for this node during disaster recovery procedure you may need to [block
all the writes to this node](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/doc/gitlab-geo/planned-failover.md#block-primary-traffic)
during this procedure.
1.
[
Setup database replication
][
database-replication
]
. Note that in this
case, primary refers to the current primary, and secondary refers to the
...
...
ee/app/models/concerns/ee/deployment_platform.rb
View file @
98b54d27
module
EE
module
DeploymentPlatform
extend
::
Gitlab
::
Utils
::
Override
override
:deployment_platform
def
deployment_platform
(
environment:
nil
)
return
super
unless
environment
&&
feature_available?
(
:multiple_clusters
)
...
...
ee/app/views/admin/geo_nodes/index.html.haml
View file @
98b54d27
-
page_title
'Geo nodes'
-
@content_class
=
"geo-admin-container"
=
webpack_bundle_tag
'common_vue'
%h2
.page-title.clearfix
%span
.title-text.pull-left
=
_
(
"Geo Nodes"
)
=
link_to
s_
(
"GeoNodes|New node"
),
new_admin_geo_node_path
,
class:
'btn btn-create pull-right'
...
...
ee/app/views/groups/epics/show.html.haml
View file @
98b54d27
...
...
@@ -12,7 +12,4 @@
-
page_card_attributes
@epic
.
card_attributes
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
#epic-show-app
{
data:
epic_show_app_data
(
@epic
,
author_icon:
avatar_icon_for_user
(
@epic
.
author
),
initial:
issuable_initial_data
(
@epic
))
}
ee/app/views/groups/roadmap/show.html.haml
View file @
98b54d27
...
...
@@ -5,8 +5,6 @@
-
breadcrumb_title
_
(
"Epics Roadmap"
)
-
if
@epics_count
!=
0
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
#js-roadmap
{
data:
{
epics_path:
group_epics_path
(
@group
,
format: :json
),
group_id:
@group
.
id
,
empty_state_illustration:
image_path
(
'illustrations/epics/roadmap.svg'
)
}
}
-
else
=
render
'shared/empty_states/roadmap'
ee/app/views/ide/index.html.haml
View file @
98b54d27
...
...
@@ -2,7 +2,6 @@
-
page_title
'IDE'
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
=
webpack_bundle_tag
'ide'
,
force_same_domain:
true
#ide
.ide-loading
{
data:
{
"empty-state-svg-path"
=>
image_path
(
'illustrations/multi_file_editor_empty.svg'
),
...
...
ee/app/views/shared/empty_states/_epics.html.haml
View file @
98b54d27
...
...
@@ -9,6 +9,4 @@
%p
=
_
(
'Track groups of issues that share a theme, across projects and milestones'
)
-
if
can?
(
current_user
,
:create_epic
,
@group
)
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
#new-epic-app
{
data:
{
endpoint:
request
.
url
}
}
ee/app/views/shared/empty_states/_roadmap.html.haml
View file @
98b54d27
...
...
@@ -9,8 +9,6 @@
%p
=
_
(
'To view the roadmap, add a planned start or finish date to one of your epics in this group or its subgroups. Only epics in the past 3 months and the next 3 months are shown.'
)
-
if
can?
(
current_user
,
:create_epic
,
@group
)
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
'common_vue'
#new-epic-app
{
data:
{
endpoint:
request
.
url
}
}
=
link_to
group_epics_path
(
@group
),
title:
'List'
,
class:
'btn'
do
%span
=
_
(
'View epics list'
)
lib/gitlab/git/gitlab_projects.rb
View file @
98b54d27
...
...
@@ -63,11 +63,12 @@ module Gitlab
end
end
def
fetch_remote
(
name
,
timeout
,
force
:,
tags
:,
ssh_key:
nil
,
known_hosts:
nil
)
def
fetch_remote
(
name
,
timeout
,
force
:,
tags
:,
ssh_key:
nil
,
known_hosts:
nil
,
prune:
true
)
tags_option
=
tags
?
'--tags'
:
'--no-tags'
logger
.
info
"Fetching remote
#{
name
}
for repository
#{
repository_absolute_path
}
."
cmd
=
%W(git fetch
#{
name
}
--prune --quiet)
cmd
=
%W(git fetch
#{
name
}
--quiet)
cmd
<<
'--prune'
if
prune
cmd
<<
'--force'
if
force
cmd
<<
tags_option
...
...
lib/gitlab/gitaly_client/repository_service.rb
View file @
98b54d27
...
...
@@ -45,10 +45,10 @@ module Gitlab
GitalyClient
.
call
(
@storage
,
:repository_service
,
:apply_gitattributes
,
request
)
end
def
fetch_remote
(
remote
,
ssh_auth
:,
forced
:,
no_tags
:,
timeout
:)
def
fetch_remote
(
remote
,
ssh_auth
:,
forced
:,
no_tags
:,
timeout
:
,
prune:
true
)
request
=
Gitaly
::
FetchRemoteRequest
.
new
(
repository:
@gitaly_repo
,
remote:
remote
,
force:
forced
,
no_tags:
no_tags
,
timeout:
timeout
no_tags:
no_tags
,
timeout:
timeout
,
no_prune:
!
prune
)
if
ssh_auth
&
.
ssh_import?
...
...
lib/gitlab/shell.rb
View file @
98b54d27
...
...
@@ -125,13 +125,13 @@ module Gitlab
# Ex.
# fetch_remote(my_repo, "upstream")
#
def
fetch_remote
(
repository
,
remote
,
ssh_auth:
nil
,
forced:
false
,
no_tags:
false
)
def
fetch_remote
(
repository
,
remote
,
ssh_auth:
nil
,
forced:
false
,
no_tags:
false
,
prune:
true
)
gitaly_migrate
(
:fetch_remote
)
do
|
is_enabled
|
if
is_enabled
repository
.
gitaly_repository_client
.
fetch_remote
(
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
,
timeout:
git_timeout
)
repository
.
gitaly_repository_client
.
fetch_remote
(
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
,
timeout:
git_timeout
,
prune:
prune
)
else
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
repository
.
storage
][
"path"
]
local_fetch_remote
(
storage_path
,
repository
.
relative_path
,
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
)
local_fetch_remote
(
storage_path
,
repository
.
relative_path
,
remote
,
ssh_auth:
ssh_auth
,
forced:
forced
,
no_tags:
no_tags
,
prune:
prune
)
end
end
end
...
...
@@ -428,8 +428,8 @@ module Gitlab
)
end
def
local_fetch_remote
(
storage_path
,
repository_relative_path
,
remote
,
ssh_auth:
nil
,
forced:
false
,
no_tags:
false
)
vars
=
{
force:
forced
,
tags:
!
no_tags
}
def
local_fetch_remote
(
storage_path
,
repository_relative_path
,
remote
,
ssh_auth:
nil
,
forced:
false
,
no_tags:
false
,
prune:
true
)
vars
=
{
force:
forced
,
tags:
!
no_tags
,
prune:
prune
}
if
ssh_auth
&
.
ssh_import?
if
ssh_auth
.
ssh_key_auth?
&&
ssh_auth
.
ssh_private_key
.
present?
...
...
lib/gitlab/utils.rb
View file @
98b54d27
...
...
@@ -68,14 +68,6 @@ module Gitlab
nil
end
# Used in EE
# Accepts either an Array or a String and returns an array
def
ensure_array_from_string
(
string_or_array
)
return
string_or_array
if
string_or_array
.
is_a?
(
Array
)
string_or_array
.
split
(
','
).
map
(
&
:strip
)
end
# EE below
def
try_megabytes_to_bytes
(
size
)
Integer
(
size
).
megabytes
...
...
spec/javascripts/environments/environments_app_spec.js
View file @
98b54d27
...
...
@@ -60,7 +60,8 @@ describe('Environment', () => {
});
});
describe
(
'
with environments
'
,
()
=>
{
describe
(
'
with paginated environments
'
,
()
=>
{
let
backupInterceptors
;
const
environmentsResponseInterceptor
=
(
request
,
next
)
=>
{
next
((
response
)
=>
{
response
.
headers
.
set
(
'
X-nExt-pAge
'
,
'
2
'
);
...
...
@@ -84,16 +85,16 @@ describe('Environment', () => {
};
beforeEach
(()
=>
{
Vue
.
http
.
interceptors
.
push
(
environmentsResponseInterceptor
);
Vue
.
http
.
interceptors
.
push
(
headersInterceptor
);
backupInterceptors
=
Vue
.
http
.
interceptors
;
Vue
.
http
.
interceptors
=
[
environmentsResponseInterceptor
,
headersInterceptor
,
];
component
=
mountComponent
(
EnvironmentsComponent
,
mockData
);
});
afterEach
(()
=>
{
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
environmentsResponseInterceptor
,
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
headersInterceptor
);
Vue
.
http
.
interceptors
=
backupInterceptors
;
});
it
(
'
should render a table with environments
'
,
(
done
)
=>
{
...
...
spec/lib/gitlab/git/gitlab_projects_spec.rb
View file @
98b54d27
...
...
@@ -61,10 +61,11 @@ describe Gitlab::Git::GitlabProjects do
let
(
:remote_name
)
{
'remote-name'
}
let
(
:branch_name
)
{
'master'
}
let
(
:force
)
{
false
}
let
(
:prune
)
{
true
}
let
(
:tags
)
{
true
}
let
(
:args
)
{
{
force:
force
,
tags:
tags
}.
merge
(
extra_args
)
}
let
(
:args
)
{
{
force:
force
,
tags:
tags
,
prune:
prune
}.
merge
(
extra_args
)
}
let
(
:extra_args
)
{
{}
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--
prune --quiet
--tags)
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--
quiet --prune
--tags)
}
subject
{
gl_projects
.
fetch_remote
(
remote_name
,
600
,
args
)
}
...
...
@@ -97,7 +98,7 @@ describe Gitlab::Git::GitlabProjects do
context
'with --force'
do
let
(
:force
)
{
true
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--
prune --quiet
--force --tags)
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--
quiet --prune
--force --tags)
}
it
'executes the command with forced option'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
...
...
@@ -108,7 +109,18 @@ describe Gitlab::Git::GitlabProjects do
context
'with --no-tags'
do
let
(
:tags
)
{
false
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--prune --quiet --no-tags)
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--quiet --prune --no-tags)
}
it
'executes the command'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
is_expected
.
to
be_truthy
end
end
context
'with no prune'
do
let
(
:prune
)
{
false
}
let
(
:cmd
)
{
%W(git fetch
#{
remote_name
}
--quiet --tags)
}
it
'executes the command'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
...
...
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
View file @
98b54d27
...
...
@@ -85,6 +85,20 @@ describe Gitlab::GitalyClient::RepositoryService do
end
end
describe
'#fetch_remote'
do
let
(
:ssh_auth
)
{
double
(
:ssh_auth
,
ssh_import?:
true
,
ssh_key_auth?:
false
,
ssh_known_hosts:
nil
)
}
let
(
:import_url
)
{
'ssh://example.com'
}
it
'sends a fetch_remote_request message'
do
expect_any_instance_of
(
Gitaly
::
RepositoryService
::
Stub
)
.
to
receive
(
:fetch_remote
)
.
with
(
gitaly_request_with_params
(
no_prune:
false
),
kind_of
(
Hash
))
.
and_return
(
double
(
value:
true
))
client
.
fetch_remote
(
import_url
,
ssh_auth:
ssh_auth
,
forced:
false
,
no_tags:
false
,
timeout:
60
)
end
end
describe
'#rebase_in_progress?'
do
let
(
:rebase_id
)
{
1
}
...
...
spec/lib/gitlab/shell_spec.rb
View file @
98b54d27
...
...
@@ -508,8 +508,8 @@ describe Gitlab::Shell do
end
shared_examples
'fetch_remote'
do
|
gitaly_on
|
def
fetch_remote
(
ssh_auth
=
nil
)
gitlab_shell
.
fetch_remote
(
repository
.
raw_repository
,
'remote-name'
,
ssh_auth:
ssh_auth
)
def
fetch_remote
(
ssh_auth
=
nil
,
prune
=
true
)
gitlab_shell
.
fetch_remote
(
repository
.
raw_repository
,
'remote-name'
,
ssh_auth:
ssh_auth
,
prune:
prune
)
end
def
expect_gitlab_projects
(
fail
=
false
,
options
=
{})
...
...
@@ -555,27 +555,33 @@ describe Gitlab::Shell do
end
it
'returns true when the command succeeds'
do
expect_call
(
false
,
force:
false
,
tags:
true
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
)
expect
(
fetch_remote
).
to
be_truthy
end
it
'returns true when the command succeeds'
do
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
false
)
expect
(
fetch_remote
(
nil
,
false
)).
to
be_truthy
end
it
'raises an exception when the command fails'
do
expect_call
(
true
,
force:
false
,
tags:
true
)
expect_call
(
true
,
force:
false
,
tags:
true
,
prune:
true
)
expect
{
fetch_remote
}.
to
raise_error
(
Gitlab
::
Shell
::
Error
)
end
it
'allows forced and no_tags to be changed'
do
expect_call
(
false
,
force:
true
,
tags:
false
)
expect_call
(
false
,
force:
true
,
tags:
false
,
prune:
true
)
result
=
gitlab_shell
.
fetch_remote
(
repository
.
raw_repository
,
'remote-name'
,
forced:
true
,
no_tags:
true
)
result
=
gitlab_shell
.
fetch_remote
(
repository
.
raw_repository
,
'remote-name'
,
forced:
true
,
no_tags:
true
,
prune:
true
)
expect
(
result
).
to
be_truthy
end
context
'SSH auth'
do
it
'passes the SSH key if specified'
do
expect_call
(
false
,
force:
false
,
tags:
true
,
ssh_key:
'foo'
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
,
ssh_key:
'foo'
)
ssh_auth
=
build_ssh_auth
(
ssh_key_auth?:
true
,
ssh_private_key:
'foo'
)
...
...
@@ -583,7 +589,7 @@ describe Gitlab::Shell do
end
it
'does not pass an empty SSH key'
do
expect_call
(
false
,
force:
false
,
tags:
true
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
)
ssh_auth
=
build_ssh_auth
(
ssh_key_auth:
true
,
ssh_private_key:
''
)
...
...
@@ -591,7 +597,7 @@ describe Gitlab::Shell do
end
it
'does not pass the key unless SSH key auth is to be used'
do
expect_call
(
false
,
force:
false
,
tags:
true
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
)
ssh_auth
=
build_ssh_auth
(
ssh_key_auth:
false
,
ssh_private_key:
'foo'
)
...
...
@@ -599,7 +605,7 @@ describe Gitlab::Shell do
end
it
'passes the known_hosts data if specified'
do
expect_call
(
false
,
force:
false
,
tags:
true
,
known_hosts:
'foo'
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
,
known_hosts:
'foo'
)
ssh_auth
=
build_ssh_auth
(
ssh_known_hosts:
'foo'
)
...
...
@@ -607,7 +613,7 @@ describe Gitlab::Shell do
end
it
'does not pass empty known_hosts data'
do
expect_call
(
false
,
force:
false
,
tags:
true
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
)
ssh_auth
=
build_ssh_auth
(
ssh_known_hosts:
''
)
...
...
@@ -615,7 +621,7 @@ describe Gitlab::Shell do
end
it
'does not pass known_hosts data unless SSH is to be used'
do
expect_call
(
false
,
force:
false
,
tags:
true
)
expect_call
(
false
,
force:
false
,
tags:
true
,
prune:
true
)
ssh_auth
=
build_ssh_auth
(
ssh_import?:
false
,
ssh_known_hosts:
'foo'
)
...
...
@@ -642,7 +648,7 @@ describe Gitlab::Shell do
it
'passes the correct params to the gitaly service'
do
expect
(
repository
.
gitaly_repository_client
).
to
receive
(
:fetch_remote
)
.
with
(
remote_name
,
ssh_auth:
ssh_auth
,
forced:
true
,
no_tags:
true
,
timeout:
timeout
)
.
with
(
remote_name
,
ssh_auth:
ssh_auth
,
forced:
true
,
no_tags:
true
,
prune:
true
,
timeout:
timeout
)
subject
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