uffizzi_core 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/clients/uffizzi_core/docker_hub_client.rb +0 -38
- data/app/controllers/uffizzi_core/api/cli/v1/projects/deployments_controller.rb +12 -4
- data/app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb +1 -0
- data/app/forms/uffizzi_core/api/cli/v1/deployment/update_form.rb +41 -40
- data/app/repositories/uffizzi_core/deployment_repo.rb +4 -0
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb +2 -5
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployments_serializer/user_serializer.rb +7 -0
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployments_serializer.rb +14 -0
- data/app/services/uffizzi_core/compose_file/parsers/services/image_parser_service.rb +10 -7
- data/app/services/uffizzi_core/deployment_service.rb +8 -28
- data/app/services/uffizzi_core/docker_hub_service.rb +0 -37
- data/config/routes.rb +0 -8
- data/db/migrate/20220805164628_add_metadata_to_deployment.rb +7 -0
- data/lib/uffizzi_core/version.rb +1 -1
- metadata +5 -4
- data/app/jobs/uffizzi_core/credential/docker_hub/create_webhook_job.rb +0 -15
- data/app/jobs/uffizzi_core/deployment/create_webhooks_job.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9863f1734f5ee6937e8b498f95a78ff853b1b546c9f33a30578755c2a580869
|
4
|
+
data.tar.gz: 036277c7c8913e0cfda95f5bf413296dd65bccf9d11c7d8f47b0ca70e26da661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbfe3b99fb50fd90bf91d8894eb89104d7239ac58a27dfd0a60e022c9d525995586a074b236f642b85c903d9c5d21f2837610feeef61ade40357d1e55bb649bd
|
7
|
+
data.tar.gz: da2f031e15feb3b3350e4a42bed43f465b581854a77f402b9365fad976f1f000ac53066618224a1521dea0a0d0e0dcdcafd4888ac183d5c955ee820974f220ad
|
@@ -43,34 +43,6 @@ class UffizziCore::DockerHubClient
|
|
43
43
|
RequestResult.new(result: response.body)
|
44
44
|
end
|
45
45
|
|
46
|
-
def get_webhooks(slug:, registry:)
|
47
|
-
url = BASE_URL + "/v2/repositories/#{slug}/webhook_pipeline/"
|
48
|
-
|
49
|
-
response = connection.get(url, { registry: registry, page_size: 100 }) do |request|
|
50
|
-
request.headers['Authorization'] = "JWT #{jwt}"
|
51
|
-
end
|
52
|
-
|
53
|
-
RequestResult.new(status: response.status, result: response.body)
|
54
|
-
end
|
55
|
-
|
56
|
-
def create_webhook(slug:, name:, expect_final_callback:, webhooks:)
|
57
|
-
raise NotAuthorizedError if !authentificated?
|
58
|
-
|
59
|
-
url = BASE_URL + "/v2/repositories/#{slug}/webhook_pipeline/"
|
60
|
-
|
61
|
-
params = {
|
62
|
-
name: name,
|
63
|
-
expect_final_callback: expect_final_callback,
|
64
|
-
webhooks: webhooks,
|
65
|
-
}
|
66
|
-
|
67
|
-
response = connection.post(url, params) do |request|
|
68
|
-
request.headers['Authorization'] = "JWT #{jwt}"
|
69
|
-
end
|
70
|
-
|
71
|
-
RequestResult.new(status: response.status, result: response.body)
|
72
|
-
end
|
73
|
-
|
74
46
|
def accounts
|
75
47
|
raise NotAuthorizedError if !authentificated?
|
76
48
|
|
@@ -115,16 +87,6 @@ class UffizziCore::DockerHubClient
|
|
115
87
|
RequestResult.new(result: response.body)
|
116
88
|
end
|
117
89
|
|
118
|
-
def send_webhook_answer(url, params)
|
119
|
-
conn = Faraday.new do |c|
|
120
|
-
c.request(:json)
|
121
|
-
c.adapter(Faraday.default_adapter)
|
122
|
-
end
|
123
|
-
response = conn.post(url, params)
|
124
|
-
|
125
|
-
RequestResult.quiet.new(result: response.body)
|
126
|
-
end
|
127
|
-
|
128
90
|
def authentificated?
|
129
91
|
jwt.present?
|
130
92
|
end
|
@@ -14,7 +14,10 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
|
|
14
14
|
# @response [Array<Deployment>] 200 OK
|
15
15
|
# @response 401 Not authorized
|
16
16
|
def index
|
17
|
-
|
17
|
+
search_labels = JSON.parse(q_param)
|
18
|
+
filtered_deployments = deployments.with_labels(search_labels)
|
19
|
+
|
20
|
+
respond_with filtered_deployments, each_serializer: UffizziCore::Api::Cli::V1::Projects::DeploymentsSerializer
|
18
21
|
end
|
19
22
|
|
20
23
|
# Get deployment information by id
|
@@ -51,7 +54,7 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
|
|
51
54
|
errors = check_credentials(compose_file)
|
52
55
|
return render_errors(errors) if errors.present?
|
53
56
|
|
54
|
-
deployment = UffizziCore::DeploymentService.create_from_compose(compose_file, resource_project, current_user)
|
57
|
+
deployment = UffizziCore::DeploymentService.create_from_compose(compose_file, resource_project, current_user, metadata_params)
|
55
58
|
|
56
59
|
respond_with deployment
|
57
60
|
end
|
@@ -82,8 +85,9 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
|
|
82
85
|
errors = check_credentials(compose_file)
|
83
86
|
return render_errors(errors) if errors.present?
|
84
87
|
|
85
|
-
deployment =
|
86
|
-
updated_deployment = UffizziCore::DeploymentService.update_from_compose(compose_file, resource_project, current_user, deployment
|
88
|
+
deployment = deployments.find(params[:id])
|
89
|
+
updated_deployment = UffizziCore::DeploymentService.update_from_compose(compose_file, resource_project, current_user, deployment,
|
90
|
+
metadata_params)
|
87
91
|
|
88
92
|
respond_with updated_deployment
|
89
93
|
end
|
@@ -171,6 +175,10 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
|
|
171
175
|
params.permit(dependencies: [:name, :path, :source, :content])
|
172
176
|
end
|
173
177
|
|
178
|
+
def metadata_params
|
179
|
+
params[:metadata]
|
180
|
+
end
|
181
|
+
|
174
182
|
def render_invalid_file
|
175
183
|
render json: { errors: { state: ['Invalid compose file'] } }, status: :unprocessable_entity
|
176
184
|
end
|
@@ -3,46 +3,47 @@
|
|
3
3
|
class UffizziCore::Api::Cli::V1::Deployment::UpdateForm < UffizziCore::Deployment
|
4
4
|
include UffizziCore::ApplicationForm
|
5
5
|
|
6
|
-
permit
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
6
|
+
permit :metadata,
|
7
|
+
containers_attributes: [
|
8
|
+
:image,
|
9
|
+
:service_name,
|
10
|
+
:tag,
|
11
|
+
:port,
|
12
|
+
:public,
|
13
|
+
:memory_limit,
|
14
|
+
:memory_request,
|
15
|
+
:entrypoint,
|
16
|
+
:command,
|
17
|
+
:receive_incoming_requests,
|
18
|
+
:continuously_deploy,
|
19
|
+
{ variables: [:name, :value],
|
20
|
+
secret_variables: [:name, :value],
|
21
|
+
volumes: [:source, :target, :type, :read_only],
|
22
|
+
repo_attributes: [
|
23
|
+
:namespace,
|
24
|
+
:name,
|
25
|
+
:slug,
|
26
|
+
:type,
|
27
|
+
:description,
|
28
|
+
:is_private,
|
29
|
+
:repository_id,
|
30
|
+
:branch,
|
31
|
+
:kind,
|
32
|
+
:dockerfile_path,
|
33
|
+
:dockerfile_context_path,
|
34
|
+
:deploy_preview_when_pull_request_is_opened,
|
35
|
+
:delete_preview_when_pull_request_is_closed,
|
36
|
+
:deploy_preview_when_image_tag_is_created,
|
37
|
+
:delete_preview_when_image_tag_is_updated,
|
38
|
+
:share_to_github,
|
39
|
+
:delete_preview_after,
|
40
|
+
{ args: [:name, :value] },
|
41
|
+
],
|
42
|
+
container_config_files_attributes: [
|
43
|
+
:config_file_id,
|
44
|
+
:mount_path,
|
45
|
+
] },
|
46
|
+
]
|
46
47
|
|
47
48
|
validate :check_all_containers_have_unique_ports
|
48
49
|
validate :check_exists_ingress_container
|
@@ -12,5 +12,9 @@ module UffizziCore::DeploymentRepo
|
|
12
12
|
scope :active_for_credential_id, ->(credential_id) {
|
13
13
|
active.joins(project: :credentials).merge(UffizziCore::Project.active).where(credentials: { id: credential_id })
|
14
14
|
}
|
15
|
+
|
16
|
+
scope :with_labels, ->(labels) {
|
17
|
+
where("#{UffizziCore::Deployment.table_name}.metadata @> ?", labels.to_json)
|
18
|
+
}
|
15
19
|
end
|
16
20
|
end
|
@@ -16,16 +16,13 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentSerializer < UffizziCore::B
|
|
16
16
|
:image_id,
|
17
17
|
:ingress_container_ready,
|
18
18
|
:ingress_container_state,
|
19
|
-
:creation_source
|
19
|
+
:creation_source,
|
20
|
+
:metadata
|
20
21
|
|
21
22
|
has_many :containers
|
22
23
|
|
23
24
|
belongs_to :deployed_by
|
24
25
|
|
25
|
-
def deployed_by
|
26
|
-
object.deployed_by
|
27
|
-
end
|
28
|
-
|
29
26
|
def containers
|
30
27
|
object.containers.active
|
31
28
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UffizziCore::Api::Cli::V1::Projects::DeploymentsSerializer < UffizziCore::BaseSerializer
|
4
|
+
type :deployment
|
5
|
+
|
6
|
+
attributes :id,
|
7
|
+
:created_at,
|
8
|
+
:updated_at,
|
9
|
+
:state,
|
10
|
+
:preview_url,
|
11
|
+
:metadata
|
12
|
+
|
13
|
+
belongs_to :deployed_by
|
14
|
+
end
|
@@ -5,9 +5,8 @@ class UffizziCore::ComposeFile::Parsers::Services::ImageParserService
|
|
5
5
|
def parse(value)
|
6
6
|
return {} if value.blank?
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
raise parse_error if image_path.blank?
|
8
|
+
image_path, tag = get_image_path_and_tag(value)
|
9
|
+
raise_parse_error(value) if image_path.blank?
|
11
10
|
|
12
11
|
tag = Settings.compose.default_tag if tag.blank?
|
13
12
|
|
@@ -27,7 +26,11 @@ class UffizziCore::ComposeFile::Parsers::Services::ImageParserService
|
|
27
26
|
|
28
27
|
private
|
29
28
|
|
30
|
-
def
|
29
|
+
def raise_parse_error(value)
|
30
|
+
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_image_value', value: value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_image_path_and_tag(value)
|
31
34
|
image_path_parts = value.downcase.split(':')
|
32
35
|
case image_path_parts.size
|
33
36
|
when 1
|
@@ -40,18 +43,18 @@ class UffizziCore::ComposeFile::Parsers::Services::ImageParserService
|
|
40
43
|
elsif tag_pattern.match?(value)
|
41
44
|
[image_path_parts[0], image_path_parts[1]]
|
42
45
|
else
|
43
|
-
|
46
|
+
raise_parse_error(value)
|
44
47
|
end
|
45
48
|
when 3
|
46
49
|
["#{image_path_parts[0]}:#{image_path_parts[1]}", image_path_parts[2]]
|
47
50
|
else
|
48
|
-
|
51
|
+
raise_parse_error(value)
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
52
55
|
def url?(image_path)
|
53
56
|
uri = URI(add_https_if_needed(image_path))
|
54
|
-
uri.host.present? && uri.host =~
|
57
|
+
uri.host.present? && uri.host =~ /(localhost(:\d+)?|\w+\.(\w+\.)*\w+)/ && uri.path.present?
|
55
58
|
rescue URI::InvalidURIError
|
56
59
|
false
|
57
60
|
end
|
@@ -12,39 +12,41 @@ class UffizziCore::DeploymentService
|
|
12
12
|
}.freeze
|
13
13
|
|
14
14
|
class << self
|
15
|
-
def create_from_compose(compose_file, project, user)
|
15
|
+
def create_from_compose(compose_file, project, user, metadata)
|
16
16
|
deployment_attributes = ActionController::Parameters.new(compose_file.template.payload)
|
17
17
|
deployment_form = UffizziCore::Api::Cli::V1::Deployment::CreateForm.new(deployment_attributes)
|
18
18
|
deployment_form.assign_dependences!(project, user)
|
19
19
|
deployment_form.compose_file = compose_file
|
20
20
|
deployment_form.creation_source = UffizziCore::Deployment.creation_source.compose_file_manual
|
21
|
+
deployment_form.metadata = metadata || {}
|
21
22
|
|
22
23
|
if deployment_form.save
|
23
24
|
update_subdomain!(deployment_form)
|
24
25
|
|
25
26
|
UffizziCore::Deployment::CreateJob.perform_async(deployment_form.id)
|
26
|
-
UffizziCore::Deployment::CreateWebhooksJob.perform_async(deployment_form.id)
|
27
27
|
end
|
28
28
|
|
29
29
|
deployment_form
|
30
30
|
end
|
31
31
|
|
32
|
-
def update_from_compose(compose_file, project, user, deployment)
|
32
|
+
def update_from_compose(compose_file, project, user, deployment, metadata)
|
33
33
|
deployment_attributes = ActionController::Parameters.new(compose_file.template.payload)
|
34
34
|
|
35
35
|
deployment_form = UffizziCore::Api::Cli::V1::Deployment::UpdateForm.new(deployment_attributes)
|
36
36
|
deployment_form.assign_dependences!(project, user)
|
37
37
|
deployment_form.compose_file = compose_file
|
38
|
+
deployment_form.metadata = metadata || {}
|
38
39
|
|
39
40
|
ActiveRecord::Base.transaction do
|
40
41
|
deployment.containers.destroy_all
|
41
42
|
deployment.compose_file.destroy! if deployment.compose_file&.kind&.temporary?
|
42
|
-
|
43
|
-
deployment.update!(
|
43
|
+
params = {
|
44
44
|
containers: deployment_form.containers,
|
45
45
|
compose_file_id: compose_file.id,
|
46
46
|
creation_source: UffizziCore::Deployment.creation_source.compose_file_manual,
|
47
|
-
|
47
|
+
metadata: deployment_form.metadata,
|
48
|
+
}
|
49
|
+
deployment.update!(params)
|
48
50
|
end
|
49
51
|
|
50
52
|
deployment
|
@@ -208,28 +210,6 @@ class UffizziCore::DeploymentService
|
|
208
210
|
deployment.save!
|
209
211
|
end
|
210
212
|
|
211
|
-
def create_webhooks(deployment)
|
212
|
-
credential = deployment.project.account.credentials.docker_hub.active.first
|
213
|
-
|
214
|
-
if !deployment.containers.with_docker_hub_repo.exists? || !credential.present?
|
215
|
-
Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment.id} create_webhooks no dockerhub containers or credential")
|
216
|
-
return
|
217
|
-
end
|
218
|
-
|
219
|
-
accounts = UffizziCore::DockerHubService.accounts(credential)
|
220
|
-
|
221
|
-
deployment.containers.with_docker_hub_repo.find_each do |container|
|
222
|
-
if !accounts.include?(container.repo.namespace)
|
223
|
-
logger_message = "DEPLOYMENT_PROCESS deployment_id=#{deployment.id} no namespace(#{container.repo.namespace})
|
224
|
-
in accounts(#{accounts.inspect})"
|
225
|
-
Rails.logger.info(logger_message)
|
226
|
-
next
|
227
|
-
end
|
228
|
-
|
229
|
-
UffizziCore::Credential::DockerHub::CreateWebhookJob.perform_async(credential.id, container.image, deployment.id)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
213
|
def pull_request_payload_present?(deployment)
|
234
214
|
deployment.continuous_preview_payload.present? && deployment.continuous_preview_payload['pull_request'].present?
|
235
215
|
end
|
@@ -1,44 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class UffizziCore::DockerHubService
|
4
|
-
HOOK_NAME = 'Uffizzi OpenSource Deploy Webhook'
|
5
|
-
HOOK_URL = "#{Settings.app.host}api/cli/v1/webhooks/docker_hub"
|
6
|
-
REGISTRY = 'registry-1.docker.io'
|
7
|
-
|
8
4
|
class << self
|
9
|
-
def create_webhook(credential, image)
|
10
|
-
client = user_client(credential)
|
11
|
-
|
12
|
-
webhooks_response = client.get_webhooks(slug: image, registry: REGISTRY)
|
13
|
-
Rails.logger.info("DockerHubService create_webhook get_webhooks_response=#{webhooks_response.inspect}")
|
14
|
-
|
15
|
-
return false if webhooks_response.status != 200
|
16
|
-
|
17
|
-
webhooks = webhooks_response.result['results']
|
18
|
-
|
19
|
-
webhook = webhooks.detect { |hook| hook['name'] == HOOK_NAME }
|
20
|
-
|
21
|
-
return true if !webhook.nil?
|
22
|
-
|
23
|
-
params = {
|
24
|
-
slug: image,
|
25
|
-
name: HOOK_NAME,
|
26
|
-
expect_final_callback: false,
|
27
|
-
webhooks: [{ name: HOOK_NAME, hook_url: HOOK_URL, registry: REGISTRY }],
|
28
|
-
}
|
29
|
-
|
30
|
-
response = client.create_webhook(params)
|
31
|
-
|
32
|
-
Rails.logger.info("DockerHubService create_webhook create_webhook_response=#{response.inspect} params=#{params.inspect}")
|
33
|
-
|
34
|
-
response.status == 201
|
35
|
-
end
|
36
|
-
|
37
|
-
def send_webhook_answer(callback_url)
|
38
|
-
params = { state: 'success', description: 'Successfully deployed to Uffizzi' }
|
39
|
-
public_docker_hub_client.send_webhook_answer(callback_url, params)
|
40
|
-
end
|
41
|
-
|
42
5
|
def accounts(credential)
|
43
6
|
client = user_client(credential)
|
44
7
|
response = client.accounts
|
data/config/routes.rb
CHANGED
@@ -7,14 +7,6 @@ UffizziCore::Engine.routes.draw do
|
|
7
7
|
namespace :api, defaults: { format: :json } do
|
8
8
|
namespace :cli do
|
9
9
|
namespace :v1 do
|
10
|
-
resource :webhooks, only: [] do
|
11
|
-
post :docker_hub
|
12
|
-
post :github
|
13
|
-
post :azure
|
14
|
-
post :amazon
|
15
|
-
post :google
|
16
|
-
end
|
17
|
-
|
18
10
|
resources :projects, only: ['index', 'show', 'create', 'destroy'], param: :slug do
|
19
11
|
scope module: :projects do
|
20
12
|
resource :compose_file, only: ['show', 'create', 'destroy']
|
data/lib/uffizzi_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-08-
|
12
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -754,11 +754,9 @@ files:
|
|
754
754
|
- app/jobs/uffizzi_core/activity_item/docker/update_digest_job.rb
|
755
755
|
- app/jobs/uffizzi_core/application_job.rb
|
756
756
|
- app/jobs/uffizzi_core/config_file/apply_job.rb
|
757
|
-
- app/jobs/uffizzi_core/credential/docker_hub/create_webhook_job.rb
|
758
757
|
- app/jobs/uffizzi_core/deployment/create_credential_job.rb
|
759
758
|
- app/jobs/uffizzi_core/deployment/create_credentials_job.rb
|
760
759
|
- app/jobs/uffizzi_core/deployment/create_job.rb
|
761
|
-
- app/jobs/uffizzi_core/deployment/create_webhooks_job.rb
|
762
760
|
- app/jobs/uffizzi_core/deployment/delete_credential_job.rb
|
763
761
|
- app/jobs/uffizzi_core/deployment/delete_job.rb
|
764
762
|
- app/jobs/uffizzi_core/deployment/deploy_containers_job.rb
|
@@ -879,6 +877,8 @@ files:
|
|
879
877
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer.rb
|
880
878
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer/container_config_file_serializer.rb
|
881
879
|
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer/container_config_file_serializer/config_file_serializer.rb
|
880
|
+
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments_serializer.rb
|
881
|
+
- app/serializers/uffizzi_core/api/cli/v1/projects/deployments_serializer/user_serializer.rb
|
882
882
|
- app/serializers/uffizzi_core/api/cli/v1/projects/secret_serializer.rb
|
883
883
|
- app/serializers/uffizzi_core/api/cli/v1/short_project_serializer.rb
|
884
884
|
- app/serializers/uffizzi_core/api/cli/v1/user_serializer.rb
|
@@ -966,6 +966,7 @@ files:
|
|
966
966
|
- db/migrate/20220422151523_add_volumes_to_uffizzi_core_containers.rb
|
967
967
|
- db/migrate/20220525113412_rename_name_to_uffizzi_containers.rb
|
968
968
|
- db/migrate/20220704135629_add_disabled_at_to_deployments.rb
|
969
|
+
- db/migrate/20220805164628_add_metadata_to_deployment.rb
|
969
970
|
- db/seeds.rb
|
970
971
|
- lib/tasks/uffizzi_core_tasks.rake
|
971
972
|
- lib/uffizzi_core.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::Credential::DockerHub::CreateWebhookJob < UffizziCore::ApplicationJob
|
4
|
-
sidekiq_options queue: :accounts, retry: 5
|
5
|
-
|
6
|
-
def perform(credential_id, image, deployment_id = nil)
|
7
|
-
if deployment_id.present?
|
8
|
-
Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment_id} DockerHub CreateWebhooksJob")
|
9
|
-
end
|
10
|
-
|
11
|
-
credential = UffizziCore::Credential.find(credential_id)
|
12
|
-
|
13
|
-
UffizziCore::DockerHubService.create_webhook(credential, image)
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::Deployment::CreateWebhooksJob < UffizziCore::ApplicationJob
|
4
|
-
sidekiq_options queue: :deployments, retry: 5
|
5
|
-
|
6
|
-
def perform(id)
|
7
|
-
Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{id} CreateWebhooksJob")
|
8
|
-
|
9
|
-
deployment = UffizziCore::Deployment.find(id)
|
10
|
-
|
11
|
-
UffizziCore::DeploymentService.create_webhooks(deployment)
|
12
|
-
end
|
13
|
-
end
|