Class: UffizziCore::AmazonService
- Inherits:
-
Object
- Object
- UffizziCore::AmazonService
- Defined in:
- app/services/uffizzi_core/amazon_service.rb
Class Method Summary collapse
- .digest(credential, image, tag) ⇒ Object
- .get_region_from_registry_url(url) ⇒ Object
- .process_webhook(event, event_data) ⇒ Object
Class Method Details
.digest(credential, image, tag) ⇒ Object
5 6 7 8 9 10 |
# File 'app/services/uffizzi_core/amazon_service.rb', line 5 def digest(credential, image, tag) response = client(credential).batch_get_image(image: image, tag: tag) response.images[0].image_id.image_digest rescue StandardError nil end |
.get_region_from_registry_url(url) ⇒ Object
12 13 14 15 16 17 |
# File 'app/services/uffizzi_core/amazon_service.rb', line 12 def get_region_from_registry_url(url) parsed_url = URI.parse(url) host = parsed_url.host parsed_host = host.split('.') parsed_host[3] end |
.process_webhook(event, event_data) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/services/uffizzi_core/amazon_service.rb', line 19 def process_webhook(event, event_data) case event when 'PUSH' source = UffizziCore::Repo::Amazon.name image = event_data['repository-name'] tag = event_data['image-tag'] UffizziCore::ContinuouslyDeployService.run_docker_registry_process(source, image, tag) UffizziCore::ContinuousPreviewService.run_docker_registry_process(source, image, tag) else Rails.logger.warn("Amazon #{event} event doesn't support") end end |