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
Léo-Paul Géneau
gitlab-ce
Commits
bcd70c4c
Commit
bcd70c4c
authored
Sep 04, 2017
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate review
parent
a346dbf0
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
44 additions
and
22 deletions
+44
-22
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+21
-10
app/models/project.rb
app/models/project.rb
+2
-1
app/models/project_auto_devops.rb
app/models/project_auto_devops.rb
+2
-0
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+4
-3
config/initializers/0_inflections.rb
config/initializers/0_inflections.rb
+1
-1
db/migrate/20170828093725_create_project_auto_dev_ops.rb
db/migrate/20170828093725_create_project_auto_dev_ops.rb
+2
-2
db/schema.rb
db/schema.rb
+4
-3
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+1
-1
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+3
-0
spec/models/project_auto_devops_spec.rb
spec/models/project_auto_devops_spec.rb
+3
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-0
No files found.
app/models/ci/pipeline.rb
View file @
bcd70c4c
...
...
@@ -51,8 +51,9 @@ module Ci
}
enum
config_source:
{
repository:
nil
,
auto_devops:
1
unknown_source:
nil
,
repository_source:
1
,
auto_devops_source:
2
}
state_machine
:status
,
initial: :created
do
...
...
@@ -317,6 +318,11 @@ module Ci
builds
.
latest
.
failed_but_allowed
.
any?
end
def
detect_ci_yaml_file
ci_yaml_from_repo
&
.
tap
{
self
.
repository_source!
}
||
implied_ci_yaml_file
&
.
tap
{
self
.
auto_devops_source!
}
end
def
config_processor
return
unless
ci_yaml_file
return
@config_processor
if
defined?
(
@config_processor
)
...
...
@@ -343,8 +349,13 @@ module Ci
def
ci_yaml_file
return
@ci_yaml_file
if
defined?
(
@ci_yaml_file
)
@ci_yaml_file
=
ci_yaml_from_repo
@ci_yaml_file
||=
implied_ci_yaml_file
&
.
tap
{
self
.
auto_devops!
}
@ci_yaml_file
=
case
config_source
when
:repository_source
,
:unknown_source
ci_yaml_from_repo
when
:auto_devops_source
implied_ci_yaml_file
end
if
@ci_yaml_file
@ci_yaml_file
...
...
@@ -437,18 +448,18 @@ module Ci
private
def
implied_ci_yaml_file
if
project
.
auto_devops_enabled?
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'Auto-DevOps'
).
content
end
end
def
ci_yaml_from_repo
project
.
repository
.
gitlab_ci_yml_for
(
sha
,
ci_yaml_file_path
)
rescue
GRPC
::
NotFound
,
Rugged
::
ReferenceError
,
GRPC
::
Internal
nil
end
def
implied_ci_yaml_file
if
project
.
auto_devops_enabled?
Gitlab
::
Template
::
GitlabCiYmlTemplate
.
find
(
'Auto-DevOps'
).
content
end
end
def
pipeline_data
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
self
)
end
...
...
app/models/project.rb
View file @
bcd70c4c
...
...
@@ -1395,7 +1395,8 @@ class Project < ActiveRecord::Base
{
key:
'CI_PROJECT_PATH'
,
value:
full_path
,
public:
true
},
{
key:
'CI_PROJECT_PATH_SLUG'
,
value:
full_path_slug
,
public:
true
},
{
key:
'CI_PROJECT_NAMESPACE'
,
value:
namespace
.
full_path
,
public:
true
},
{
key:
'CI_PROJECT_URL'
,
value:
web_url
,
public:
true
}
{
key:
'CI_PROJECT_URL'
,
value:
web_url
,
public:
true
},
{
key:
'AUTO_DEVOPS_DOMAIN'
,
value:
auto_devops
.
domain
,
public:
true
}
]
end
...
...
app/models/project_auto_devops.rb
View file @
bcd70c4c
class
ProjectAutoDevops
<
ActiveRecord
::
Base
belongs_to
:project
validates
:domain
,
presence:
true
end
app/services/ci/create_pipeline_service.rb
View file @
bcd70c4c
...
...
@@ -67,10 +67,11 @@ module Ci
return
error
(
'Commit not found'
)
end
unless
pipeline
.
config_processor
unless
pipeline
.
ci_yaml_file
unless
pipeline
.
detect_ci_yaml_file
return
error
(
"Missing
#{
pipeline
.
ci_yaml_file_path
}
file"
)
end
unless
pipeline
.
config_processor
return
error
(
pipeline
.
yaml_errors
,
save:
save_on_errors
)
end
...
...
config/initializers/0_inflections.rb
View file @
bcd70c4c
...
...
@@ -14,6 +14,6 @@ ActiveSupport::Inflector.inflections do |inflect|
award_emoji
project_statistics
system_note_metadata
auto_devops
project_
auto_devops
)
end
db/migrate/20170828093725_create_project_auto_dev_ops.rb
View file @
bcd70c4c
...
...
@@ -7,9 +7,9 @@ class CreateProjectAutoDevOps < ActiveRecord::Migration
def
up
create_table
:project_auto_devops
do
|
t
|
t
.
belongs_to
:project
,
index:
true
t
.
belongs_to
:project
,
null:
false
,
index:
{
unique:
true
}
t
.
boolean
:enabled
,
default:
nil
,
null:
true
t
.
string
:domain
t
.
string
:domain
,
null:
false
end
add_timestamps_with_timezone
(
:project_auto_devops
,
null:
false
)
...
...
db/schema.rb
View file @
bcd70c4c
...
...
@@ -1123,14 +1123,14 @@ ActiveRecord::Schema.define(version: 20170831092813) do
add_index
"project_authorizations"
,
[
"user_id"
,
"project_id"
,
"access_level"
],
name:
"index_project_authorizations_on_user_id_project_id_access_level"
,
unique:
true
,
using: :btree
create_table
"project_auto_devops"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
integer
"project_id"
,
null:
false
t
.
boolean
"enabled"
t
.
string
"domain"
t
.
string
"domain"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
end
add_index
"project_auto_devops"
,
[
"project_id"
],
name:
"index_project_auto_devops_on_project_id"
,
using: :btree
add_index
"project_auto_devops"
,
[
"project_id"
],
name:
"index_project_auto_devops_on_project_id"
,
u
nique:
true
,
u
sing: :btree
create_table
"project_features"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
...
...
@@ -1215,6 +1215,7 @@ ActiveRecord::Schema.define(version: 20170831092813) do
t
.
string
"repository_storage"
,
default:
"default"
,
null:
false
t
.
boolean
"request_access_enabled"
,
default:
false
,
null:
false
t
.
boolean
"has_external_wiki"
t
.
string
"ci_config_path"
t
.
boolean
"lfs_enabled"
t
.
text
"description_html"
t
.
boolean
"only_allow_merge_if_all_discussions_are_resolved"
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
bcd70c4c
...
...
@@ -14,7 +14,7 @@ module Gitlab
create_access_levels:
'ProtectedTag::CreateAccessLevel'
,
labels: :project_labels
,
priorities: :label_priorities
,
auto_devops:
'ProjectAutoDevops'
,
auto_devops:
:project_auto_devops
,
label: :project_label
}.
freeze
USER_REFERENCES
=
%w[author_id assignee_id updated_by_id user_id created_by_id last_edited_by_id merge_user_id resolved_by_id]
.
freeze
...
...
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
bcd70c4c
...
...
@@ -467,3 +467,6 @@ ProjectAutoDevops:
-
id
-
enabled
-
domain
-
project_id
-
created_at
-
updated_at
spec/models/project_auto_devops_spec.rb
View file @
bcd70c4c
require
'spec_helper'
describe
ProjectAutoDevops
,
type: :model
do
describe
ProjectAutoDevops
do
subject
{
build_stubbed
(
:project_auto_devops
)
}
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:domain
)
}
it
{
is_expected
.
to
respond_to
(
:created_at
)
}
it
{
is_expected
.
to
respond_to
(
:updated_at
)
}
...
...
spec/models/project_spec.rb
View file @
bcd70c4c
...
...
@@ -53,6 +53,7 @@ describe Project do
it
{
is_expected
.
to
have_one
(
:import_data
).
class_name
(
'ProjectImportData'
)
}
it
{
is_expected
.
to
have_one
(
:last_event
).
class_name
(
'Event'
)
}
it
{
is_expected
.
to
have_one
(
:forked_from_project
).
through
(
:forked_project_link
)
}
it
{
is_expected
.
to
have_one
(
:auto_devops
).
class_name
(
'ProjectAutoDevops'
)
}
it
{
is_expected
.
to
have_many
(
:commit_statuses
)
}
it
{
is_expected
.
to
have_many
(
:pipelines
)
}
it
{
is_expected
.
to
have_many
(
:builds
)
}
...
...
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