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
9776dbda
Commit
9776dbda
authored
Sep 25, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use tag/branch methods to check if pipeline ref exists
parent
8f47d484
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
11 deletions
+5
-11
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+3
-3
lib/gitlab/ci/pipeline/chain/validate.rb
lib/gitlab/ci/pipeline/chain/validate.rb
+2
-8
No files found.
app/services/ci/create_pipeline_service.rb
View file @
9776dbda
...
@@ -107,8 +107,7 @@ module Ci
...
@@ -107,8 +107,7 @@ module Ci
def
tag?
def
tag?
return
@is_tag
if
defined?
(
@is_tag
)
return
@is_tag
if
defined?
(
@is_tag
)
@is_tag
=
@is_tag
=
project
.
repository
.
tag_exists?
(
ref
)
project
.
repository
.
ref_exists?
(
Gitlab
::
Git
::
TAG_REF_PREFIX
+
ref
)
end
end
def
ref
def
ref
...
@@ -120,7 +119,8 @@ module Ci
...
@@ -120,7 +119,8 @@ module Ci
end
end
def
pipeline_created_counter
def
pipeline_created_counter
@pipeline_created_counter
||=
Gitlab
::
Metrics
.
counter
(
:pipelines_created_total
,
"Counter of pipelines created"
)
@pipeline_created_counter
||=
Gitlab
::
Metrics
.
counter
(
:pipelines_created_total
,
"Counter of pipelines created"
)
end
end
end
end
end
end
lib/gitlab/ci/pipeline/chain/validate.rb
View file @
9776dbda
...
@@ -79,22 +79,16 @@ module Gitlab
...
@@ -79,22 +79,16 @@ module Gitlab
end
end
end
end
## TODO, move to Pipeline as `branch_exists?`
#
def
branch?
def
branch?
return
@is_branch
if
defined?
(
@is_branch
)
return
@is_branch
if
defined?
(
@is_branch
)
@is_branch
=
project
.
repository
@is_branch
=
project
.
repository
.
branch_exists?
(
pipeline
.
ref
)
.
ref_exists?
(
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
pipeline
.
ref
)
end
end
## TODO, move to pipeline as `tag_exists?`
#
def
tag?
def
tag?
return
@is_tag
if
defined?
(
@is_tag
)
return
@is_tag
if
defined?
(
@is_tag
)
@is_tag
=
project
.
repository
@is_tag
=
project
.
repository
.
tag_exists?
(
pipeline
.
ref
)
.
ref_exists?
(
Gitlab
::
Git
::
TAG_REF_PREFIX
+
pipeline
.
ref
)
end
end
def
error
(
message
)
def
error
(
message
)
...
...
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