Commit ba94a28c authored by DJ Mountney's avatar DJ Mountney Committed by DJ Mountney

Merge branch 'sync-ce-images' into 'master'

Add code to sync CE images from dev to com

Closes #1287

See merge request !760
parent 79ba6ee3
Pipeline #56612639 passed with stages
in 41 minutes and 7 seconds
......@@ -666,7 +666,8 @@ sync_images:
DOCKER_HOST: tcp://docker:2375
script:
- bundle install
- bundle exec rake images:sync
- bundle exec rake images:sync[ee]
- bundle exec rake images:sync[ce]
only:
- tags@gitlab/charts/gitlab
......
......@@ -3,7 +3,7 @@ require_relative 'scripts/update-docker-images.rb'
namespace :images do
desc 'Sync images between dev and com registries'
task :sync do
CNGImageSync.execute
task :sync, [:edition] do |t, args|
CNGImageSync.execute(edition: args[:edition])
end
end
......@@ -33,7 +33,7 @@ class CNGImageSync
end
def get_components(version)
artifact_uri = URI("#{CI_API_V4_URL}/projects/#{CGI.escape(DEV_PROJECT_PATH)}/jobs/artifacts/v#{version}-ee/raw/artifacts/image_versions.txt?job=component-details")
artifact_uri = URI("#{CI_API_V4_URL}/projects/#{CGI.escape(DEV_PROJECT_PATH)}/jobs/artifacts/v#{version}/raw/artifacts/image_versions.txt?job=component-details")
puts "Fetching component list from #{artifact_uri}"
res = get_api(artifact_uri)
components = res.body.split("\n")
......@@ -79,11 +79,12 @@ class CNGImageSync
raise message if COM_REGISTRY_PASSWORD.nil?
end
def execute
def execute(edition: 'ee')
check_auth
puts "Syncing images for version #{GITLAB_VERSION}"
components = get_components(GITLAB_VERSION)
version = edition == 'ce' ? GITLAB_VERSION : "#{GITLAB_VERSION}-ee"
puts "Syncing images for version #{version}"
components = get_components(version)
authenticate_registry(DEV_REGISTRY_URL, DEV_REGISTRY_PASSWORD)
pull_and_tag_images(DEV_PROJECT_REGISTRY, COM_PROJECT_REGISTRY, components)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment