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
8d3e66d5
Commit
8d3e66d5
authored
Feb 26, 2021
by
Eric Engestrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY up "#{Gitlab.config.gitlab.host}:#{Gitlab.config.gitlab.port}"
parent
cd2f34b7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
7 deletions
+11
-7
app/models/project.rb
app/models/project.rb
+2
-2
lib/gitlab.rb
lib/gitlab.rb
+4
-0
lib/gitlab/ci/build/credentials/registry/dependency_proxy.rb
lib/gitlab/ci/build/credentials/registry/dependency_proxy.rb
+1
-1
spec/lib/gitlab/url_blocker_spec.rb
spec/lib/gitlab/url_blocker_spec.rb
+2
-2
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+2
-2
No files found.
app/models/project.rb
View file @
8d3e66d5
...
...
@@ -2026,10 +2026,10 @@ class Project < ApplicationRecord
Gitlab
::
Ci
::
Variables
::
Collection
.
new
.
tap
do
|
variables
|
break
variables
unless
Gitlab
.
config
.
dependency_proxy
.
enabled
variables
.
append
(
key:
'CI_DEPENDENCY_PROXY_SERVER'
,
value:
"
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
"
)
variables
.
append
(
key:
'CI_DEPENDENCY_PROXY_SERVER'
,
value:
Gitlab
.
host_with_port
)
variables
.
append
(
key:
'CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX'
,
value:
"
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
/
#{
namespace
.
root_ancestor
.
path
}#{
DependencyProxy
::
URL_SUFFIX
}
"
value:
"
#{
Gitlab
.
host_with_
port
}
/
#{
namespace
.
root_ancestor
.
path
}#{
DependencyProxy
::
URL_SUFFIX
}
"
)
end
end
...
...
lib/gitlab.rb
View file @
8d3e66d5
...
...
@@ -19,6 +19,10 @@ module Gitlab
Settings
end
def
self
.
host_with_port
"
#{
self
.
config
.
gitlab
.
host
}
:
#{
self
.
config
.
gitlab
.
port
}
"
end
def
self
.
revision
@_revision
||=
begin
if
File
.
exist?
(
root
.
join
(
"REVISION"
))
...
...
lib/gitlab/ci/build/credentials/registry/dependency_proxy.rb
View file @
8d3e66d5
...
...
@@ -7,7 +7,7 @@ module Gitlab
module
Registry
class
DependencyProxy
<
GitlabRegistry
def
url
"
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
"
Gitlab
.
host_with_port
end
def
valid?
...
...
spec/lib/gitlab/url_blocker_spec.rb
View file @
8d3e66d5
...
...
@@ -166,7 +166,7 @@ RSpec.describe Gitlab::UrlBlocker, :stub_invalid_dns_only do
let
(
:ports
)
{
Project
::
VALID_IMPORT_PORTS
}
it
'allows imports from configured web host and port'
do
import_url
=
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
/t.git"
import_url
=
"http://
#{
Gitlab
.
host_with_
port
}
/t.git"
expect
(
described_class
.
blocked_url?
(
import_url
)).
to
be
false
end
...
...
@@ -190,7 +190,7 @@ RSpec.describe Gitlab::UrlBlocker, :stub_invalid_dns_only do
end
it
'returns true for bad protocol on configured web/SSH host and ports'
do
web_url
=
"javascript://
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
/t.git%0aalert(1)"
web_url
=
"javascript://
#{
Gitlab
.
host_with_
port
}
/t.git%0aalert(1)"
expect
(
described_class
.
blocked_url?
(
web_url
)).
to
be
true
ssh_url
=
"javascript://
#{
Gitlab
.
config
.
gitlab_shell
.
ssh_host
}
:
#{
Gitlab
.
config
.
gitlab_shell
.
ssh_port
}
/t.git%0aalert(1)"
...
...
spec/models/ci/build_spec.rb
View file @
8d3e66d5
...
...
@@ -2464,9 +2464,9 @@ RSpec.describe Ci::Build do
{
key:
'CI_CONFIG_PATH'
,
value:
project
.
ci_config_path_or_default
,
public:
true
,
masked:
false
},
{
key:
'CI_PAGES_DOMAIN'
,
value:
Gitlab
.
config
.
pages
.
host
,
public:
true
,
masked:
false
},
{
key:
'CI_PAGES_URL'
,
value:
project
.
pages_url
,
public:
true
,
masked:
false
},
{
key:
'CI_DEPENDENCY_PROXY_SERVER'
,
value:
"
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
"
,
public:
true
,
masked:
false
},
{
key:
'CI_DEPENDENCY_PROXY_SERVER'
,
value:
Gitlab
.
host_with_port
,
public:
true
,
masked:
false
},
{
key:
'CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX'
,
value:
"
#{
Gitlab
.
config
.
gitlab
.
host
}
:
#{
Gitlab
.
config
.
gitlab
.
port
}
/
#{
project
.
namespace
.
root_ancestor
.
path
}#{
DependencyProxy
::
URL_SUFFIX
}
"
,
value:
"
#{
Gitlab
.
host_with_
port
}
/
#{
project
.
namespace
.
root_ancestor
.
path
}#{
DependencyProxy
::
URL_SUFFIX
}
"
,
public:
true
,
masked:
false
},
{
key:
'CI_API_V4_URL'
,
value:
'http://localhost/api/v4'
,
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