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
Boxiang Sun
gitlab-ce
Commits
da6157a5
Commit
da6157a5
authored
Feb 23, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move some predefined variables to reflect hierarchy
parent
76cf6c6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
app/models/ci/build.rb
app/models/ci/build.rb
+0
-11
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+11
-1
app/models/project.rb
app/models/project.rb
+4
-1
No files found.
app/models/ci/build.rb
View file @
da6157a5
...
...
@@ -282,19 +282,14 @@ module Ci
# contain unexpanded variables.
def
variables
(
environment:
persisted_environment
)
variables
=
predefined_variables
variables
+=
project
.
predefined_variables
variables
+=
pipeline
.
predefined_variables
variables
+=
runner
.
predefined_variables
if
runner
variables
+=
project
.
container_registry_variables
variables
+=
project
.
deployment_variables
if
has_environment?
variables
+=
project
.
auto_devops_variables
variables
+=
yaml_variables
variables
+=
user_variables
variables
+=
project
.
group
.
secret_variables_for
(
ref
,
project
).
map
(
&
:to_runner_variable
)
if
project
.
group
variables
+=
secret_variables
(
environment:
environment
)
variables
+=
trigger_request
.
user_variables
if
trigger_request
variables
+=
pipeline
.
variables
.
map
(
&
:to_runner_variable
)
variables
+=
pipeline
.
pipeline_schedule
.
job_variables
if
pipeline
.
pipeline_schedule
variables
+=
persisted_environment_variables
if
environment
variables
...
...
@@ -570,12 +565,6 @@ module Ci
def
predefined_variables
variables
=
[
{
key:
'CI'
,
value:
'true'
,
public:
true
},
{
key:
'GITLAB_CI'
,
value:
'true'
,
public:
true
},
{
key:
'GITLAB_FEATURES'
,
value:
project
.
namespace
.
features
.
join
(
','
),
public:
true
},
{
key:
'CI_SERVER_NAME'
,
value:
'GitLab'
,
public:
true
},
{
key:
'CI_SERVER_VERSION'
,
value:
Gitlab
::
VERSION
,
public:
true
},
{
key:
'CI_SERVER_REVISION'
,
value:
Gitlab
::
REVISION
,
public:
true
},
{
key:
'CI_JOB_ID'
,
value:
id
.
to_s
,
public:
true
},
{
key:
'CI_JOB_NAME'
,
value:
name
,
public:
true
},
{
key:
'CI_JOB_STAGE'
,
value:
stage
,
public:
true
},
...
...
app/models/ci/pipeline.rb
View file @
da6157a5
...
...
@@ -473,11 +473,21 @@ module Ci
end
def
predefined_variables
[
variables
=
[
{
key:
'CI'
,
value:
'true'
,
public:
true
},
{
key:
'GITLAB_CI'
,
value:
'true'
,
public:
true
},
{
key:
'GITLAB_FEATURES'
,
value:
project
.
namespace
.
features
.
join
(
','
),
public:
true
},
{
key:
'CI_SERVER_NAME'
,
value:
'GitLab'
,
public:
true
},
{
key:
'CI_SERVER_VERSION'
,
value:
Gitlab
::
VERSION
,
public:
true
},
{
key:
'CI_SERVER_REVISION'
,
value:
Gitlab
::
REVISION
,
public:
true
},
{
key:
'CI_PIPELINE_ID'
,
value:
id
.
to_s
,
public:
true
},
{
key:
'CI_CONFIG_PATH'
,
value:
ci_yaml_file_path
,
public:
true
},
{
key:
'CI_PIPELINE_SOURCE'
,
value:
source
.
to_s
,
public:
true
}
]
variables
+=
project
.
predefined_variables
variables
+=
variables
.
map
(
&
:to_runner_variable
)
variables
+=
pipeline_schedule
.
job_variables
if
pipeline_schedule
end
def
queued_duration
...
...
app/models/project.rb
View file @
da6157a5
...
...
@@ -1554,7 +1554,7 @@ class Project < ActiveRecord::Base
end
def
predefined_variables
[
variables
=
[
{
key:
'CI_PROJECT_ID'
,
value:
id
.
to_s
,
public:
true
},
{
key:
'CI_PROJECT_NAME'
,
value:
path
,
public:
true
},
{
key:
'CI_PROJECT_PATH'
,
value:
full_path
,
public:
true
},
...
...
@@ -1563,6 +1563,9 @@ class Project < ActiveRecord::Base
{
key:
'CI_PROJECT_URL'
,
value:
web_url
,
public:
true
},
{
key:
'CI_PROJECT_VISIBILITY'
,
value:
Gitlab
::
VisibilityLevel
.
string_level
(
visibility_level
),
public:
true
}
]
variables
+=
container_registry_variables
variables
+=
auto_devops_variables
end
def
container_registry_variables
...
...
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