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
2a14bb06
Commit
2a14bb06
authored
Dec 04, 2018
by
Francisco Javier López
Committed by
Douwe Maan
Dec 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CE port of Add new service to create the web ide terminal
parent
8f36de52
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
+34
-10
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+5
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+28
-10
spec/workers/pipeline_schedule_worker_spec.rb
spec/workers/pipeline_schedule_worker_spec.rb
+1
-0
No files found.
app/models/ci/pipeline.rb
View file @
2a14bb06
...
@@ -171,6 +171,8 @@ module Ci
...
@@ -171,6 +171,8 @@ module Ci
scope
:internal
,
->
{
where
(
source:
internal_sources
)
}
scope
:internal
,
->
{
where
(
source:
internal_sources
)
}
scope
:for_user
,
->
(
user
)
{
where
(
user:
user
)
}
# Returns the pipelines in descending order (= newest first), optionally
# Returns the pipelines in descending order (= newest first), optionally
# limited to a number of references.
# limited to a number of references.
#
#
...
@@ -496,6 +498,8 @@ module Ci
...
@@ -496,6 +498,8 @@ module Ci
end
end
def
ci_yaml_file_path
def
ci_yaml_file_path
return
unless
repository_source?
||
unknown_source?
if
project
.
ci_config_path
.
blank?
if
project
.
ci_config_path
.
blank?
'.gitlab-ci.yml'
'.gitlab-ci.yml'
else
else
...
@@ -664,6 +668,7 @@ module Ci
...
@@ -664,6 +668,7 @@ module Ci
def
ci_yaml_from_repo
def
ci_yaml_from_repo
return
unless
project
return
unless
project
return
unless
sha
return
unless
sha
return
unless
ci_yaml_file_path
project
.
repository
.
gitlab_ci_yml_for
(
sha
,
ci_yaml_file_path
)
project
.
repository
.
gitlab_ci_yml_for
(
sha
,
ci_yaml_file_path
)
rescue
GRPC
::
NotFound
,
GRPC
::
Internal
rescue
GRPC
::
NotFound
,
GRPC
::
Internal
...
...
spec/models/ci/pipeline_spec.rb
View file @
2a14bb06
...
@@ -1249,22 +1249,40 @@ describe Ci::Pipeline, :mailer do
...
@@ -1249,22 +1249,40 @@ describe Ci::Pipeline, :mailer do
describe
'#ci_yaml_file_path'
do
describe
'#ci_yaml_file_path'
do
subject
{
pipeline
.
ci_yaml_file_path
}
subject
{
pipeline
.
ci_yaml_file_path
}
it
'returns the path from project'
do
%i[unknown_source repository_source]
.
each
do
|
source
|
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_path
)
{
'custom/path'
}
context
source
.
to_s
do
before
do
pipeline
.
config_source
=
described_class
.
config_sources
.
fetch
(
source
)
end
is_expected
.
to
eq
(
'custom/path'
)
it
'returns the path from project'
do
end
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_path
)
{
'custom/path'
}
it
'returns default when custom path is nil'
do
is_expected
.
to
eq
(
'custom/path'
)
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_path
)
{
nil
}
end
it
'returns default when custom path is nil'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_path
)
{
nil
}
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
end
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
it
'returns default when custom path is empty'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_path
)
{
''
}
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
end
end
end
end
it
'returns default when custom path is empty'
do
context
'when pipeline is for auto-devops'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_path
)
{
''
}
before
do
pipeline
.
config_source
=
'auto_devops_source'
end
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
it
'does not return config file'
do
is_expected
.
to
be_nil
end
end
end
end
end
...
...
spec/workers/pipeline_schedule_worker_spec.rb
View file @
2a14bb06
...
@@ -11,6 +11,7 @@ describe PipelineScheduleWorker do
...
@@ -11,6 +11,7 @@ describe PipelineScheduleWorker do
end
end
before
do
before
do
stub_application_setting
(
auto_devops_enabled:
false
)
stub_ci_pipeline_to_return_yaml_file
stub_ci_pipeline_to_return_yaml_file
pipeline_schedule
.
update_column
(
:next_run_at
,
1
.
day
.
ago
)
pipeline_schedule
.
update_column
(
:next_run_at
,
1
.
day
.
ago
)
...
...
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