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
Jérome Perrin
gitlab-ce
Commits
97f58bae
Commit
97f58bae
authored
Nov 09, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change artifacts syntax to allow uploading untracked files
parent
d0e3e823
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
11 deletions
+49
-11
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+18
-3
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+13
-3
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+18
-5
No files found.
doc/ci/yaml/README.md
View file @
97f58bae
...
@@ -262,13 +262,28 @@ The above script will:
...
@@ -262,13 +262,28 @@ The above script will:
### artifacts
### artifacts
`artifacts`
is used to specify list of files and directories which should be attached to build after success.
`artifacts`
is used to specify list of files and directories which should be attached to build after success.
1.
Send all files in
`binaries`
and
`.config`
:
```
```
artifacts:
artifacts:
- binaries/
paths:
- .config
- binaries/
- .config
```
2.
Send all git untracked files:
```
artifacts:
untracked: true
```
3.
Send all git untracked files and files in
`binaries`
:
```
artifacts:
untracked: true
paths:
- binaries/
```
```
The above definition will archive all files in
`binaries/`
and
`.config`
.
The artifacts will be send after the build success to GitLab and will be accessible in GitLab interface to download.
The artifacts will be send after the build success to GitLab and will be accessible in GitLab interface to download.
This feature requires GitLab Runner v 0.7.0.
This feature requires GitLab Runner v 0.7.0.
...
...
lib/ci/gitlab_ci_yaml_processor.rb
View file @
97f58bae
...
@@ -160,11 +160,17 @@ module Ci
...
@@ -160,11 +160,17 @@ module Ci
raise
ValidationError
,
"
#{
name
}
job: except parameter should be an array of strings"
raise
ValidationError
,
"
#{
name
}
job: except parameter should be an array of strings"
end
end
if
job
[
:artifacts
]
&&
!
validate_array_of_strings
(
job
[
:artifacts
])
if
job
[
:artifacts
]
raise
ValidationError
,
"
#{
name
}
: artifacts parameter should be an array of strings"
if
job
[
:artifacts
][
:untracked
]
&&
!
validate_boolean
(
job
[
:artifacts
][
:untracked
])
raise
ValidationError
,
"
#{
name
}
job: artifacts:untracked parameter should be an boolean"
end
if
job
[
:artifacts
][
:paths
]
&&
!
validate_array_of_strings
(
job
[
:artifacts
][
:paths
])
raise
ValidationError
,
"
#{
name
}
job: artifacts:paths parameter should be an array of strings"
end
end
end
if
job
[
:allow_failure
]
&&
!
job
[
:allow_failure
].
in?
([
true
,
fals
e
])
if
job
[
:allow_failure
]
&&
!
validate_boolean
(
job
[
:allow_failur
e
])
raise
ValidationError
,
"
#{
name
}
job: allow_failure parameter should be an boolean"
raise
ValidationError
,
"
#{
name
}
job: allow_failure parameter should be an boolean"
end
end
...
@@ -187,6 +193,10 @@ module Ci
...
@@ -187,6 +193,10 @@ module Ci
value
.
is_a?
(
String
)
||
value
.
is_a?
(
Symbol
)
value
.
is_a?
(
String
)
||
value
.
is_a?
(
Symbol
)
end
end
def
validate_boolean
(
value
)
value
.
in?
([
true
,
false
])
end
def
process?
(
only_params
,
except_params
,
ref
,
tag
)
def
process?
(
only_params
,
except_params
,
ref
,
tag
)
if
only_params
.
present?
if
only_params
.
present?
return
false
unless
matching?
(
only_params
,
ref
,
tag
)
return
false
unless
matching?
(
only_params
,
ref
,
tag
)
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
97f58bae
...
@@ -339,7 +339,10 @@ module Ci
...
@@ -339,7 +339,10 @@ module Ci
image:
"ruby:2.1"
,
image:
"ruby:2.1"
,
services:
[
"mysql"
],
services:
[
"mysql"
],
before_script:
[
"pwd"
],
before_script:
[
"pwd"
],
rspec:
{
artifacts:
[
"logs/"
,
"binaries/"
],
script:
"rspec"
}
rspec:
{
artifacts:
{
paths:
[
"logs/"
,
"binaries/"
],
untracked:
true
},
script:
"rspec"
}
})
})
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
)
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
)
...
@@ -356,7 +359,10 @@ module Ci
...
@@ -356,7 +359,10 @@ module Ci
options:
{
options:
{
image:
"ruby:2.1"
,
image:
"ruby:2.1"
,
services:
[
"mysql"
],
services:
[
"mysql"
],
artifacts:
[
"logs/"
,
"binaries/"
]
artifacts:
{
paths:
[
"logs/"
,
"binaries/"
],
untracked:
true
}
},
},
when:
"on_success"
,
when:
"on_success"
,
allow_failure:
false
allow_failure:
false
...
@@ -523,11 +529,18 @@ module Ci
...
@@ -523,11 +529,18 @@ module Ci
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: when parameter should be on_success, on_failure or always"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: when parameter should be on_success, on_failure or always"
)
end
end
it
"returns errors if job artifacts is not an array of strings"
do
it
"returns errors if job artifacts
:untracked
is not an array of strings"
do
config
=
YAML
.
dump
({
types:
[
"build"
,
"test"
],
rspec:
{
script:
"test"
,
artifacts:
"string"
}
})
config
=
YAML
.
dump
({
types:
[
"build"
,
"test"
],
rspec:
{
script:
"test"
,
artifacts:
{
untracked:
"string"
}
}
})
expect
do
expect
do
GitlabCiYamlProcessor
.
new
(
config
)
GitlabCiYamlProcessor
.
new
(
config
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: artifacts parameter should be an array of strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: artifacts:untracked parameter should be an boolean"
)
end
it
"returns errors if job artifacts:paths is not an array of strings"
do
config
=
YAML
.
dump
({
types:
[
"build"
,
"test"
],
rspec:
{
script:
"test"
,
artifacts:
{
paths:
"string"
}
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: artifacts:paths parameter should be an array of strings"
)
end
end
end
end
end
end
...
...
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