Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d300ecf8
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d300ecf8
编写于
3月 11, 2016
作者:
K
Kamil Trzcinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow to pass name of created artifacts archive in `.gitlab-ci.yml`
上级
ad4d3a07
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
75 addition
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
未找到文件。
CHANGELOG
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录