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
f0b2881b
Commit
f0b2881b
authored
Jan 24, 2020
by
Aidin Abedi
Committed by
Kamil Trzciński
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CI variables to provide GitLab port and protocol
parent
a39ccf33
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
0 deletions
+17
-0
app/models/project.rb
app/models/project.rb
+2
-0
changelogs/unreleased/23296-add-ci-variables-server-port-protocol.yml
...nreleased/23296-add-ci-variables-server-port-protocol.yml
+5
-0
doc/ci/variables/README.md
doc/ci/variables/README.md
+6
-0
doc/ci/variables/predefined_variables.md
doc/ci/variables/predefined_variables.md
+2
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+2
-0
No files found.
app/models/project.rb
View file @
f0b2881b
...
@@ -1938,6 +1938,8 @@ class Project < ApplicationRecord
...
@@ -1938,6 +1938,8 @@ class Project < ApplicationRecord
.
append
(
key:
'GITLAB_CI'
,
value:
'true'
)
.
append
(
key:
'GITLAB_CI'
,
value:
'true'
)
.
append
(
key:
'CI_SERVER_URL'
,
value:
Gitlab
.
config
.
gitlab
.
url
)
.
append
(
key:
'CI_SERVER_URL'
,
value:
Gitlab
.
config
.
gitlab
.
url
)
.
append
(
key:
'CI_SERVER_HOST'
,
value:
Gitlab
.
config
.
gitlab
.
host
)
.
append
(
key:
'CI_SERVER_HOST'
,
value:
Gitlab
.
config
.
gitlab
.
host
)
.
append
(
key:
'CI_SERVER_PORT'
,
value:
Gitlab
.
config
.
gitlab
.
port
.
to_s
)
.
append
(
key:
'CI_SERVER_PROTOCOL'
,
value:
Gitlab
.
config
.
gitlab
.
protocol
)
.
append
(
key:
'CI_SERVER_NAME'
,
value:
'GitLab'
)
.
append
(
key:
'CI_SERVER_NAME'
,
value:
'GitLab'
)
.
append
(
key:
'CI_SERVER_VERSION'
,
value:
Gitlab
::
VERSION
)
.
append
(
key:
'CI_SERVER_VERSION'
,
value:
Gitlab
::
VERSION
)
.
append
(
key:
'CI_SERVER_VERSION_MAJOR'
,
value:
Gitlab
.
version_info
.
major
.
to_s
)
.
append
(
key:
'CI_SERVER_VERSION_MAJOR'
,
value:
Gitlab
.
version_info
.
major
.
to_s
)
...
...
changelogs/unreleased/23296-add-ci-variables-server-port-protocol.yml
0 → 100644
View file @
f0b2881b
---
title
:
Add CI variables to provide GitLab port and protocol
merge_request
:
23296
author
:
Aidin Abedi
type
:
added
doc/ci/variables/README.md
View file @
f0b2881b
...
@@ -292,6 +292,8 @@ export CI_RUNNER_TAGS="docker, linux"
...
@@ -292,6 +292,8 @@ export CI_RUNNER_TAGS="docker, linux"
export
CI_SERVER
=
"yes"
export
CI_SERVER
=
"yes"
export
CI_SERVER_URL
=
"https://example.com"
export
CI_SERVER_URL
=
"https://example.com"
export
CI_SERVER_HOST
=
"example.com"
export
CI_SERVER_HOST
=
"example.com"
export
CI_SERVER_PORT
=
"443"
export
CI_SERVER_PROTOCOL
=
"https"
export
CI_SERVER_NAME
=
"GitLab"
export
CI_SERVER_NAME
=
"GitLab"
export
CI_SERVER_REVISION
=
"70606bf"
export
CI_SERVER_REVISION
=
"70606bf"
export
CI_SERVER_VERSION
=
"8.9.0"
export
CI_SERVER_VERSION
=
"8.9.0"
...
@@ -686,6 +688,10 @@ if [[ -d "/builds/gitlab-examples/ci-debug-trace/.git" ]]; then
...
@@ -686,6 +688,10 @@ if [[ -d "/builds/gitlab-examples/ci-debug-trace/.git" ]]; then
++ CI_SERVER_URL=https://gitlab.com:3000
++ CI_SERVER_URL=https://gitlab.com:3000
++ export CI_SERVER_HOST=gitlab.com
++ export CI_SERVER_HOST=gitlab.com
++ CI_SERVER_HOST=gitlab.com
++ CI_SERVER_HOST=gitlab.com
++ export CI_SERVER_PORT=3000
++ CI_SERVER_PORT=3000
++ export CI_SERVER_PROTOCOL=https
++ CI_SERVER_PROTOCOL=https
++ export CI_SERVER_NAME=GitLab
++ export CI_SERVER_NAME=GitLab
++ CI_SERVER_NAME=GitLab
++ CI_SERVER_NAME=GitLab
++ export CI_SERVER_VERSION=12.6.0-pre
++ export CI_SERVER_VERSION=12.6.0-pre
...
...
doc/ci/variables/predefined_variables.md
View file @
f0b2881b
...
@@ -114,6 +114,8 @@ future GitLab releases.**
...
@@ -114,6 +114,8 @@ future GitLab releases.**
|
`CI_SERVER`
| all | all | Mark that job is executed in CI environment |
|
`CI_SERVER`
| all | all | Mark that job is executed in CI environment |
|
`CI_SERVER_URL`
| 12.7 | all | The base URL of the GitLab instance, including protocol and port (like
`https://gitlab.example.com:8080`
) |
|
`CI_SERVER_URL`
| 12.7 | all | The base URL of the GitLab instance, including protocol and port (like
`https://gitlab.example.com:8080`
) |
|
`CI_SERVER_HOST`
| 12.1 | all | Host component of the GitLab instance URL, without protocol and port (like
`gitlab.example.com`
) |
|
`CI_SERVER_HOST`
| 12.1 | all | Host component of the GitLab instance URL, without protocol and port (like
`gitlab.example.com`
) |
|
`CI_SERVER_PORT`
| 12.8 | all | Port component of the GitLab instance URL, without host and protocol (like
`3000`
) |
|
`CI_SERVER_PROTOCOL`
| 12.8 | all | Protocol component of the GitLab instance URL, without host and port (like
`https`
) |
|
`CI_SERVER_NAME`
| all | all | The name of CI server that is used to coordinate jobs |
|
`CI_SERVER_NAME`
| all | all | The name of CI server that is used to coordinate jobs |
|
`CI_SERVER_REVISION`
| all | all | GitLab revision that is used to schedule jobs |
|
`CI_SERVER_REVISION`
| all | all | GitLab revision that is used to schedule jobs |
|
`CI_SERVER_VERSION`
| all | all | GitLab version that is used to schedule jobs |
|
`CI_SERVER_VERSION`
| all | all | GitLab version that is used to schedule jobs |
...
...
spec/models/ci/build_spec.rb
View file @
f0b2881b
...
@@ -2391,6 +2391,8 @@ describe Ci::Build do
...
@@ -2391,6 +2391,8 @@ describe Ci::Build do
{
key:
'GITLAB_CI'
,
value:
'true'
,
public:
true
,
masked:
false
},
{
key:
'GITLAB_CI'
,
value:
'true'
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_URL'
,
value:
Gitlab
.
config
.
gitlab
.
url
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_URL'
,
value:
Gitlab
.
config
.
gitlab
.
url
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_HOST'
,
value:
Gitlab
.
config
.
gitlab
.
host
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_HOST'
,
value:
Gitlab
.
config
.
gitlab
.
host
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_PORT'
,
value:
Gitlab
.
config
.
gitlab
.
port
.
to_s
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_PROTOCOL'
,
value:
Gitlab
.
config
.
gitlab
.
protocol
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_NAME'
,
value:
'GitLab'
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_NAME'
,
value:
'GitLab'
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_VERSION'
,
value:
Gitlab
::
VERSION
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_VERSION'
,
value:
Gitlab
::
VERSION
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_VERSION_MAJOR'
,
value:
Gitlab
.
version_info
.
major
.
to_s
,
public:
true
,
masked:
false
},
{
key:
'CI_SERVER_VERSION_MAJOR'
,
value:
Gitlab
.
version_info
.
major
.
to_s
,
public:
true
,
masked:
false
},
...
...
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