uffizzi_core 2.1.3 → 2.1.5
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/controller_modules/uffizzi_core/api/cli/v1/projects/deployments_controller_module.rb +5 -1
- data/app/controller_modules/uffizzi_core/api/cli/v1/projects_controller_module.rb +7 -0
- data/app/controllers/uffizzi_core/api/cli/v1/application_controller.rb +8 -0
- data/app/controllers/uffizzi_core/api/cli/v1/projects/deployments_controller.rb +2 -1
- data/app/controllers/uffizzi_core/api/cli/v1/projects_controller.rb +5 -5
- data/app/lib/uffizzi_core/concerns/models/deployment.rb +5 -1
- data/app/services/uffizzi_core/deployment_service.rb +3 -4
- data/lib/uffizzi_core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ee784d18da14d2c52e81eb198cf5618e13be8922a87d8eb83a5d981d8e4d1d1
|
4
|
+
data.tar.gz: b269cb27d6b2f4a7d74ae56ef412a1adf394b14dcc9c6b41db245cca31d20d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3927916bb55e90af147c152f7bb86065f0eadbb75ec677e0a1aa69fb395e5c4b1f9d3764e57e9aea3ebb3006d7cf2365f8c444e84561f122670ba3ff72c978a
|
7
|
+
data.tar.gz: be4cc536ed1bd57888096be85723eb56446f24d760c387baa3f13e6891972f47fd641f41fcd14048465184be13241cea0473b65a79a60d4662464e59fc1bb71b
|
@@ -2,4 +2,12 @@
|
|
2
2
|
|
3
3
|
class UffizziCore::Api::Cli::V1::ApplicationController < UffizziCore::ApplicationController
|
4
4
|
before_action :authenticate_request!
|
5
|
+
|
6
|
+
def resource_project
|
7
|
+
@resource_project ||= current_user.projects.find_by!(slug: params[:slug])
|
8
|
+
end
|
9
|
+
|
10
|
+
def resource_account
|
11
|
+
@resource_account ||= resource_project.account
|
12
|
+
end
|
5
13
|
end
|
@@ -6,7 +6,8 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
|
|
6
6
|
include UffizziCore::Api::Cli::V1::Projects::DeploymentsControllerModule
|
7
7
|
|
8
8
|
before_action :authorize_uffizzi_core_api_cli_v1_projects_deployments
|
9
|
-
before_action :
|
9
|
+
before_action :stop_if_deployment_forbidden, only: :create
|
10
|
+
after_action :update_show_trial_quota_exceeded_warning, only: :destroy
|
10
11
|
|
11
12
|
# Get a list of active deployements for a project
|
12
13
|
#
|
@@ -3,7 +3,10 @@
|
|
3
3
|
# @resource Project
|
4
4
|
|
5
5
|
class UffizziCore::Api::Cli::V1::ProjectsController < UffizziCore::Api::Cli::V1::ApplicationController
|
6
|
+
include UffizziCore::Api::Cli::V1::ProjectsControllerModule
|
7
|
+
|
6
8
|
before_action :authorize_uffizzi_core_api_cli_v1_projects
|
9
|
+
after_action :update_show_trial_quota_exceeded_warning, only: :destroy
|
7
10
|
|
8
11
|
# Get projects of current user
|
9
12
|
#
|
@@ -48,12 +51,9 @@ class UffizziCore::Api::Cli::V1::ProjectsController < UffizziCore::Api::Cli::V1:
|
|
48
51
|
params.require(:project)
|
49
52
|
end
|
50
53
|
|
51
|
-
def resource_project
|
52
|
-
@resource_project ||= current_user.projects.find_by(slug: params[:slug])
|
53
|
-
end
|
54
|
-
|
55
54
|
def policy_context
|
56
|
-
|
55
|
+
current_project = current_user.projects.find_by(slug: params[:slug])
|
56
|
+
account = current_project&.account || current_user.default_account
|
57
57
|
|
58
58
|
UffizziCore::AccountContext.new(current_user, user_access_module, account, params)
|
59
59
|
end
|
@@ -43,7 +43,7 @@ module UffizziCore::Concerns::Models::Deployment
|
|
43
43
|
state :failed
|
44
44
|
state :disabled
|
45
45
|
|
46
|
-
event :activate do
|
46
|
+
event :activate, after: :after_activate do
|
47
47
|
transitions from: [:disabled], to: :active
|
48
48
|
end
|
49
49
|
|
@@ -56,6 +56,10 @@ module UffizziCore::Concerns::Models::Deployment
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def after_activate
|
60
|
+
update!(disabled_at: nil)
|
61
|
+
end
|
62
|
+
|
59
63
|
def after_disable
|
60
64
|
clean
|
61
65
|
update!(disabled_at: Time.now)
|
@@ -27,23 +27,22 @@ class UffizziCore::DeploymentService
|
|
27
27
|
deployment_form
|
28
28
|
end
|
29
29
|
|
30
|
-
def update_from_compose(compose_file, project, user, deployment, metadata)
|
30
|
+
def update_from_compose(compose_file, project, user, deployment, metadata = {})
|
31
31
|
deployment_attributes = ActionController::Parameters.new(compose_file.template.payload)
|
32
32
|
|
33
33
|
deployment_form = UffizziCore::Api::Cli::V1::Deployment::UpdateForm.new(deployment_attributes)
|
34
34
|
deployment_form.assign_dependences!(project, user)
|
35
35
|
deployment_form.compose_file = compose_file
|
36
|
-
deployment_form.metadata = metadata
|
36
|
+
deployment_form.metadata = metadata
|
37
37
|
|
38
38
|
ActiveRecord::Base.transaction do
|
39
39
|
deployment.containers.destroy_all
|
40
40
|
deployment.compose_file.destroy! if deployment.compose_file&.kind&.temporary?
|
41
|
+
deployment.activate unless deployment.active?
|
41
42
|
params = {
|
42
43
|
containers: deployment_form.containers,
|
43
44
|
compose_file_id: compose_file.id,
|
44
|
-
creation_source: UffizziCore::Deployment.creation_source.compose_file_manual,
|
45
45
|
metadata: deployment_form.metadata,
|
46
|
-
state: :active,
|
47
46
|
}
|
48
47
|
deployment.update!(params)
|
49
48
|
end
|
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: 2.1.
|
4
|
+
version: 2.1.5
|
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: 2023-02-
|
12
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -749,6 +749,7 @@ files:
|
|
749
749
|
- app/contexts/uffizzi_core/project_context.rb
|
750
750
|
- app/contexts/uffizzi_core/webhooks_context.rb
|
751
751
|
- app/controller_modules/uffizzi_core/api/cli/v1/projects/deployments_controller_module.rb
|
752
|
+
- app/controller_modules/uffizzi_core/api/cli/v1/projects_controller_module.rb
|
752
753
|
- app/controllers/concerns/uffizzi_core/auth_management.rb
|
753
754
|
- app/controllers/concerns/uffizzi_core/authorization_concern.rb
|
754
755
|
- app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb
|