BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3248ca04
Commit
3248ca04
authored
Apr 24, 2018
by
Shinya Maeda
Committed by
Kamil Trzciński
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add per-project pipeline id
parent
38a5bcd1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
1 deletion
+20
-1
pipeline.rb
app/models/ci/pipeline.rb
+3
-0
internal_id.rb
app/models/internal_id.rb
+1
-1
20180424160449_add_pipeline_iid_to_ci_pipelines.rb
...igrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
+15
-0
schema.rb
db/schema.rb
+1
-0
No files found.
app/models/ci/pipeline.rb
View file @
3248ca04
...
...
@@ -7,12 +7,15 @@ module Ci
include
Presentable
include
Gitlab
::
OptimisticLocking
include
Gitlab
::
Utils
::
StrongMemoize
include
AtomicInternalId
belongs_to
:project
,
inverse_of: :pipelines
belongs_to
:user
belongs_to
:auto_canceled_by
,
class_name:
'Ci::Pipeline'
belongs_to
:pipeline_schedule
,
class_name:
'Ci::PipelineSchedule'
has_internal_id
:iid
,
scope: :project
,
init:
->
(
s
)
{
s
&
.
project
&
.
pipelines
.
maximum
(
:iid
)
}
has_many
:stages
has_many
:statuses
,
class_name:
'CommitStatus'
,
foreign_key: :commit_id
,
inverse_of: :pipeline
has_many
:builds
,
foreign_key: :commit_id
,
inverse_of: :pipeline
...
...
app/models/internal_id.rb
View file @
3248ca04
...
...
@@ -14,7 +14,7 @@ class InternalId < ActiveRecord::Base
belongs_to
:project
belongs_to
:namespace
enum
usage:
{
issues:
0
,
merge_requests:
1
,
deployments:
2
,
milestones:
3
,
epics:
4
}
enum
usage:
{
issues:
0
,
merge_requests:
1
,
deployments:
2
,
milestones:
3
,
epics:
4
,
ci_pipelines:
5
}
validates
:usage
,
presence:
true
...
...
db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
0 → 100644
View file @
3248ca04
class
AddPipelineIidToCiPipelines
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column
:ci_pipelines
,
:iid
,
:integer
end
def
down
remove_column
:ci_pipelines
,
:iid
,
:integer
end
end
db/schema.rb
View file @
3248ca04
...
...
@@ -434,6 +434,7 @@ ActiveRecord::Schema.define(version: 20180425131009) do
t
.
integer
"config_source"
t
.
boolean
"protected"
t
.
integer
"failure_reason"
t
.
integer
"iid"
end
add_index
"ci_pipelines"
,
[
"auto_canceled_by_id"
],
name:
"index_ci_pipelines_on_auto_canceled_by_id"
,
using: :btree
...
...
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