kdep 0.3.5 → 0.3.6
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/kdep/commands/bump.rb +19 -15
- data/lib/kdep/doctor/check_state_gitignored.rb +4 -2
- data/lib/kdep/doctor.rb +0 -2
- data/lib/kdep/old_format.rb +12 -6
- data/lib/kdep/version.rb +1 -1
- metadata +1 -2
- data/lib/kdep/doctor/check_ancestor_ignores_state.rb +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8194d84a25eda1737a9bdab8891db08ec092cfc71c86764fac24ff044b977626
|
|
4
|
+
data.tar.gz: d247a4155dea0105240416bf2af475d5a7e22b71917467f230bc13123d4c79b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3fb390e4470e4daf795717de1cac5c32142eb208dc58e529eabccba079bfeb2dd737ee74ad92ea92a675298911091dbd52ea007f9c38cbc8e624ea8d0bbf13d
|
|
7
|
+
data.tar.gz: 36e1bc46602c74aa2027e0c4377b951d0602ce24ca05470f2f0a989fe6266288da5017f3f45e91d3923efe1e884830709718a7b75aa5db8fa3c3408e20f8e2a4
|
data/lib/kdep/commands/bump.rb
CHANGED
|
@@ -44,7 +44,24 @@ module Kdep
|
|
|
44
44
|
|
|
45
45
|
config = Kdep::Config.new(deploy_dir, env).load
|
|
46
46
|
|
|
47
|
-
# Step 2:
|
|
47
|
+
# Step 2: Local config sanity — read state.yml BEFORE touching the
|
|
48
|
+
# cluster. A missing/corrupt state.yml is a local config error and
|
|
49
|
+
# should fail fast without waking kubectl.
|
|
50
|
+
begin
|
|
51
|
+
current_tag = Kdep::State.tag(deploy_dir) || handle_missing_state(deploy_dir)
|
|
52
|
+
rescue Kdep::State::Error => e
|
|
53
|
+
@ui.error(e.message)
|
|
54
|
+
exit 1
|
|
55
|
+
end
|
|
56
|
+
# to_fix.md #3 — warn if someone has gitignored state.yml
|
|
57
|
+
require "kdep/doctor/check_state_gitignored"
|
|
58
|
+
gitignore_result = Kdep::Doctor::CheckStateGitignored.new(deploy_dir).run
|
|
59
|
+
if gitignore_result.severity == :error
|
|
60
|
+
@ui.warn(gitignore_result.message)
|
|
61
|
+
@ui.warn(gitignore_result.hint) if gitignore_result.hint
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Step 3: Context guard (bump touches the cluster)
|
|
48
65
|
begin
|
|
49
66
|
Kdep::ContextGuard.new(config["context"]).validate!
|
|
50
67
|
rescue Kdep::Kubectl::Error => e
|
|
@@ -64,20 +81,7 @@ module Kdep
|
|
|
64
81
|
repo_root = File.dirname(kdep_dir)
|
|
65
82
|
|
|
66
83
|
begin
|
|
67
|
-
# Step
|
|
68
|
-
begin
|
|
69
|
-
current_tag = Kdep::State.tag(deploy_dir) || handle_missing_state(deploy_dir)
|
|
70
|
-
rescue Kdep::State::Error => e
|
|
71
|
-
@ui.error(e.message)
|
|
72
|
-
exit 1
|
|
73
|
-
end
|
|
74
|
-
# to_fix.md #3 — warn if someone has gitignored state.yml
|
|
75
|
-
require "kdep/doctor/check_state_gitignored"
|
|
76
|
-
gitignore_result = Kdep::Doctor::CheckStateGitignored.new(deploy_dir).run
|
|
77
|
-
if gitignore_result.severity == :error
|
|
78
|
-
@ui.warn(gitignore_result.message)
|
|
79
|
-
@ui.warn(gitignore_result.hint) if gitignore_result.hint
|
|
80
|
-
end
|
|
84
|
+
# Step 4: Increment minor version.
|
|
81
85
|
parsed = Kdep::VersionTagger.parse(current_tag)
|
|
82
86
|
next_version = parsed ? "#{parsed[0]}.#{parsed[1] + 1}" : "0.1"
|
|
83
87
|
@ui.info("#{current_tag} -> #{next_version}")
|
|
@@ -8,12 +8,14 @@ module Kdep
|
|
|
8
8
|
|
|
9
9
|
def run
|
|
10
10
|
state_path = File.join(deploy_dir, Kdep::State::FILENAME)
|
|
11
|
-
|
|
11
|
+
# capture3 swallows stderr so "fatal: not a git repository" noise
|
|
12
|
+
# never reaches the user when the caller runs outside a repo.
|
|
13
|
+
_, _, status = Open3.capture3("git", "check-ignore", "-q", state_path)
|
|
12
14
|
if status.success?
|
|
13
15
|
Result.new(
|
|
14
16
|
id: ID, severity: :error,
|
|
15
17
|
message: "#{state_path} is gitignored",
|
|
16
|
-
hint: "Remove 'state.yml' from .gitignore and 'git add' the file so fresh clones see the last-deployed tag."
|
|
18
|
+
hint: "Remove 'state.yml' from any .gitignore (local or ancestor) and 'git add' the file so fresh clones see the last-deployed tag."
|
|
17
19
|
)
|
|
18
20
|
else
|
|
19
21
|
Result.ok(ID)
|
data/lib/kdep/doctor.rb
CHANGED
|
@@ -5,7 +5,6 @@ require "kdep/doctor/check_state_parseable"
|
|
|
5
5
|
require "kdep/doctor/check_state_tag_format"
|
|
6
6
|
require "kdep/doctor/check_state_gitignored"
|
|
7
7
|
require "kdep/doctor/check_gitignore_canonical"
|
|
8
|
-
require "kdep/doctor/check_ancestor_ignores_state"
|
|
9
8
|
|
|
10
9
|
module Kdep
|
|
11
10
|
module Doctor
|
|
@@ -15,7 +14,6 @@ module Kdep
|
|
|
15
14
|
CheckStateTagFormat,
|
|
16
15
|
CheckStateGitignored,
|
|
17
16
|
CheckGitignoreCanonical,
|
|
18
|
-
CheckAncestorIgnoresState,
|
|
19
17
|
].freeze
|
|
20
18
|
end
|
|
21
19
|
end
|
data/lib/kdep/old_format.rb
CHANGED
|
@@ -261,14 +261,20 @@ module Kdep
|
|
|
261
261
|
# Extract the image tag from the live deploy (e.g., "0.44" from
|
|
262
262
|
# "ghcr.io/org/app:0.44"). Returns nil if the tag is "latest",
|
|
263
263
|
# empty, or absent. On multi-container deployments, returns the
|
|
264
|
-
# first usable tag found.
|
|
264
|
+
# first usable tag found. Uses rpartition so registry URLs with
|
|
265
|
+
# explicit ports (host:5000/org/app:0.44) aren't misparsed.
|
|
265
266
|
def extracted_tag
|
|
266
267
|
deployed_images.each do |img|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
before, sep, after = img.to_s.rpartition(":")
|
|
269
|
+
# rpartition returns ["", "", img] when no ":" exists
|
|
270
|
+
next if sep.empty?
|
|
271
|
+
# A host:port with no tag (e.g. "host:5000/img") has sep but the
|
|
272
|
+
# "tag" part contains a "/" — not a real tag.
|
|
273
|
+
next if after.empty? || after.include?("/")
|
|
274
|
+
next if after == "latest"
|
|
275
|
+
# before will include any host:port prefix intact
|
|
276
|
+
_ = before
|
|
277
|
+
return after
|
|
272
278
|
end
|
|
273
279
|
nil
|
|
274
280
|
end
|
data/lib/kdep/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kdep
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Leadfy
|
|
@@ -98,7 +98,6 @@ files:
|
|
|
98
98
|
- lib/kdep/docker.rb
|
|
99
99
|
- lib/kdep/doctor.rb
|
|
100
100
|
- lib/kdep/doctor/check.rb
|
|
101
|
-
- lib/kdep/doctor/check_ancestor_ignores_state.rb
|
|
102
101
|
- lib/kdep/doctor/check_gitignore_canonical.rb
|
|
103
102
|
- lib/kdep/doctor/check_state_gitignored.rb
|
|
104
103
|
- lib/kdep/doctor/check_state_parseable.rb
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require "open3"
|
|
2
|
-
require "kdep/state"
|
|
3
|
-
|
|
4
|
-
module Kdep
|
|
5
|
-
module Doctor
|
|
6
|
-
class CheckAncestorIgnoresState < Check
|
|
7
|
-
ID = "ancestor_ignores_state".freeze
|
|
8
|
-
|
|
9
|
-
def run
|
|
10
|
-
state_path = File.join(deploy_dir, Kdep::State::FILENAME)
|
|
11
|
-
_, status = Open3.capture2("git", "check-ignore", "-v", state_path)
|
|
12
|
-
if status.success?
|
|
13
|
-
Result.new(
|
|
14
|
-
id: ID, severity: :error,
|
|
15
|
-
message: "An ancestor .gitignore is ignoring #{state_path}",
|
|
16
|
-
hint: "Run 'git check-ignore -v #{state_path}' to find which file, then remove the pattern."
|
|
17
|
-
)
|
|
18
|
-
else
|
|
19
|
-
Result.ok(ID)
|
|
20
|
-
end
|
|
21
|
-
rescue Errno::ENOENT
|
|
22
|
-
Result.ok(ID)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|