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
4413d97b
Commit
4413d97b
authored
Mar 16, 2017
by
Achilleas Pipinellis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-rename-ci-vars' into 'master'
Futher rename the CI variables See merge request !9851
parents
50692556
3ebd29b5
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
99 additions
and
99 deletions
+99
-99
.gitlab-ci.yml
.gitlab-ci.yml
+6
-6
config/initializers/rspec_profiling.rb
config/initializers/rspec_profiling.rb
+1
-1
doc/ci/docker/using_docker_build.md
doc/ci/docker/using_docker_build.md
+7
-7
doc/ci/environments.md
doc/ci/environments.md
+19
-19
doc/ci/review_apps/index.md
doc/ci/review_apps/index.md
+1
-1
doc/ci/variables/README.md
doc/ci/variables/README.md
+26
-26
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+13
-13
doc/user/project/new_ci_build_permissions_model.md
doc/user/project/new_ci_build_permissions_model.md
+2
-2
lib/tasks/gitlab/dev.rake
lib/tasks/gitlab/dev.rake
+1
-1
spec/lib/expand_variables_spec.rb
spec/lib/expand_variables_spec.rb
+2
-2
spec/lib/gitlab/ci/config/entry/environment_spec.rb
spec/lib/gitlab/ci/config/entry/environment_spec.rb
+2
-2
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+1
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+5
-5
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+5
-5
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+1
-1
spec/services/create_deployment_service_spec.rb
spec/services/create_deployment_service_spec.rb
+4
-4
spec/simplecov_env.rb
spec/simplecov_env.rb
+3
-3
No files found.
.gitlab-ci.yml
View file @
4413d97b
...
...
@@ -58,7 +58,7 @@ stages:
<<
:
*dedicated-runner
<<
:
*use-db
script
:
-
JOB_NAME=( $CI_
BUILD
_NAME )
-
JOB_NAME=( $CI_
JOB
_NAME )
-
export CI_NODE_INDEX=${JOB_NAME[1]}
-
export CI_NODE_TOTAL=${JOB_NAME[2]}
-
export KNAPSACK_REPORT_PATH=knapsack/rspec_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
...
...
@@ -78,7 +78,7 @@ stages:
<<
:
*dedicated-runner
<<
:
*use-db
script
:
-
JOB_NAME=( $CI_
BUILD
_NAME )
-
JOB_NAME=( $CI_
JOB
_NAME )
-
export CI_NODE_INDEX=${JOB_NAME[1]}
-
export CI_NODE_TOTAL=${JOB_NAME[2]}
-
export KNAPSACK_REPORT_PATH=knapsack/spinach_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
...
...
@@ -180,7 +180,7 @@ spinach 9 10: *spinach-knapsack
<<
:
*dedicated-runner
stage
:
test
script
:
-
bundle exec $CI_
BUILD
_NAME
-
bundle exec $CI_
JOB
_NAME
rubocop
:
<<
:
*ruby-static-analysis
...
...
@@ -211,7 +211,7 @@ rake ee_compat_check:
-
ee_compat_check/repo/
-
vendor/ruby
artifacts
:
name
:
"
${CI_
BUILD_NAME}_${CI_BUILD_REF_NAME}_${CI_BUILD
_REF}"
name
:
"
${CI_
JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT
_REF}"
when
:
on_failure
expire_in
:
10d
paths
:
...
...
@@ -330,7 +330,7 @@ migration paths:
-
sed -i 's/localhost/redis/g' config/resque.yml
-
bundle install --without postgres production --jobs $(nproc) $FLAGS --retry=3
-
bundle exec rake db:drop db:create db:schema:load db:seed_fu
-
git checkout $CI_
BUILD
_REF
-
git checkout $CI_
COMMIT
_REF
-
source scripts/prepare_build.sh
-
bundle exec rake db:migrate
...
...
@@ -402,7 +402,7 @@ notify:slack:
SETUP_DB
:
"
false"
USE_BUNDLE_INSTALL
:
"
false"
script
:
-
./scripts/notify_slack.sh "#development" "Build on \`$CI_
BUILD_REF_NAME\` failed! Commit \`$(git log -1 --oneline)\` See <https://gitlab.com/gitlab-org/$(basename "$PWD")/commit/"$CI_BUILD
_REF"/pipelines>"
-
./scripts/notify_slack.sh "#development" "Build on \`$CI_
COMMIT_REF_NAME\` failed! Commit \`$(git log -1 --oneline)\` See <https://gitlab.com/gitlab-org/$(basename "$PWD")/commit/"$CI_COMMIT
_REF"/pipelines>"
when
:
on_failure
only
:
-
master@gitlab-org/gitlab-ce
...
...
config/initializers/rspec_profiling.rb
View file @
4413d97b
...
...
@@ -7,7 +7,7 @@ module RspecProfilingExt
module
Git
def
branch
ENV
[
'CI_
BUILD
_REF_NAME'
]
||
super
ENV
[
'CI_
COMMIT
_REF_NAME'
]
||
super
end
end
...
...
doc/ci/docker/using_docker_build.md
View file @
4413d97b
...
...
@@ -298,14 +298,14 @@ could look like:
-
docker:dind
stage
:
build
script
:
-
docker login -u gitlab-ci-token -p $CI_
BUILD
_TOKEN registry.example.com
-
docker login -u gitlab-ci-token -p $CI_
JOB
_TOKEN registry.example.com
-
docker build -t registry.example.com/group/project:latest .
-
docker push registry.example.com/group/project:latest
```
You have to use the special
`gitlab-ci-token`
user created for you in order to
push to the Registry connected to your project. Its password is provided in the
`$CI_
BUILD
_TOKEN`
variable. This allows you to automate building and deployment
`$CI_
JOB
_TOKEN`
variable. This allows you to automate building and deployment
of your Docker images.
You can also make use of
[
other variables
](
../variables/README.md
)
to avoid hardcoding:
...
...
@@ -315,10 +315,10 @@ services:
-
docker:dind
variables
:
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_
BUILD
_REF_NAME
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_
COMMIT
_REF_NAME
before_script
:
-
docker login -u gitlab-ci-token -p $CI_
BUILD
_TOKEN $CI_REGISTRY
-
docker login -u gitlab-ci-token -p $CI_
COMMIT
_TOKEN $CI_REGISTRY
build
:
stage
:
build
...
...
@@ -328,7 +328,7 @@ build:
```
Here,
`$CI_REGISTRY_IMAGE`
would be resolved to the address of the registry tied
to this project, and
`$CI_
BUILD
_REF_NAME`
would be resolved to the branch or
to this project, and
`$CI_
COMMIT
_REF_NAME`
would be resolved to the branch or
tag name for this particular job. We also declare our own variable,
`$IMAGE_TAG`
,
combining the two to save us some typing in the
`script`
section.
...
...
@@ -350,11 +350,11 @@ stages:
-
deploy
variables
:
CONTAINER_TEST_IMAGE
:
registry.example.com/my-group/my-project:$CI_
BUILD
_REF_NAME
CONTAINER_TEST_IMAGE
:
registry.example.com/my-group/my-project:$CI_
COMMIT
_REF_NAME
CONTAINER_RELEASE_IMAGE
:
registry.example.com/my-group/my-project:latest
before_script
:
-
docker login -u gitlab-ci-token -p $CI_
BUILD
_TOKEN registry.example.com
-
docker login -u gitlab-ci-token -p $CI_
JOB
_TOKEN registry.example.com
build
:
stage
:
build
...
...
doc/ci/environments.md
View file @
4413d97b
...
...
@@ -263,7 +263,7 @@ This works just like any other terminal - you'll be in the container created
by your deployment, so you can run shell commands and get responses in real
time, check the logs, try out configuration or code tweaks, etc. You can open
multiple terminals to the same environment - they each get their own shell
session - and even a multiplexer like
`screen`
or
`tmux`
!
session - and even a multiplexer like
`screen`
or
`tmux`
!
>**Note:**
Container-based deployments often lack basic tools (like an editor), and may
...
...
@@ -295,7 +295,7 @@ deploy_review:
script
:
-
echo "Deploy a review app"
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
name
:
review/$CI_
COMMIT
_REF_NAME
url
:
https://$CI_ENVIRONMENT_SLUG.example.com
only
:
-
branches
...
...
@@ -306,22 +306,22 @@ deploy_review:
Let's break it down in pieces. The job's name is
`deploy_review`
and it runs
on the
`deploy`
stage. The
`script`
at this point is fictional, you'd have to
use your own based on your deployment. Then, we set the
`environment`
with the
`environment:name`
being
`review/$CI_
BUILD
_REF_NAME`
. Now that's an interesting
`environment:name`
being
`review/$CI_
COMMIT
_REF_NAME`
. Now that's an interesting
one. Since the
[
environment name
][
env-name
]
can contain slashes (
`/`
), we can
use this pattern to distinguish between dynamic environments and the regular
ones.
So, the first part is
`review`
, followed by a
`/`
and then
`$CI_
BUILD
_REF_NAME`
which takes the value of the branch name. Since
`$CI_
BUILD
_REF_NAME`
itself may
So, the first part is
`review`
, followed by a
`/`
and then
`$CI_
COMMIT
_REF_NAME`
which takes the value of the branch name. Since
`$CI_
COMMIT
_REF_NAME`
itself may
also contain
`/`
, or other characters that would be invalid in a domain name or
URL, we use
`$CI_ENVIRONMENT_SLUG`
in the
`environment:url`
so that the
environment can get a specific and distinct URL for each branch. In this case,
given a
`$CI_
BUILD
_REF_NAME`
of
`100-Do-The-Thing`
, the URL will be something
given a
`$CI_
COMMIT
_REF_NAME`
of
`100-Do-The-Thing`
, the URL will be something
like
`https://100-do-the-4f99a2.example.com`
. Again, the way you set up
the web server to serve these requests is based on your setup.
You could also use
`$CI_
BUILD
_REF_SLUG`
in
`environment:url`
, e.g.:
`https://$CI_
BUILD
_REF_SLUG.example.com`
. We use
`$CI_ENVIRONMENT_SLUG`
You could also use
`$CI_
COMMIT
_REF_SLUG`
in
`environment:url`
, e.g.:
`https://$CI_
COMMIT
_REF_SLUG.example.com`
. We use
`$CI_ENVIRONMENT_SLUG`
here because it is guaranteed to be unique, but if you're using a workflow like
[
GitLab Flow
][
gitlab-flow
]
, collisions are very unlikely, and you may prefer
environment names to be more closely based on the branch name - the example
...
...
@@ -356,7 +356,7 @@ deploy_review:
script
:
-
echo "Deploy a review app"
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
name
:
review/$CI_
COMMIT
_REF_NAME
url
:
https://$CI_ENVIRONMENT_SLUG.example.com
only
:
-
branches
...
...
@@ -387,16 +387,16 @@ deploy_prod:
A more realistic example would include copying files to a location where a
webserver (NGINX) could then read and serve. The example below will copy the
`public`
directory to
`/srv/nginx/$CI_
BUILD
_REF_SLUG/public`
:
`public`
directory to
`/srv/nginx/$CI_
COMMIT
_REF_SLUG/public`
:
```
yaml
review_app
:
stage
:
deploy
script
:
-
rsync -av --delete public /srv/nginx/$CI_
BUILD
_REF_SLUG
-
rsync -av --delete public /srv/nginx/$CI_
COMMIT
_REF_SLUG
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
url
:
https://$CI_
BUILD
_REF_SLUG.example.com
name
:
review/$CI_
COMMIT
_REF_NAME
url
:
https://$CI_
COMMIT
_REF_SLUG.example.com
```
It is assumed that the user has already setup NGINX and GitLab Runner in the
...
...
@@ -526,7 +526,7 @@ deploy_review:
script
:
-
echo "Deploy a review app"
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
name
:
review/$CI_
COMMIT
_REF_NAME
url
:
https://$CI_ENVIRONMENT_SLUG.example.com
on_stop
:
stop_review
only
:
...
...
@@ -542,7 +542,7 @@ stop_review:
-
echo "Remove review app"
when
:
manual
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
name
:
review/$CI_
COMMIT
_REF_NAME
action
:
stop
```
...
...
@@ -568,13 +568,13 @@ You can read more in the [`.gitlab-ci.yml` reference][onstop].
As we've seen in the
[
dynamic environments
](
#dynamic-environments
)
, you can
prepend their name with a word, then followed by a
`/`
and finally the branch
name which is automatically defined by the
`CI_
BUILD
_REF_NAME`
variable.
name which is automatically defined by the
`CI_
COMMIT
_REF_NAME`
variable.
In short, environments that are named like
`type/foo`
are presented under a
group named
`type`
.
In our minimal example, we name the environments
`review/$CI_
BUILD
_REF_NAME`
where
`$CI_
BUILD
_REF_NAME`
is the branch name:
In our minimal example, we name the environments
`review/$CI_
COMMIT
_REF_NAME`
where
`$CI_
COMMIT
_REF_NAME`
is the branch name:
```
yaml
deploy_review
:
...
...
@@ -582,7 +582,7 @@ deploy_review:
script
:
-
echo "Deploy a review app"
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
name
:
review/$CI_
COMMIT
_REF_NAME
```
In that case, if you visit the Environments page, and provided the branches
...
...
doc/ci/review_apps/index.md
View file @
4413d97b
...
...
@@ -80,7 +80,7 @@ The process of adding Review Apps in your workflow would look like:
1.
[
Install
][
install-runner
]
and
[
configure
][
conf-runner
]
a Runner that does
the deployment.
1.
Set up a job in
`.gitlab-ci.yml`
that uses the predefined
[
predefined CI environment variable
][
variables
]
`${CI_
BUILD
_REF_NAME}`
to
[
predefined CI environment variable
][
variables
]
`${CI_
COMMIT
_REF_NAME}`
to
create dynamic environments and restrict it to run only on branches.
1.
Optionally set a job that
[
manually stops
][
manual-env
]
the Review Apps.
...
...
doc/ci/variables/README.md
View file @
4413d97b
...
...
@@ -236,18 +236,18 @@ Running on runner-8a2f473d-project-1796893-concurrent-0 via runner-8a2f473d-mach
++
CI
=
true
++
export
CI_DEBUG_TRACE
=
false
++
CI_DEBUG_TRACE
=
false
++
export
CI_
BUILD
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
BUILD
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
BUILD
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
BUILD
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
BUILD
_REF_NAME
=
master
++
CI_
BUILD
_REF_NAME
=
master
++
export
CI_
BUILD
_ID
=
7046507
++
CI_
BUILD
_ID
=
7046507
++
export
CI_
BUILD_REPO
=
https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/gitlab-examples/ci-debug-trace.git
++
CI_
BUILD_REPO
=
https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/gitlab-examples/ci-debug-trace.git
++
export
CI_
BUILD
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
CI_
BUILD
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
export
CI_
COMMIT
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
COMMIT
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
COMMIT
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
COMMIT
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
COMMIT
_REF_NAME
=
master
++
CI_
COMMIT
_REF_NAME
=
master
++
export
CI_
JOB
_ID
=
7046507
++
CI_
JOB
_ID
=
7046507
++
export
CI_
REPOSITORY_URL
=
https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/gitlab-examples/ci-debug-trace.git
++
CI_
REPOSITORY_URL
=
https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/gitlab-examples/ci-debug-trace.git
++
export
CI_
JOB
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
CI_
JOB
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
export
CI_PROJECT_ID
=
1796893
++
CI_PROJECT_ID
=
1796893
++
export
CI_PROJECT_DIR
=
/builds/gitlab-examples/ci-debug-trace
...
...
@@ -266,20 +266,20 @@ Running on runner-8a2f473d-project-1796893-concurrent-0 via runner-8a2f473d-mach
++
CI
=
true
++
export
GITLAB_CI
=
true
++
GITLAB_CI
=
true
++
export
CI_
BUILD
_ID
=
7046507
++
CI_
BUILD
_ID
=
7046507
++
export
CI_
BUILD
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
CI_
BUILD
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
export
CI_
BUILD
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
BUILD
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
BUILD
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
BUILD
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
BUILD
_REF_NAME
=
master
++
CI_
BUILD
_REF_NAME
=
master
++
export
CI_
BUILD
_NAME
=
debug_trace
++
CI_
BUILD
_NAME
=
debug_trace
++
export
CI_
BUILD
_STAGE
=
test
++
CI_
BUILD
_STAGE
=
test
++
export
CI_
JOB
_ID
=
7046507
++
CI_
JOB
_ID
=
7046507
++
export
CI_
JOB
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
CI_
JOB
_TOKEN
=
xxxxxxxxxxxxxxxxxxxx
++
export
CI_
COMMIT
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
COMMIT
_REF
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
COMMIT
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
CI_
COMMIT
_BEFORE_SHA
=
dd648b2e48ce6518303b0bb580b2ee32fadaf045
++
export
CI_
COMMIT
_REF_NAME
=
master
++
CI_
COMMIT
_REF_NAME
=
master
++
export
CI_
COMMIT
_NAME
=
debug_trace
++
CI_
JOB
_NAME
=
debug_trace
++
export
CI_
JOB
_STAGE
=
test
++
CI_
JOB
_STAGE
=
test
++
export
CI_SERVER_NAME
=
GitLab
++
CI_SERVER_NAME
=
GitLab
++
export
CI_SERVER_VERSION
=
8.14.3-ee
...
...
doc/ci/yaml/README.md
View file @
4413d97b
...
...
@@ -153,7 +153,7 @@ thus allowing to fine tune them. Variables can be also defined on a
[
job level
](
#job-variables
)
.
Except for the user defined variables, there are also the ones set up by the
Runner itself. One example would be
`CI_
BUILD
_REF_NAME`
which has the value of
Runner itself. One example would be
`CI_
COMMIT
_REF_NAME`
which has the value of
the branch or tag name for which project is built. Apart from the variables
you can set in
`.gitlab-ci.yml`
, there are also the so called secret variables
which can be set in GitLab's UI.
...
...
@@ -252,7 +252,7 @@ To enable per-job caching:
```
yaml
cache
:
key
:
"
$CI_
BUILD
_NAME"
key
:
"
$CI_
JOB
_NAME"
untracked
:
true
```
...
...
@@ -260,7 +260,7 @@ To enable per-branch caching:
```
yaml
cache
:
key
:
"
$CI_
BUILD
_REF_NAME"
key
:
"
$CI_
COMMIT
_REF_NAME"
untracked
:
true
```
...
...
@@ -268,7 +268,7 @@ To enable per-job and per-branch caching:
```
yaml
cache
:
key
:
"
$CI_
BUILD_NAME/$CI_BUILD
_REF_NAME"
key
:
"
$CI_
JOB_NAME/$CI_COMMIT
_REF_NAME"
untracked
:
true
```
...
...
@@ -276,7 +276,7 @@ To enable per-branch and per-stage caching:
```
yaml
cache
:
key
:
"
$CI_
BUILD_STAGE/$CI_BUILD
_REF_NAME"
key
:
"
$CI_
JOB_STAGE/$CI_COMMIT
_REF_NAME"
untracked
:
true
```
...
...
@@ -285,7 +285,7 @@ If you use **Windows Batch** to run your shell scripts you need to replace
```
yaml
cache
:
key
:
"
%CI_
BUILD_STAGE%/%CI_BUILD
_REF_NAME%"
key
:
"
%CI_
JOB_STAGE%/%CI_COMMIT
_REF_NAME%"
untracked
:
true
```
...
...
@@ -739,12 +739,12 @@ deploy as review app:
stage
:
deploy
script
:
make deploy
environment
:
name
:
review/$CI_
BUILD
_REF_NAME
name
:
review/$CI_
COMMIT
_REF_NAME
url
:
https://$CI_ENVIRONMENT_SLUG.example.com/
```
The
`deploy as review app`
job will be marked as deployment to dynamically
create the
`review/$CI_
BUILD_REF_NAME`
environment, where
`$CI_BUILD
_REF_NAME`
create the
`review/$CI_
COMMIT_REF_NAME`
environment, where
`$CI_COMMIT
_REF_NAME`
is an
[
environment variable
][
variables
]
set by the Runner. The
`$CI_ENVIRONMENT_SLUG`
variable is based on the environment name, but suitable
for inclusion in URLs. In this case, if the
`deploy as review app`
job was run
...
...
@@ -850,7 +850,7 @@ To create an archive with a name of the current job:
```
yaml
job
:
artifacts
:
name
:
"
$CI_
BUILD
_NAME"
name
:
"
$CI_
JOB
_NAME"
```
To create an archive with a name of the current branch or tag including only
...
...
@@ -859,7 +859,7 @@ the files that are untracked by Git:
```
yaml
job
:
artifacts
:
name
:
"
$CI_
BUILD
_REF_NAME"
name
:
"
$CI_
COMMIT
_REF_NAME"
untracked
:
true
```
...
...
@@ -869,7 +869,7 @@ tag including only the files that are untracked by Git:
```
yaml
job
:
artifacts
:
name
:
"
${CI_
BUILD_NAME}_${CI_BUILD
_REF_NAME}"
name
:
"
${CI_
JOB_NAME}_${CI_COMMIT
_REF_NAME}"
untracked
:
true
```
...
...
@@ -878,7 +878,7 @@ To create an archive with a name of the current [stage](#stages) and branch name
```
yaml
job
:
artifacts
:
name
:
"
${CI_
BUILD_STAGE}_${CI_BUILD
_REF_NAME}"
name
:
"
${CI_
JOB_STAGE}_${CI_COMMIT
_REF_NAME}"
untracked
:
true
```
...
...
@@ -890,7 +890,7 @@ If you use **Windows Batch** to run your shell scripts you need to replace
```
yaml
job
:
artifacts
:
name
:
"
%CI_
BUILD_STAGE%_%CI_BUILD
_REF_NAME%"
name
:
"
%CI_
JOB_STAGE%_%CI_COMMIT
_REF_NAME%"
untracked
:
true
```
...
...
doc/user/project/new_ci_build_permissions_model.md
View file @
4413d97b
...
...
@@ -119,7 +119,7 @@ And then the users could also use it in their CI jobs all Docker related
commands to interact with GitLab Container Registry. For example:
```
docker login -u gitlab-ci-token -p $CI_
BUILD
_TOKEN registry.gitlab.com
docker login -u gitlab-ci-token -p $CI_
JOB
_TOKEN registry.gitlab.com
```
Using single token had multiple security implications:
...
...
@@ -208,7 +208,7 @@ This is how an example usage can look like:
```
test:
script:
- docker login -u gitlab-ci-token -p $CI_
BUILD
_TOKEN $CI_REGISTRY
- docker login -u gitlab-ci-token -p $CI_
JOB
_TOKEN $CI_REGISTRY
- docker pull $CI_REGISTRY/group/other-project:latest
- docker run $CI_REGISTRY/group/other-project:latest
```
...
...
lib/tasks/gitlab/dev.rake
View file @
4413d97b
...
...
@@ -4,7 +4,7 @@ namespace :gitlab do
task
:ee_compat_check
,
[
:branch
]
=>
:environment
do
|
_
,
args
|
opts
=
if
ENV
[
'CI'
]
{
branch:
ENV
[
'CI_
BUILD
_REF_NAME'
]
}
{
branch:
ENV
[
'CI_
COMMIT
_REF_NAME'
]
}
else
unless
args
[
:branch
]
puts
"Must specify a branch as an argument"
.
color
(
:red
)
...
...
spec/lib/expand_variables_spec.rb
View file @
4413d97b
...
...
@@ -45,10 +45,10 @@ describe ExpandVariables do
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
}
]
},
{
value:
'review/$CI_
BUILD
_REF_NAME'
,
{
value:
'review/$CI_
COMMIT
_REF_NAME'
,
result:
'review/feature/add-review-apps'
,
variables:
[
{
key:
'CI_
BUILD
_REF_NAME'
,
value:
'feature/add-review-apps'
}
{
key:
'CI_
COMMIT
_REF_NAME'
,
value:
'feature/add-review-apps'
}
]
},
]
...
...
spec/lib/gitlab/ci/config/entry/environment_spec.rb
View file @
4413d97b
...
...
@@ -151,8 +151,8 @@ describe Gitlab::Ci::Config::Entry::Environment do
context
'when variables are used for environment'
do
let
(
:config
)
do
{
name:
'review/$CI_
BUILD
_REF_NAME'
,
url:
'https://$CI_
BUILD
_REF_NAME.review.gitlab.com'
}
{
name:
'review/$CI_
COMMIT
_REF_NAME'
,
url:
'https://$CI_
COMMIT
_REF_NAME.review.gitlab.com'
}
end
describe
'#valid?'
do
...
...
spec/models/environment_spec.rb
View file @
4413d97b
...
...
@@ -239,7 +239,7 @@ describe Environment, models: true do
describe
'#actions_for'
do
let
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
let
(
:pipeline
)
{
deployment
.
deployable
.
pipeline
}
let!
(
:review_action
)
{
create
(
:ci_build
,
:manual
,
name:
'review-apps'
,
pipeline:
pipeline
,
environment:
'review/$CI_
BUILD
_REF_NAME'
)}
let!
(
:review_action
)
{
create
(
:ci_build
,
:manual
,
name:
'review-apps'
,
pipeline:
pipeline
,
environment:
'review/$CI_
COMMIT
_REF_NAME'
)}
let!
(
:production_action
)
{
create
(
:ci_build
,
:manual
,
name:
'production'
,
pipeline:
pipeline
,
environment:
'production'
)}
it
'returns a list of actions with matching environment'
do
...
...
spec/requests/api/runner_spec.rb
View file @
4413d97b
...
...
@@ -312,8 +312,8 @@ describe API::Runner do
end
let
(
:expected_variables
)
do
[{
'key'
=>
'CI_
BUILD
_NAME'
,
'value'
=>
'spinach'
,
'public'
=>
true
},
{
'key'
=>
'CI_
BUILD
_STAGE'
,
'value'
=>
'test'
,
'public'
=>
true
},
[{
'key'
=>
'CI_
JOB
_NAME'
,
'value'
=>
'spinach'
,
'public'
=>
true
},
{
'key'
=>
'CI_
JOB
_STAGE'
,
'value'
=>
'test'
,
'public'
=>
true
},
{
'key'
=>
'DB_NAME'
,
'value'
=>
'postgres'
,
'public'
=>
true
}]
end
...
...
@@ -437,9 +437,9 @@ describe API::Runner do
context
'when triggered job is available'
do
let
(
:expected_variables
)
do
[{
'key'
=>
'CI_
BUILD
_NAME'
,
'value'
=>
'spinach'
,
'public'
=>
true
},
{
'key'
=>
'CI_
BUILD
_STAGE'
,
'value'
=>
'test'
,
'public'
=>
true
},
{
'key'
=>
'CI_
BUILD
_TRIGGERED'
,
'value'
=>
'true'
,
'public'
=>
true
},
[{
'key'
=>
'CI_
JOB
_NAME'
,
'value'
=>
'spinach'
,
'public'
=>
true
},
{
'key'
=>
'CI_
JOB
_STAGE'
,
'value'
=>
'test'
,
'public'
=>
true
},
{
'key'
=>
'CI_
PIPELINE
_TRIGGERED'
,
'value'
=>
'true'
,
'public'
=>
true
},
{
'key'
=>
'DB_NAME'
,
'value'
=>
'postgres'
,
'public'
=>
true
},
{
'key'
=>
'SECRET_KEY'
,
'value'
=>
'secret_value'
,
'public'
=>
false
},
{
'key'
=>
'TRIGGER_KEY_1'
,
'value'
=>
'TRIGGER_VALUE_1'
,
'public'
=>
false
}]
...
...
spec/requests/ci/api/builds_spec.rb
View file @
4413d97b
...
...
@@ -81,8 +81,8 @@ describe Ci::API::Builds do
expect
(
runner
.
reload
.
platform
).
to
eq
(
"darwin"
)
expect
(
json_response
[
"options"
]).
to
eq
({
"image"
=>
"ruby:2.1"
,
"services"
=>
[
"postgres"
]
})
expect
(
json_response
[
"variables"
]).
to
include
(
{
"key"
=>
"CI_
BUILD
_NAME"
,
"value"
=>
"spinach"
,
"public"
=>
true
},
{
"key"
=>
"CI_
BUILD
_STAGE"
,
"value"
=>
"test"
,
"public"
=>
true
},
{
"key"
=>
"CI_
JOB
_NAME"
,
"value"
=>
"spinach"
,
"public"
=>
true
},
{
"key"
=>
"CI_
JOB
_STAGE"
,
"value"
=>
"test"
,
"public"
=>
true
},
{
"key"
=>
"DB_NAME"
,
"value"
=>
"postgres"
,
"public"
=>
true
}
)
end
...
...
@@ -182,9 +182,9 @@ describe Ci::API::Builds do
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"variables"
]).
to
include
(
{
"key"
=>
"CI_
BUILD
_NAME"
,
"value"
=>
"spinach"
,
"public"
=>
true
},
{
"key"
=>
"CI_
BUILD
_STAGE"
,
"value"
=>
"test"
,
"public"
=>
true
},
{
"key"
=>
"CI_
BUILD
_TRIGGERED"
,
"value"
=>
"true"
,
"public"
=>
true
},
{
"key"
=>
"CI_
JOB
_NAME"
,
"value"
=>
"spinach"
,
"public"
=>
true
},
{
"key"
=>
"CI_
JOB
_STAGE"
,
"value"
=>
"test"
,
"public"
=>
true
},
{
"key"
=>
"CI_
PIPELINE
_TRIGGERED"
,
"value"
=>
"true"
,
"public"
=>
true
},
{
"key"
=>
"DB_NAME"
,
"value"
=>
"postgres"
,
"public"
=>
true
},
{
"key"
=>
"SECRET_KEY"
,
"value"
=>
"secret_value"
,
"public"
=>
false
},
{
"key"
=>
"TRIGGER_KEY_1"
,
"value"
=>
"TRIGGER_VALUE_1"
,
"public"
=>
false
},
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
4413d97b
...
...
@@ -200,7 +200,7 @@ describe Ci::CreatePipelineService, services: true do
context
'with environment'
do
before
do
config
=
YAML
.
dump
(
deploy:
{
environment:
{
name:
"review/$CI_
BUILD
_REF_NAME"
},
script:
'ls'
})
config
=
YAML
.
dump
(
deploy:
{
environment:
{
name:
"review/$CI_
COMMIT
_REF_NAME"
},
script:
'ls'
})
stub_ci_pipeline_yaml_file
(
config
)
end
...
...
spec/services/create_deployment_service_spec.rb
View file @
4413d97b
...
...
@@ -104,16 +104,16 @@ describe CreateDeploymentService, services: true do
context
'when variables are used'
do
let
(
:params
)
do
{
environment:
'review-apps/$CI_
BUILD
_REF_NAME'
,
environment:
'review-apps/$CI_
COMMIT
_REF_NAME'
,
ref:
'master'
,
tag:
false
,
sha:
'97de212e80737a608d939f648d959671fb0a0142'
,
options:
{
name:
'review-apps/$CI_
BUILD
_REF_NAME'
,
url:
'http://$CI_
BUILD
_REF_NAME.review-apps.gitlab.com'
name:
'review-apps/$CI_
COMMIT
_REF_NAME'
,
url:
'http://$CI_
COMMIT
_REF_NAME.review-apps.gitlab.com'
},
variables:
[
{
key:
'CI_
BUILD
_REF_NAME'
,
value:
'feature-review-apps'
}
{
key:
'CI_
COMMIT
_REF_NAME'
,
value:
'feature-review-apps'
}
]
}
end
...
...
spec/simplecov_env.rb
View file @
4413d97b
...
...
@@ -15,9 +15,9 @@ module SimpleCovEnv
def
configure_job
SimpleCov
.
configure
do
if
ENV
[
'CI_
BUILD
_NAME'
]
coverage_dir
"coverage/
#{
ENV
[
'CI_
BUILD
_NAME'
]
}
"
command_name
ENV
[
'CI_
BUILD
_NAME'
]
if
ENV
[
'CI_
JOB
_NAME'
]
coverage_dir
"coverage/
#{
ENV
[
'CI_
JOB
_NAME'
]
}
"
command_name
ENV
[
'CI_
JOB
_NAME'
]
end
if
ENV
[
'CI'
]
...
...
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