Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
de12e4e2
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,发现更多精彩内容 >>
提交
de12e4e2
编写于
6月 06, 2017
作者:
S
Sean Packham
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'docs/powershell-ci-vars' into 'master'
Add PowerShell to CI variable docs See merge request !11935
上级
606e9cef
1d0219a5
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
49 addition
and
4 deletion
+49
-4
doc/ci/variables/README.md
doc/ci/variables/README.md
+30
-4
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+19
-0
未找到文件。
doc/ci/variables/README.md
浏览文件 @
de12e4e2
...
...
@@ -345,20 +345,45 @@ All variables are set as environment variables in the build environment, and
they are accessible with normal methods that are used to access such variables.
In most cases
`bash`
or
`sh`
is used to execute the job script.
To access the variables (predefined and user-defined) in a
`bash`
/
`sh`
environment,
prefix the variable name with the dollar sign (
`$`
):
To access environment variables, use the syntax for your Runner's
[
shell
][
shellexecutors
]
.
```
| Shell | Usage |
|----------------------|-----------------|
| bash/sh |
`$variable`
|
| windows batch |
`%variable%`
|
| PowerShell |
`$env:variable`
|
To access environment variables in bash, prefix the variable name with (
`$`
):
```
yaml
job_name
:
script
:
-
echo $CI_JOB_ID
```
To access environment variables in
**Windows Batch**
, surround the variable
with (
`%`
):
```
yaml
job_name
:
script
:
-
echo %CI_JOB_ID%
```
To access environment variables in a
**Windows PowerShell**
environment, prefix
the variable name with (
`$env:`
):
```
yaml
job_name
:
script
:
-
echo $env:CI_JOB_ID
```
You can also list all environment variables with the
`export`
command,
but be aware that this will also expose the values of all the secret variables
you set, in the job log:
```
```
yaml
job_name
:
script
:
-
export
...
...
@@ -405,3 +430,4 @@ export CI_REGISTRY_PASSWORD="longalfanumstring"
[
triggers
]:
../triggers/README.md#pass-job-variables-to-a-trigger
[
protected branches
]:
../../user/project/protected_branches.md
[
protected tags
]:
../../user/project/protected_tags.md
[
shellexecutors
]:
https://docs.gitlab.com/runner/executors/
doc/ci/yaml/README.md
浏览文件 @
de12e4e2
...
...
@@ -297,6 +297,15 @@ cache:
untracked
:
true
```
If you use
**Windows PowerShell**
to run your shell scripts you need to replace
`$`
with
`$env:`
:
```
yaml
cache
:
key
:
"
$env:CI_JOB_STAGE/$env:CI_COMMIT_REF_NAME"
untracked
:
true
```
## Jobs
`.gitlab-ci.yml`
allows you to specify an unlimited number of jobs. Each job
...
...
@@ -909,6 +918,16 @@ job:
untracked
:
true
```
If you use
**Windows PowerShell**
to run your shell scripts you need to replace
`$`
with
`$env:`
:
```
yaml
job
:
artifacts
:
name
:
"
$env:CI_JOB_STAGE_$env:CI_COMMIT_REF_NAME"
untracked
:
true
```
#### artifacts:when
> Introduced in GitLab 8.9 and GitLab Runner v1.3.0.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录