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
8437890a
Commit
8437890a
authored
Jul 09, 2020
by
Jaime Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GitRefValidator in CI releases
parent
061dec45
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
16 deletions
+40
-16
changelogs/unreleased/227116-remove-commit-ref-check.yml
changelogs/unreleased/227116-remove-commit-ref-check.yml
+0
-5
lib/gitlab/ci/config/entry/release.rb
lib/gitlab/ci/config/entry/release.rb
+7
-0
spec/lib/gitlab/ci/config/entry/release_spec.rb
spec/lib/gitlab/ci/config/entry/release_spec.rb
+33
-11
No files found.
changelogs/unreleased/227116-remove-commit-ref-check.yml
deleted
100644 → 0
View file @
061dec45
---
title
:
Remove ref validation for release yaml node
merge_request
:
36256
author
:
type
:
fixed
lib/gitlab/ci/config/entry/release.rb
View file @
8437890a
...
...
@@ -42,6 +42,13 @@ module Gitlab
errors
.
add
(
:released_at
,
"must be a valid datetime"
)
end
end
validate
do
next
unless
config
[
:ref
]
unless
Gitlab
::
GitRefValidator
.
validate
(
config
[
:ref
])
errors
.
add
(
:ref
,
"must be a valid ref"
)
end
end
end
def
value
...
...
spec/lib/gitlab/ci/config/entry/release_spec.rb
View file @
8437890a
...
...
@@ -117,12 +117,40 @@ RSpec.describe Gitlab::Ci::Config::Entry::Release do
tag_name:
'v0.06'
,
description:
"./release_changelog.txt"
,
name:
"Release $CI_TAG_NAME"
,
ref:
'b3235930aa443112e639f941c69c578912189bdd'
ref:
ref
}
end
context
"when 'ref' is a full commit SHA"
do
let
(
:ref
)
{
'b3235930aa443112e639f941c69c578912189bdd'
}
it_behaves_like
'a valid entry'
end
context
"when 'ref' is a short commit SHA"
do
let
(
:ref
)
{
'b3235930'
}
it_behaves_like
'a valid entry'
end
context
"when 'ref' is a branch name"
do
let
(
:ref
)
{
'fix/123-branch-name'
}
it_behaves_like
'a valid entry'
end
context
"when 'ref' is a semantic versioning tag"
do
let
(
:ref
)
{
'v1.2.3'
}
it_behaves_like
'a valid entry'
end
context
"when 'ref' is a semantic versioning tag rc"
do
let
(
:ref
)
{
'v1.2.3-rc'
}
it_behaves_like
'a valid entry'
end
end
context
"when value includes 'released_at' keyword"
do
let
(
:config
)
do
...
...
@@ -192,16 +220,10 @@ RSpec.describe Gitlab::Ci::Config::Entry::Release do
it_behaves_like
'reports error'
,
'release released at must be a valid datetime'
end
context
'when `milestones` is not an array of strings'
do
let
(
:config
)
{
{
milestones:
[
1
,
2
,
3
]
}
}
it_behaves_like
'reports error'
,
'release milestones should be an array of strings or a string'
end
context
'when `released_at` is not a valid date'
do
let
(
:config
)
{
{
released_at:
'ABC123'
}
}
context
'when `ref` is not valid'
do
let
(
:config
)
{
{
ref:
'invalid\branch'
}
}
it_behaves_like
'reports error'
,
'release re
leased at must be a valid datetime
'
it_behaves_like
'reports error'
,
'release re
f must be a valid ref
'
end
context
'when `milestones` is not an array of strings'
do
...
...
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