Skip to content
Snippets Groups Projects
Unverified Commit 7f278bb5 authored by Z.J. van de Weg's avatar Z.J. van de Weg Committed by Kamil Trzcinski
Browse files

Make object store with pages work

The S3 contents is downloaded to a tempfile, which is deleted by Ruby's
GC and closed/unlinked too in an ensure block. The tempfile is extracted
and placed in its usual place.
parent 4440380f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -24,6 +24,7 @@ module Projects
# Create temporary directory in which we will extract the artifacts
FileUtils.mkdir_p(tmp_path)
Dir.mktmpdir(nil, tmp_path) do |archive_path|
puts 'starting extraction'
extract_archive!(archive_path)
 
# Check if we did extract public directory
Loading
Loading
@@ -156,17 +157,17 @@ module Projects
# This is done using a tempfile as artifacts will be GC'ed
def extractable_artifacts
if Gitlab.config.artifacts.object_store.enabled
artifacts
else
temp_file.path
else
artifacts
end
end
 
def temp_file
@temp_file ||=
begin
file = Tempfile.new("pages-artifacts-#{job.id}")
File.open(file, 'wb') { file.write(job.artifacts_file.read) }
file = Tempfile.new(["#{job.id}-pages-artifacts", File.extname(artifacts)])
IO.binwrite(file, job.artifacts_file.read)
 
file
end
Loading
Loading
Loading
Loading
@@ -136,9 +136,15 @@ production: &base
## Build Artifacts
artifacts:
enabled: true
object_store: false
# The location where build artifacts are stored (default: shared/artifacts).
# path: shared/artifacts
object_store:
enabled: false
provider: AWS # Only AWS supported at the moment
access_key_id: VXKLW2P7WP83RM3OQAYU
secret_access_key: hEm7WuxW3Qct9tsxNqSw+iyP26fcCacz78vErkiI
bucket: docker
region: eu-central-1
 
## Git LFS
lfs:
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment