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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
d300ecf8
Commit
d300ecf8
authored
Mar 11, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to pass name of created artifacts archive in `.gitlab-ci.yml`
parent
ad4d3a07
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
1 deletion
+75
-1
CHANGELOG
CHANGELOG
+1
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+61
-0
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+4
-0
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+9
-1
No files found.
CHANGELOG
View file @
d300ecf8
...
...
@@ -18,6 +18,7 @@ v 8.6.0 (unreleased)
- Rewrite logo to simplify SVG code (Sean Lang)
- Allow to use YAML anchors when parsing the `.gitlab-ci.yml` (Pascal Bach)
- Ignore jobs that start with `.` (hidden jobs)
- Allow to pass name of created artifacts archive in `.gitlab-ci.yml`
- Add support for cross-project label references
- Update documentation to reflect Guest role not being enforced on internal projects
- Allow search for logged out users
...
...
doc/ci/yaml/README.md
View file @
d300ecf8
...
...
@@ -453,6 +453,67 @@ release-job:
The artifacts will be sent to GitLab after a successful build and will
be available for download in the GitLab UI.
#### artifacts:name
_**Note:** Introduced in GitLab 8.6 and GitLab Runner v1.1.0._
The
`name`
directive allows you to define the name of created artifacts archive.
Currently the
`artifacts`
is used.
It may be useful when you will want to download the archive from GitLab.
You could possible have the unique name of every archive.
The
`artifacts:name`
variable can use any of the
[
predefined variables
](
../variables/README.md
)
.
---
**Example configurations**
To create a archive with a name of current build:
```
yaml
job
:
artifacts
:
name
:
"
$CI_BUILD_NAME"
```
To create a archive with a name of current branch or tag:
```
yaml
job
:
artifacts
:
name
:
"
$CI_BUILD_REF_NAME"
untracked
:
true
```
To create a archive with a name of current branch or tag:
```
yaml
job
:
artifacts
:
name
:
"
${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}"
untracked
:
true
```
To create a archive with a name of stage and branch name:
```
yaml
job
:
artifacts
:
name
:
"
${CI_BUILD_STAGE}_${CI_BUILD_REF_NAME}"
untracked
:
true
```
If you use
**Windows Batch**
to run your shell scripts you need to replace
`$`
with
`%`
:
```
yaml
job
:
artifacts
:
name
:
"
%CI_BUILD_STAGE%_%CI_BUILD_REF_NAME%"
untracked
:
true
```
### cache
_**Note:** Introduced in GitLab Runner v0.7.0._
...
...
lib/ci/gitlab_ci_yaml_processor.rb
View file @
d300ecf8
...
...
@@ -218,6 +218,10 @@ module Ci
end
def
validate_job_artifacts!
(
name
,
job
)
if
job
[
:artifacts
][
:name
]
&&
!
validate_string
(
job
[
:artifacts
][
:name
])
raise
ValidationError
,
"
#{
name
}
job: artifacts:name parameter should be a string"
end
if
job
[
:artifacts
][
:untracked
]
&&
!
validate_boolean
(
job
[
:artifacts
][
:untracked
])
raise
ValidationError
,
"
#{
name
}
job: artifacts:untracked parameter should be an boolean"
end
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
d300ecf8
...
...
@@ -397,7 +397,7 @@ module Ci
services:
[
"mysql"
],
before_script:
[
"pwd"
],
rspec:
{
artifacts:
{
paths:
[
"logs/"
,
"binaries/"
],
untracked:
true
},
artifacts:
{
paths:
[
"logs/"
,
"binaries/"
],
untracked:
true
,
name:
"custom_name"
},
script:
"rspec"
}
})
...
...
@@ -417,6 +417,7 @@ module Ci
image:
"ruby:2.1"
,
services:
[
"mysql"
],
artifacts:
{
name:
"custom_name"
,
paths:
[
"logs/"
,
"binaries/"
],
untracked:
true
}
...
...
@@ -619,6 +620,13 @@ module Ci
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: when parameter should be on_success, on_failure or always"
)
end
it
"returns errors if job artifacts:name is not an a string"
do
config
=
YAML
.
dump
({
types:
[
"build"
,
"test"
],
rspec:
{
script:
"test"
,
artifacts:
{
name:
1
}
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: artifacts:name parameter should be a string"
)
end
it
"returns errors if job artifacts:untracked is not an array of strings"
do
config
=
YAML
.
dump
({
types:
[
"build"
,
"test"
],
rspec:
{
script:
"test"
,
artifacts:
{
untracked:
"string"
}
}
})
expect
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