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
4df94e2d
Commit
4df94e2d
authored
Nov 20, 2020
by
Vladimir Shushlin
Committed by
Kamil Trzciński
Nov 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove serving pages from artifacts archives
parent
977fb981
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
87 deletions
+13
-87
app/models/pages/lookup_path.rb
app/models/pages/lookup_path.rb
+13
-20
config/feature_flags/development/pages_serve_from_artifacts_archive.yml
..._flags/development/pages_serve_from_artifacts_archive.yml
+0
-8
spec/models/pages/lookup_path_spec.rb
spec/models/pages/lookup_path_spec.rb
+0
-59
No files found.
app/models/pages/lookup_path.rb
View file @
4df94e2d
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
Pages
module
Pages
class
LookupPath
class
LookupPath
include
Gitlab
::
Utils
::
StrongMemoize
def
initialize
(
project
,
trim_prefix:
nil
,
domain:
nil
)
def
initialize
(
project
,
trim_prefix:
nil
,
domain:
nil
)
@project
=
project
@project
=
project
@domain
=
domain
@domain
=
domain
...
@@ -37,37 +39,28 @@ module Pages
...
@@ -37,37 +39,28 @@ module Pages
attr_reader
:project
,
:trim_prefix
,
:domain
attr_reader
:project
,
:trim_prefix
,
:domain
def
artifacts_archive
return
unless
Feature
.
enabled?
(
:pages_serve_from_artifacts_archive
,
project
)
project
.
pages_metadatum
.
artifacts_archive
end
def
deployment
def
deployment
return
unless
Feature
.
enabled?
(
:pages_serve_from_deployments
,
project
)
strong_memoize
(
:deployment
)
do
next
unless
Feature
.
enabled?
(
:pages_serve_from_deployments
,
project
)
project
.
pages_metadatum
.
pages_deployment
project
.
pages_metadatum
.
pages_deployment
end
end
end
def
zip_source
def
zip_source
source
=
deployment
||
artifacts_archive
return
unless
deployment
&
.
file
return
unless
source
&
.
file
return
if
source
.
file
.
file_storage?
&&
!
Feature
.
enabled?
(
:pages_serve_with_zip_file_protocol
,
project
)
# artifacts archive doesn't support this
return
if
deployment
.
file
.
file_storage?
&&
!
Feature
.
enabled?
(
:pages_serve_with_zip_file_protocol
,
project
)
file_count
=
source
.
file_count
if
source
.
respond_to?
(
:file_count
)
global_id
=
::
Gitlab
::
GlobalId
.
build
(
source
,
id:
source
.
id
).
to_s
global_id
=
::
Gitlab
::
GlobalId
.
build
(
deployment
,
id:
deployment
.
id
).
to_s
{
{
type:
'zip'
,
type:
'zip'
,
path:
source
.
file
.
url_or_file_path
(
expire_at:
1
.
day
.
from_now
),
path:
deployment
.
file
.
url_or_file_path
(
expire_at:
1
.
day
.
from_now
),
global_id:
global_id
,
global_id:
global_id
,
sha256:
source
.
file_sha256
,
sha256:
deployment
.
file_sha256
,
file_size:
source
.
size
,
file_size:
deployment
.
size
,
file_count:
file_count
file_count:
deployment
.
file_count
}
}
end
end
...
...
config/feature_flags/development/pages_serve_from_artifacts_archive.yml
deleted
100644 → 0
View file @
977fb981
---
name
:
pages_serve_from_artifacts_archive
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46320
rollout_issue_url
:
group
:
group::release management
milestone
:
'
13.4'
type
:
development
default_enabled
:
false
spec/models/pages/lookup_path_spec.rb
View file @
4df94e2d
...
@@ -9,7 +9,6 @@ RSpec.describe Pages::LookupPath do
...
@@ -9,7 +9,6 @@ RSpec.describe Pages::LookupPath do
before
do
before
do
stub_pages_setting
(
access_control:
true
,
external_https:
[
"1.1.1.1:443"
])
stub_pages_setting
(
access_control:
true
,
external_https:
[
"1.1.1.1:443"
])
stub_artifacts_object_storage
stub_pages_object_storage
(
::
Pages
::
DeploymentUploader
)
stub_pages_object_storage
(
::
Pages
::
DeploymentUploader
)
end
end
...
@@ -117,64 +116,6 @@ RSpec.describe Pages::LookupPath do
...
@@ -117,64 +116,6 @@ RSpec.describe Pages::LookupPath do
include_examples
'uses disk storage'
include_examples
'uses disk storage'
end
end
end
end
context
'when artifact_id from build job is present in pages metadata'
do
let
(
:artifacts_archive
)
{
create
(
:ci_job_artifact
,
:zip
,
:remote_store
,
project:
project
)
}
before
do
project
.
mark_pages_as_deployed
(
artifacts_archive:
artifacts_archive
)
end
it
'uses artifacts object storage'
do
Timecop
.
freeze
do
expect
(
source
).
to
(
eq
({
type:
'zip'
,
path:
artifacts_archive
.
file
.
url
(
expire_at:
1
.
day
.
from_now
),
global_id:
"gid://gitlab/Ci::JobArtifact/
#{
artifacts_archive
.
id
}
"
,
sha256:
artifacts_archive
.
file_sha256
,
file_size:
artifacts_archive
.
size
,
file_count:
nil
})
)
end
end
context
'when artifact is not uploaded to object storage'
do
let
(
:artifacts_archive
)
{
create
(
:ci_job_artifact
,
:zip
)
}
it
'uses file protocol'
,
:aggregate_failures
do
Timecop
.
freeze
do
expect
(
source
).
to
(
eq
({
type:
'zip'
,
path:
'file://'
+
artifacts_archive
.
file
.
path
,
global_id:
"gid://gitlab/Ci::JobArtifact/
#{
artifacts_archive
.
id
}
"
,
sha256:
artifacts_archive
.
file_sha256
,
file_size:
artifacts_archive
.
size
,
file_count:
nil
})
)
end
end
context
'when pages_serve_with_zip_file_protocol feature flag is disabled'
do
before
do
stub_feature_flags
(
pages_serve_with_zip_file_protocol:
false
)
end
include_examples
'uses disk storage'
end
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
pages_serve_from_artifacts_archive:
false
)
end
include_examples
'uses disk storage'
end
end
end
end
describe
'#prefix'
do
describe
'#prefix'
do
...
...
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