uffizzi_core 2.0.4 → 2.0.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1065eeedad42eb66cc223f635c61871171ab68a30bcbf529601630f4cdd75ee
|
|
4
|
+
data.tar.gz: 4d3a5120d1839a4bf944af27dfcbf501b5b616c909b57af247b9e528c3d4ae62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e0d2877db2d9c6931db243b3f98e47f71235acc288d47c05dd1e5a6841366f82c9ca07ce2958d3b5052869d7ca495089ac3d1da81d636dff2586dd1a21ab842
|
|
7
|
+
data.tar.gz: eabdf9cd8a38a86640d3f25ca0ffc735adae9191b4508c50455d9a24e7d5441c762274033737dae4066060525e7f9953af656a0465cc7418d3d5a3ec324c6f52
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module UffizziCore::Concerns::Models::Deployment
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
|
|
6
|
+
# rubocop:disable Metrics/BlockLength
|
|
6
7
|
included do
|
|
7
8
|
include AASM
|
|
8
9
|
include UffizziCore::StateMachineConcern
|
|
@@ -72,5 +73,18 @@ module UffizziCore::Concerns::Models::Deployment
|
|
|
72
73
|
def preview_url
|
|
73
74
|
"#{subdomain}.#{Settings.app.managed_dns_zone}"
|
|
74
75
|
end
|
|
76
|
+
|
|
77
|
+
def from_actions?
|
|
78
|
+
from_github_actions? || from_gitlab_actions?
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def from_github_actions?
|
|
82
|
+
metadata.dig('labels', 'github', 'repository').present?
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def from_gitlab_actions?
|
|
86
|
+
metadata.dig('labels', 'gitlab', 'repo').present?
|
|
87
|
+
end
|
|
75
88
|
end
|
|
89
|
+
# rubocop:enable Metrics/BlockLength
|
|
76
90
|
end
|
|
@@ -89,19 +89,18 @@ class UffizziCore::DeploymentService
|
|
|
89
89
|
|
|
90
90
|
def build_subdomain(deployment)
|
|
91
91
|
return build_docker_continuous_preview_subdomain(deployment) if deployment&.continuous_preview_payload&.fetch('docker', nil).present?
|
|
92
|
+
return build_pull_request_subdomain(deployment) if deployment.from_actions?
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
github_metadata&.dig('pull_request', 'number').present? && github_metadata&.dig('repository').present?
|
|
96
|
-
|
|
94
|
+
build_default_subdomain(deployment)
|
|
95
|
+
rescue UffizziCore::Deployment::LabelsNotFoundError
|
|
97
96
|
build_default_subdomain(deployment)
|
|
98
97
|
end
|
|
99
98
|
|
|
100
99
|
def build_pull_request_subdomain(deployment)
|
|
101
|
-
|
|
102
|
-
repo_name
|
|
103
|
-
|
|
104
|
-
subdomain = "pr-#{pull_request_number}-#{name(deployment)}-#{repo_name
|
|
100
|
+
repo_name, pull_request_number = pull_request_data(deployment)
|
|
101
|
+
raise UffizziCore::Deployment::LabelsNotFoundError if repo_name.nil? || pull_request_number.nil?
|
|
102
|
+
|
|
103
|
+
subdomain = "pr-#{pull_request_number}-#{name(deployment)}-#{repo_name.downcase}"
|
|
105
104
|
format_subdomain(subdomain)
|
|
106
105
|
end
|
|
107
106
|
|
|
@@ -291,5 +290,23 @@ class UffizziCore::DeploymentService
|
|
|
291
290
|
|
|
292
291
|
sliced_subdomain
|
|
293
292
|
end
|
|
293
|
+
|
|
294
|
+
def pull_request_data(deployment)
|
|
295
|
+
return github_pull_request_data(deployment) if deployment.from_github_actions?
|
|
296
|
+
|
|
297
|
+
gitlab_merge_request_data(deployment)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def github_pull_request_data(deployment)
|
|
301
|
+
github_data = deployment.metadata.dig('labels', 'github')
|
|
302
|
+
|
|
303
|
+
[github_data['repository'], github_data.dig('event', 'number')]
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def gitlab_merge_request_data(deployment)
|
|
307
|
+
gitlab_data = deployment.metadata.dig('labels', 'gitlab')
|
|
308
|
+
|
|
309
|
+
[gitlab_data['repo'], gitlab_data.dig('merge_request', 'number')]
|
|
310
|
+
end
|
|
294
311
|
end
|
|
295
312
|
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.0.
|
|
4
|
+
version: 2.0.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: 2022-10-
|
|
12
|
+
date: 2022-10-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: aasm
|
|
@@ -774,6 +774,7 @@ files:
|
|
|
774
774
|
- app/errors/uffizzi_core/compose_file/parse_error.rb
|
|
775
775
|
- app/errors/uffizzi_core/compose_file/secrets_error.rb
|
|
776
776
|
- app/errors/uffizzi_core/deployment/image_pull_error.rb
|
|
777
|
+
- app/errors/uffizzi_core/deployment/labels_not_found_error.rb
|
|
777
778
|
- app/errors/uffizzi_core/deployment_not_found_error.rb
|
|
778
779
|
- app/forms/uffizzi_core/api/cli/v1/account/credential/check_credential_form.rb
|
|
779
780
|
- app/forms/uffizzi_core/api/cli/v1/account/credential/create_form.rb
|