Skip to content

Commit 6f3d4a4

Browse files
Robert Marshallbalasankarc
andcommitted
Merge branch 'stop-syncing-packages-to-s3' into 'master'
Stop syncing packages to S3 bucket Closes https://gitlab.com/gitlab-org/security/omnibus-gitlab/-/issues/3 See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7057 Merged-by: Robert Marshall <[email protected]> Approved-by: Andrew Patterson <[email protected]> Co-authored-by: Balasankar "Balu" C <[email protected]>
2 parents 853b0bb + cd5e9fe commit 6f3d4a4

File tree

5 files changed

+10
-40
lines changed

5 files changed

+10
-40
lines changed

.gitlab-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ variables:
108108
paths:
109109
- gems
110110

111+
.build-package: &build-package
112+
- bundle exec rake cache:populate
113+
- bundle exec rake cache:restore
114+
- bundle exec rake build:project
115+
- bundle exec rake build:package:sync
116+
- bundle exec rake cache:bundle
117+
- bundle exec rake build:component_shas
118+
111119
before_script:
112120
- echo "PIPELINE_TYPE detected as ${PIPELINE_TYPE}"
113121
# Exit early if building on an OS for which we don't provide the specified

gitlab-ci-config/dev-gitlab-org.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@
4444
stage: package
4545
script:
4646
- support/import_gpg_secrets.sh
47-
- bundle exec rake cache:populate
48-
- bundle exec rake cache:restore
49-
- bundle exec rake build:project build:package:sync
50-
- bundle exec rake cache:bundle
51-
- bundle exec rake build:component_shas
47+
- !reference [.build-package]
5248
# Run package size checks on nightlies. The job will create alerts, so we
5349
# don't need it to fail and block the pipeline. Hence the `|| true`.
5450
- if [ -n "$NIGHTLY" ]; then

gitlab-ci-config/gitlab-com.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@
6262
- bundle install -j $(nproc)
6363
- bundle binstubs --all
6464

65-
.build-package: &build-package
66-
- bundle exec rake cache:populate
67-
- bundle exec rake cache:restore
68-
- bundle exec rake build:project
69-
- bundle exec rake cache:bundle
70-
- bundle exec rake build:component_shas
71-
7265
.trigger-package-common:
7366
extends: .trigger-package-cache
7467
variables:

lib/gitlab/build/info.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ def qa_image
2323
Gitlab::Util.get_env('QA_IMAGE') || "#{Gitlab::Util.get_env('CI_REGISTRY')}/#{Build::Info::Components::GitLabRails.project_path}/#{Build::Info::Package.name}-qa:#{Build::Info::Components::GitLabRails.ref(prepend_version: false)}"
2424
end
2525

26-
def release_bucket
27-
# Tag builds are releases and they get pushed to a specific S3 bucket
28-
# whereas regular branch builds use a separate one
29-
downloads_bucket = Gitlab::Util.get_env('RELEASE_BUCKET') || "downloads-packages"
30-
builds_bucket = Gitlab::Util.get_env('BUILDS_BUCKET') || "omnibus-builds"
31-
Check.on_tag? ? downloads_bucket : builds_bucket
32-
end
33-
34-
def release_bucket_region
35-
Gitlab::Util.get_env('RELEASE_BUCKET_REGION') || "eu-west-1"
36-
end
37-
38-
def release_bucket_s3_endpoint
39-
Gitlab::Util.get_env('RELEASE_BUCKET_S3_ENDPOINT') || "s3.amazonaws.com"
40-
end
41-
4226
def gcp_release_bucket
4327
# All tagged builds are pushed to the release bucket
4428
# whereas regular branch builds use a separate one

lib/gitlab/tasks/build.rake

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,13 @@ namespace :build do
7171
end
7272
end
7373

74-
desc "Sync packages to aws and gcp"
74+
desc "Sync packages to gcp"
7575
task :sync do
7676
Gitlab::Util.section('build:package:sync', collapsed: Build::Check.on_tag?) do
7777
puts '---- Syncing packages to GCP'
7878
puts GCloudHelper.gcs_sync!('pkg/')
7979
paths = Dir.glob('pkg/**/*').select { |f| File.file?(f) }.map { |p| p.gsub(%r[^pkg/], '') }
8080
puts GCloudHelper.signed_urls(paths)
81-
82-
puts '---- Syncing packages to AWS'
83-
release_bucket = Build::Info.release_bucket
84-
release_bucket_region = Build::Info.release_bucket_region
85-
release_bucket_s3_endpoint = Build::Info.release_bucket_s3_endpoint
86-
puts "AWS S3 Sync: Copying pkg/ contents to #{release_bucket_s3_endpoint}"
87-
system(*%W[aws s3 --endpoint-url https://#{release_bucket_s3_endpoint} sync pkg/ s3://#{release_bucket} --no-progress --acl public-read --region #{release_bucket_region}])
88-
files = Dir.glob('pkg/**/*').select { |f| File.file? f }
89-
files.each do |file|
90-
puts file.gsub('pkg', "https://#{release_bucket}.#{release_bucket_s3_endpoint}").gsub('+', '%2B')
91-
end
9281
end
9382
end
9483

0 commit comments

Comments
 (0)