makit 0.0.147 → 0.0.153
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/lib/generated/makit/v1/configuration/project_pb.rb +22 -0
- data/lib/generated/makit/v1/configuration/project_service_pb.rb +34 -0
- data/lib/generated/makit/v1/configuration/project_service_services_pb.rb +51 -0
- data/lib/generated/makit/v1/git/git_repository_model_pb.rb +22 -0
- data/lib/generated/makit/v1/git/git_repository_service_pb.rb +29 -0
- data/lib/generated/makit/v1/git/git_repository_service_services_pb.rb +39 -0
- data/lib/generated/makit/v1/gitlab/pipeline_pb.rb +26 -0
- data/lib/generated/makit/v1/gitlab/pipeline_result_pb.rb +29 -0
- data/lib/generated/makit/v1/gitlab/pipeline_service_pb.rb +36 -0
- data/lib/generated/makit/v1/gitlab/pipeline_service_services_pb.rb +41 -0
- data/lib/generated/makit/v1/grpc/service_specification_pb.rb +27 -0
- data/lib/generated/makit/v1/grpc/test_specification_pb.rb +29 -0
- data/lib/generated/makit/v1/io/filesystem_pb.rb +27 -0
- data/lib/generated/makit/v1/io/filesystem_services_pb.rb +47 -0
- data/lib/generated/makit/v1/makit.v1_pb.rb +35 -0
- data/lib/generated/makit/v1/makit.v1_services_pb.rb +26 -0
- data/lib/generated/makit/v1/podman/podman_service_pb.rb +64 -0
- data/lib/generated/makit/v1/podman/podman_service_services_pb.rb +52 -0
- data/lib/generated/makit/v1/services/repository_manager_model_pb.rb +23 -0
- data/lib/generated/makit/v1/services/repository_manager_service_pb.rb +32 -0
- data/lib/generated/makit/v1/services/repository_manager_service_services_pb.rb +35 -0
- data/lib/generated/makit/v1/spec/message_proto_generator_pb.rb +33 -0
- data/lib/generated/makit/v1/spec/message_proto_generator_services_pb.rb +38 -0
- data/lib/generated/makit/v1/spec/message_spec_pb.rb +31 -0
- data/lib/generated/makit/v1/spec/message_spec_suite_pb.rb +30 -0
- data/lib/generated/makit/v1/spec/message_spec_test_pb.rb +34 -0
- data/lib/generated/makit/v1/spec/proto_service_pb.rb +53 -0
- data/lib/generated/makit/v1/spec/proto_service_services_pb.rb +42 -0
- data/lib/generated/makit/v1/spec/spec_manifest_pb.rb +44 -0
- data/lib/generated/makit/v1/web/link_pb.rb +20 -0
- data/lib/makit/azure/blob_storage.rb +257 -0
- data/lib/makit/azure/cli.rb +285 -0
- data/lib/makit/configuration/project.rb +137 -291
- data/lib/makit/git/repository.rb +24 -190
- data/lib/makit/gitlab/pipeline.rb +16 -16
- data/lib/makit/gitlab/pipeline_service_impl.rb +43 -43
- data/lib/makit/io/filesystem_service_impl.rb +6 -6
- data/lib/makit/lint.rb +212 -0
- data/lib/makit/logging/configuration.rb +2 -1
- data/lib/makit/logging.rb +15 -2
- data/lib/makit/podman/podman.rb +20 -20
- data/lib/makit/podman/podman_service_impl.rb +41 -41
- data/lib/makit/secrets/azure_key_vault.rb +323 -0
- data/lib/makit/secrets/azure_secrets.rb +183 -0
- data/lib/makit/secrets/local_secrets.rb +72 -0
- data/lib/makit/secrets/secrets_manager.rb +105 -0
- data/lib/makit/secrets.rb +10 -45
- data/lib/makit/tasks/bump.rb +7 -0
- data/lib/makit/tasks/info.rb +204 -0
- data/lib/makit/tasks/integrate.rb +28 -1
- data/lib/makit/tasks/secrets.rb +7 -0
- data/lib/makit/tasks/version.rb +6 -0
- data/lib/makit/tasks.rb +4 -0
- data/lib/makit/v1/configuration/project_service_impl.rb +1 -1
- data/lib/makit/version.rb +382 -1
- data/lib/makit.rb +21 -18
- metadata +46 -5
data/lib/makit/git/repository.rb
CHANGED
|
@@ -1,256 +1,90 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
require_relative "../v1/git/git_repository_service_impl"
|
|
6
|
-
end
|
|
3
|
+
# Load gRPC service implementation
|
|
4
|
+
require_relative "../v1/git/git_repository_service_impl"
|
|
7
5
|
|
|
8
6
|
# This module provides classes for the Makit gem.
|
|
9
7
|
module Makit
|
|
10
8
|
class Git
|
|
11
9
|
# This class provides methods for querying git repository state and metadata.
|
|
12
|
-
#
|
|
10
|
+
# Refactored to use protobuf messages exclusively.
|
|
13
11
|
class Repository
|
|
14
|
-
# Check if gRPC service is available
|
|
15
|
-
@grpc_available = defined?(Makit::V1::Git::GitRepositoryServiceImpl)
|
|
16
|
-
|
|
17
12
|
# Get current repository state via gRPC service
|
|
18
13
|
def self.get_repository_state
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
service.get_repository_state(request, nil)
|
|
23
|
-
else
|
|
24
|
-
# Fallback implementation
|
|
25
|
-
create_fallback_repository_state
|
|
26
|
-
end
|
|
14
|
+
service = Makit::V1::Git::GitRepositoryServiceImpl.new
|
|
15
|
+
request = Makit::V1::Git::GetRepositoryStateRequest.new
|
|
16
|
+
service.get_repository_state(request, nil)
|
|
27
17
|
end
|
|
28
18
|
|
|
29
19
|
# Delegate all static methods to gRPC service
|
|
30
20
|
def self.git_repo?
|
|
31
|
-
|
|
32
|
-
get_repository_state.is_git_repo
|
|
33
|
-
else
|
|
34
|
-
Dir.exist?(".git")
|
|
35
|
-
end
|
|
21
|
+
get_repository_state.is_git_repo
|
|
36
22
|
end
|
|
37
23
|
|
|
38
24
|
def self.ci?
|
|
39
|
-
|
|
40
|
-
get_repository_state.is_ci
|
|
41
|
-
else
|
|
42
|
-
ENV["CI"] == "true"
|
|
43
|
-
end
|
|
25
|
+
get_repository_state.is_ci
|
|
44
26
|
end
|
|
45
27
|
|
|
46
28
|
def self.detached
|
|
47
|
-
|
|
48
|
-
get_repository_state.is_detached
|
|
49
|
-
else
|
|
50
|
-
`git status`.include?("detached") rescue false
|
|
51
|
-
end
|
|
29
|
+
get_repository_state.is_detached
|
|
52
30
|
end
|
|
53
31
|
|
|
54
32
|
def self.read_only?
|
|
55
|
-
|
|
56
|
-
get_repository_state.is_read_only
|
|
57
|
-
else
|
|
58
|
-
!git_repo? || detached
|
|
59
|
-
end
|
|
33
|
+
get_repository_state.is_read_only
|
|
60
34
|
end
|
|
61
35
|
|
|
62
36
|
def self.clean?
|
|
63
|
-
|
|
64
|
-
get_repository_state.is_clean
|
|
65
|
-
else
|
|
66
|
-
`git status --porcelain`.empty? rescue true
|
|
67
|
-
end
|
|
37
|
+
get_repository_state.is_clean
|
|
68
38
|
end
|
|
69
39
|
|
|
70
40
|
def self.unstaged_files
|
|
71
|
-
|
|
72
|
-
get_repository_state.unstaged_files.to_a
|
|
73
|
-
else
|
|
74
|
-
`git status --porcelain`.split("\n") rescue []
|
|
75
|
-
end
|
|
41
|
+
get_repository_state.unstaged_files.to_a
|
|
76
42
|
end
|
|
77
43
|
|
|
78
44
|
def self.untracked_files
|
|
79
|
-
|
|
80
|
-
get_repository_state.untracked_files.to_a
|
|
81
|
-
else
|
|
82
|
-
`git ls-files --others --exclude-standard`.split("\n") rescue []
|
|
83
|
-
end
|
|
45
|
+
get_repository_state.untracked_files.to_a
|
|
84
46
|
end
|
|
85
47
|
|
|
86
48
|
def self.get_file_infos
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
convert_file_infos_from_proto(proto_file_infos)
|
|
90
|
-
else
|
|
91
|
-
# Fallback implementation
|
|
92
|
-
file_list = `git ls-files`.split("\n") rescue []
|
|
93
|
-
file_list.map do |file|
|
|
94
|
-
Makit::FileInfo.new(
|
|
95
|
-
name: file,
|
|
96
|
-
mtime: File.mtime(file),
|
|
97
|
-
size: File.size(file)
|
|
98
|
-
)
|
|
99
|
-
rescue StandardError
|
|
100
|
-
nil
|
|
101
|
-
end.compact.sort_by(&:mtime).reverse
|
|
102
|
-
end
|
|
49
|
+
proto_file_infos = get_repository_state.tracked_file_infos
|
|
50
|
+
convert_file_infos_from_proto(proto_file_infos)
|
|
103
51
|
end
|
|
104
52
|
|
|
105
53
|
def self.get_untracked_file_infos
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
convert_file_infos_from_proto(proto_file_infos)
|
|
109
|
-
else
|
|
110
|
-
# Fallback implementation
|
|
111
|
-
file_list = `git ls-files --others --exclude-standard`.split("\n") rescue []
|
|
112
|
-
file_list.map do |file|
|
|
113
|
-
Makit::FileInfo.new(
|
|
114
|
-
name: file,
|
|
115
|
-
mtime: File.mtime(file),
|
|
116
|
-
size: File.size(file)
|
|
117
|
-
)
|
|
118
|
-
rescue StandardError
|
|
119
|
-
nil
|
|
120
|
-
end.compact.sort_by(&:mtime).reverse
|
|
121
|
-
end
|
|
54
|
+
proto_file_infos = get_repository_state.untracked_file_infos
|
|
55
|
+
convert_file_infos_from_proto(proto_file_infos)
|
|
122
56
|
end
|
|
123
57
|
|
|
124
58
|
def self.branch
|
|
125
|
-
|
|
126
|
-
get_repository_state.branch
|
|
127
|
-
else
|
|
128
|
-
`git branch --show-current`.strip rescue ""
|
|
129
|
-
end
|
|
59
|
+
get_repository_state.branch
|
|
130
60
|
end
|
|
131
61
|
|
|
132
62
|
def self.commitsha
|
|
133
|
-
|
|
134
|
-
get_repository_state.commit_sha
|
|
135
|
-
else
|
|
136
|
-
`git rev-parse HEAD`.strip rescue ""
|
|
137
|
-
end
|
|
63
|
+
get_repository_state.commit_sha
|
|
138
64
|
end
|
|
139
65
|
|
|
140
66
|
def self.commitmsg
|
|
141
|
-
|
|
142
|
-
get_repository_state.commit_message
|
|
143
|
-
else
|
|
144
|
-
`git log -1 --pretty=%B`.strip rescue ""
|
|
145
|
-
end
|
|
67
|
+
get_repository_state.commit_message
|
|
146
68
|
end
|
|
147
69
|
|
|
148
70
|
def self.commitdate
|
|
149
|
-
|
|
150
|
-
get_repository_state.commit_date
|
|
151
|
-
else
|
|
152
|
-
`git log -1 --pretty=%cd`.strip rescue ""
|
|
153
|
-
end
|
|
71
|
+
get_repository_state.commit_date
|
|
154
72
|
end
|
|
155
73
|
|
|
156
74
|
def self.commitauthor
|
|
157
|
-
|
|
158
|
-
get_repository_state.commit_author
|
|
159
|
-
else
|
|
160
|
-
`git log -1 --pretty=%an`.strip rescue ""
|
|
161
|
-
end
|
|
75
|
+
get_repository_state.commit_author
|
|
162
76
|
end
|
|
163
77
|
|
|
164
78
|
def self.commitemail
|
|
165
|
-
|
|
166
|
-
get_repository_state.commit_email
|
|
167
|
-
else
|
|
168
|
-
`git log -1 --pretty=%ae`.strip rescue ""
|
|
169
|
-
end
|
|
79
|
+
get_repository_state.commit_email
|
|
170
80
|
end
|
|
171
81
|
|
|
172
82
|
def self.get_remote_url
|
|
173
|
-
|
|
174
|
-
get_repository_state.remote_url
|
|
175
|
-
else
|
|
176
|
-
`git remote get-url origin`.strip rescue ""
|
|
177
|
-
end
|
|
83
|
+
get_repository_state.remote_url
|
|
178
84
|
end
|
|
179
85
|
|
|
180
86
|
private
|
|
181
87
|
|
|
182
|
-
# Create a fallback repository state object
|
|
183
|
-
def self.create_fallback_repository_state
|
|
184
|
-
# Create a simple object that mimics the protobuf model interface
|
|
185
|
-
state = Object.new
|
|
186
|
-
|
|
187
|
-
def state.is_git_repo
|
|
188
|
-
@is_git_repo ||= Dir.exist?(".git")
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def state.is_ci
|
|
192
|
-
@is_ci ||= ENV["CI"] == "true"
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
def state.is_detached
|
|
196
|
-
@is_detached ||= `git status`.include?("detached") rescue false
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
def state.is_read_only
|
|
200
|
-
@is_read_only ||= !is_git_repo || is_detached
|
|
201
|
-
end
|
|
202
|
-
|
|
203
|
-
def state.is_clean
|
|
204
|
-
@is_clean ||= `git status --porcelain`.empty? rescue true
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
def state.unstaged_files
|
|
208
|
-
@unstaged_files ||= `git status --porcelain`.split("\n") rescue []
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
def state.untracked_files
|
|
212
|
-
@untracked_files ||= `git ls-files --others --exclude-standard`.split("\n") rescue []
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
def state.tracked_file_infos
|
|
216
|
-
@tracked_file_infos ||= []
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
def state.untracked_file_infos
|
|
220
|
-
@untracked_file_infos ||= []
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
def state.branch
|
|
224
|
-
@branch ||= `git branch --show-current`.strip rescue ""
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
def state.commit_sha
|
|
228
|
-
@commit_sha ||= `git rev-parse HEAD`.strip rescue ""
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
def state.commit_message
|
|
232
|
-
@commit_message ||= `git log -1 --pretty=%B`.strip rescue ""
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
def state.commit_date
|
|
236
|
-
@commit_date ||= `git log -1 --pretty=%cd`.strip rescue ""
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
def state.commit_author
|
|
240
|
-
@commit_author ||= `git log -1 --pretty=%an`.strip rescue ""
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
def state.commit_email
|
|
244
|
-
@commit_email ||= `git log -1 --pretty=%ae`.strip rescue ""
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
def state.remote_url
|
|
248
|
-
@remote_url ||= `git remote get-url origin`.strip rescue ""
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
state
|
|
252
|
-
end
|
|
253
|
-
|
|
254
88
|
# Convert protobuf FileInfo objects to Ruby FileInfo objects
|
|
255
89
|
def self.convert_file_infos_from_proto(proto_file_infos)
|
|
256
90
|
proto_file_infos.map do |proto_file_info|
|
|
@@ -31,10 +31,10 @@ module Makit
|
|
|
31
31
|
|
|
32
32
|
# Convert pipeline to YAML
|
|
33
33
|
def to_yaml(pretty_format = true)
|
|
34
|
-
if defined?(Gitlab::
|
|
34
|
+
if defined?(Makit::V1::Gitlab::Ci::PipelineService) && @grpc_available
|
|
35
35
|
# Use gRPC service if available
|
|
36
36
|
service = PipelineServiceImpl.new
|
|
37
|
-
request = Gitlab::
|
|
37
|
+
request = Makit::V1::Gitlab::Ci::ToYamlRequest.new(
|
|
38
38
|
pipeline: @pipeline_data,
|
|
39
39
|
pretty_format: pretty_format,
|
|
40
40
|
indent_size: 2
|
|
@@ -49,10 +49,10 @@ module Makit
|
|
|
49
49
|
|
|
50
50
|
# Validate pipeline
|
|
51
51
|
def validate
|
|
52
|
-
if defined?(Gitlab::
|
|
52
|
+
if defined?(Makit::V1::Gitlab::Ci::PipelineService) && @grpc_available
|
|
53
53
|
# Use gRPC service if available
|
|
54
54
|
service = PipelineServiceImpl.new
|
|
55
|
-
request = Gitlab::
|
|
55
|
+
request = Makit::V1::Gitlab::Ci::ValidatePipelineRequest.new(
|
|
56
56
|
pipeline: @pipeline_data,
|
|
57
57
|
check_gitlab_compatibility: true
|
|
58
58
|
)
|
|
@@ -71,10 +71,10 @@ module Makit
|
|
|
71
71
|
|
|
72
72
|
# Get pipeline statistics
|
|
73
73
|
def stats
|
|
74
|
-
if defined?(Gitlab::
|
|
74
|
+
if defined?(Makit::V1::Gitlab::Ci::PipelineService) && @grpc_available
|
|
75
75
|
# Use gRPC service if available
|
|
76
76
|
service = PipelineServiceImpl.new
|
|
77
|
-
request = Gitlab::
|
|
77
|
+
request = Makit::V1::Gitlab::Ci::GetPipelineStatsRequest.new(pipeline: @pipeline_data)
|
|
78
78
|
response = service.get_pipeline_stats(request, nil)
|
|
79
79
|
{
|
|
80
80
|
total_jobs: response.total_jobs,
|
|
@@ -93,10 +93,10 @@ module Makit
|
|
|
93
93
|
|
|
94
94
|
# Compare with another pipeline
|
|
95
95
|
def compare(other_pipeline)
|
|
96
|
-
if defined?(Gitlab::
|
|
96
|
+
if defined?(Makit::V1::Gitlab::Ci::PipelineService) && @grpc_available
|
|
97
97
|
# Use gRPC service if available
|
|
98
98
|
service = PipelineServiceImpl.new
|
|
99
|
-
request = Gitlab::
|
|
99
|
+
request = Makit::V1::Gitlab::Ci::ComparePipelinesRequest.new(
|
|
100
100
|
pipeline1: @pipeline_data,
|
|
101
101
|
pipeline2: other_pipeline.pipeline_data
|
|
102
102
|
)
|
|
@@ -118,10 +118,10 @@ module Makit
|
|
|
118
118
|
|
|
119
119
|
# Merge with another pipeline
|
|
120
120
|
def merge(other_pipeline, preserve_base = true)
|
|
121
|
-
if defined?(Gitlab::
|
|
121
|
+
if defined?(Makit::V1::Gitlab::Ci::PipelineService) && @grpc_available
|
|
122
122
|
# Use gRPC service if available
|
|
123
123
|
service = PipelineServiceImpl.new
|
|
124
|
-
request = Gitlab::
|
|
124
|
+
request = Makit::V1::Gitlab::Ci::MergePipelinesRequest.new(
|
|
125
125
|
base_pipeline: @pipeline_data,
|
|
126
126
|
override_pipeline: other_pipeline.pipeline_data,
|
|
127
127
|
preserve_base: preserve_base
|
|
@@ -160,7 +160,7 @@ module Makit
|
|
|
160
160
|
existing_stage = @pipeline_data.stages.find { |s| s.name == name }
|
|
161
161
|
unless existing_stage
|
|
162
162
|
if @grpc_available
|
|
163
|
-
stage = Gitlab::
|
|
163
|
+
stage = Makit::V1::Gitlab::Ci::Stage.new
|
|
164
164
|
stage.name = name
|
|
165
165
|
@pipeline_data.stages << stage
|
|
166
166
|
else
|
|
@@ -224,13 +224,13 @@ module Makit
|
|
|
224
224
|
private
|
|
225
225
|
|
|
226
226
|
def initialize_grpc_availability
|
|
227
|
-
@grpc_available = defined?(Gitlab::
|
|
227
|
+
@grpc_available = defined?(Makit::V1::Gitlab::Ci::PipelineService)
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
def execute_pipeline_grpc(variables, working_directory, podman_executable, dry_run)
|
|
231
231
|
service = Makit::Gitlab::PipelineServiceImpl.new
|
|
232
232
|
|
|
233
|
-
request = Gitlab::
|
|
233
|
+
request = Makit::V1::Gitlab::Ci::ExecutePipelineRequest.new(
|
|
234
234
|
pipeline: @pipeline_data,
|
|
235
235
|
variables: variables,
|
|
236
236
|
working_directory: working_directory,
|
|
@@ -261,7 +261,7 @@ module Makit
|
|
|
261
261
|
if @grpc_available
|
|
262
262
|
# Use gRPC service if available
|
|
263
263
|
service = PipelineServiceImpl.new
|
|
264
|
-
request = Gitlab::
|
|
264
|
+
request = Makit::V1::Gitlab::Ci::ParseYamlRequest.new(
|
|
265
265
|
yaml_content: yaml_content,
|
|
266
266
|
strict_mode: true
|
|
267
267
|
)
|
|
@@ -277,7 +277,7 @@ module Makit
|
|
|
277
277
|
initialize_grpc_availability
|
|
278
278
|
|
|
279
279
|
if @grpc_available
|
|
280
|
-
Gitlab::
|
|
280
|
+
Makit::V1::Gitlab::Ci::Pipeline.new
|
|
281
281
|
else
|
|
282
282
|
create_empty_pipeline_fallback
|
|
283
283
|
end
|
|
@@ -549,7 +549,7 @@ module Makit
|
|
|
549
549
|
def convert_hash_to_job(job_data)
|
|
550
550
|
if @grpc_available
|
|
551
551
|
# Use protobuf Job
|
|
552
|
-
job = Gitlab::
|
|
552
|
+
job = Makit::V1::Gitlab::Ci::Job.new
|
|
553
553
|
job.stage = job_data["stage"] || ""
|
|
554
554
|
job.image = job_data["image"] || ""
|
|
555
555
|
job.coverage = job_data["coverage"] || ""
|