cpl 2.0.0 → 2.0.1
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/CHANGELOG.md +7 -3
- data/Gemfile.lock +1 -1
- data/docs/commands.md +2 -1
- data/lib/command/cleanup_stale_apps.rb +8 -18
- data/lib/command/delete.rb +11 -9
- data/lib/cpl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7601f22a541072ea22c5745496d77ee63409d8975903f14582e2681963e9e0ff
|
4
|
+
data.tar.gz: e3a189dbb1506571133924f9640bd144c6c1a7d1a7233096b9fbd13bef8b0a82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e2603b1e9d29e2f23deb2620edb94a51e13763a48985064facfd9ce2f9a61731267176766ad037e826430283c253300334e35514c9de60a5cda59a97c8b81a
|
7
|
+
data.tar.gz: 8c97ac2b7d5f349d90a41bf1acb8dea6e72d107cb275361792547ca9faa4b1bca66bc2566558a05fb336e1bee39d577c9c5cc0e3602971037cd2d44d5f975ed8
|
data/CHANGELOG.md
CHANGED
@@ -14,7 +14,11 @@ Changes since the last non-beta release.
|
|
14
14
|
|
15
15
|
_Please add entries here for your pull requests that are not yet released._
|
16
16
|
|
17
|
-
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Fixed issue where `cleanup-stale-apps` command fails to delete apps with volumesets. [PR 175](https://github.com/shakacode/heroku-to-control-plane/pull/175) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
20
|
+
|
21
|
+
## [2.0.0] - 2024-05-14
|
18
22
|
|
19
23
|
### BREAKING CHANGES
|
20
24
|
|
@@ -186,8 +190,8 @@ _Please add entries here for your pull requests that are not yet released._
|
|
186
190
|
|
187
191
|
- Initial release
|
188
192
|
|
189
|
-
[Unreleased]: https://github.com/shakacode/heroku-to-control-plane/compare/v2.0.0
|
190
|
-
[2.0.0
|
193
|
+
[Unreleased]: https://github.com/shakacode/heroku-to-control-plane/compare/v2.0.0...HEAD
|
194
|
+
[2.0.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.4.0...v2.0.0
|
191
195
|
[1.4.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.3.0...v1.4.0
|
192
196
|
[1.3.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.2.0...v1.3.0
|
193
197
|
[1.2.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.1.2...v1.2.0
|
data/Gemfile.lock
CHANGED
data/docs/commands.md
CHANGED
@@ -66,7 +66,8 @@ cpl cleanup-images -a $APP_NAME
|
|
66
66
|
|
67
67
|
### `cleanup-stale-apps`
|
68
68
|
|
69
|
-
- Deletes the whole app (GVC with all workloads and all images) for all stale apps
|
69
|
+
- Deletes the whole app (GVC with all workloads, all volumesets and all images) for all stale apps
|
70
|
+
- Also unbinds the app from the secrets policy, as long as both the identity and the policy exist (and are bound)
|
70
71
|
- Stale apps are identified based on the creation date of the latest image
|
71
72
|
- Specify the amount of days after an app should be considered stale through `stale_app_image_deployed_days` in the `.controlplane/controlplane.yml` file
|
72
73
|
- If `match_if_app_name_starts_with` is `true` in the `.controlplane/controlplane.yml` file, it will delete all stale apps that start with the name
|
@@ -7,9 +7,10 @@ module Command
|
|
7
7
|
app_option(required: true),
|
8
8
|
skip_confirm_option
|
9
9
|
].freeze
|
10
|
-
DESCRIPTION = "Deletes the whole app (GVC with all workloads and all images) for all stale apps"
|
10
|
+
DESCRIPTION = "Deletes the whole app (GVC with all workloads, all volumesets and all images) for all stale apps"
|
11
11
|
LONG_DESCRIPTION = <<~DESC
|
12
|
-
- Deletes the whole app (GVC with all workloads and all images) for all stale apps
|
12
|
+
- Deletes the whole app (GVC with all workloads, all volumesets and all images) for all stale apps
|
13
|
+
- Also unbinds the app from the secrets policy, as long as both the identity and the policy exist (and are bound)
|
13
14
|
- Stale apps are identified based on the creation date of the latest image
|
14
15
|
- Specify the amount of days after an app should be considered stale through `stale_app_image_deployed_days` in the `.controlplane/controlplane.yml` file
|
15
16
|
- If `match_if_app_name_starts_with` is `true` in the `.controlplane/controlplane.yml` file, it will delete all stale apps that start with the name
|
@@ -28,8 +29,8 @@ module Command
|
|
28
29
|
|
29
30
|
progress.puts
|
30
31
|
stale_apps.each do |app|
|
31
|
-
|
32
|
-
|
32
|
+
delete_app(app[:name])
|
33
|
+
progress.puts
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
@@ -57,8 +58,7 @@ module Command
|
|
57
58
|
|
58
59
|
apps.push({
|
59
60
|
name: app_name,
|
60
|
-
date: created_date
|
61
|
-
images: images.map { |current_image| current_image["name"] }
|
61
|
+
date: created_date
|
62
62
|
})
|
63
63
|
end
|
64
64
|
|
@@ -72,18 +72,8 @@ module Command
|
|
72
72
|
Shell.confirm("\nAre you sure you want to delete these #{stale_apps.length} apps?")
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
76
|
-
|
77
|
-
cp.gvc_delete(app[:name])
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def delete_images(app)
|
82
|
-
app[:images].each do |image|
|
83
|
-
step("Deleting image '#{image}'") do
|
84
|
-
cp.image_delete(image)
|
85
|
-
end
|
86
|
-
end
|
75
|
+
def delete_app(app)
|
76
|
+
Cpl::Cli.start(["delete", "-a", app, "--yes"])
|
87
77
|
end
|
88
78
|
end
|
89
79
|
end
|
data/lib/command/delete.rb
CHANGED
@@ -36,7 +36,9 @@ module Command
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def delete_single_workload(workload)
|
39
|
-
|
39
|
+
if cp.fetch_workload(workload).nil?
|
40
|
+
return progress.puts("Workload '#{workload}' does not exist in app '#{config.app}'.")
|
41
|
+
end
|
40
42
|
return unless confirm_delete(workload)
|
41
43
|
|
42
44
|
delete_workload(workload)
|
@@ -57,9 +59,9 @@ module Command
|
|
57
59
|
|
58
60
|
def check_volumesets
|
59
61
|
@volumesets = cp.fetch_volumesets["items"]
|
60
|
-
return progress.puts("No volumesets to delete.") unless @volumesets.any?
|
62
|
+
return progress.puts("No volumesets to delete from app '#{config.app}'.") unless @volumesets.any?
|
61
63
|
|
62
|
-
message = "The following volumesets will be deleted along with the app:"
|
64
|
+
message = "The following volumesets will be deleted along with the app '#{config.app}':"
|
63
65
|
volumesets_list = @volumesets.map { |volumeset| "- #{volumeset['name']}" }.join("\n")
|
64
66
|
progress.puts("#{Shell.color(message, :red)}\n#{volumesets_list}\n\n")
|
65
67
|
end
|
@@ -67,9 +69,9 @@ module Command
|
|
67
69
|
def check_images
|
68
70
|
@images = cp.query_images["items"]
|
69
71
|
.select { |image| image["name"].start_with?("#{config.app}:") }
|
70
|
-
return progress.puts("No images to delete.") unless @images.any?
|
72
|
+
return progress.puts("No images to delete from app '#{config.app}'.") unless @images.any?
|
71
73
|
|
72
|
-
message = "The following images will be deleted along with the app:"
|
74
|
+
message = "The following images will be deleted along with the app '#{config.app}':"
|
73
75
|
images_list = @images.map { |image| "- #{image['name']}" }.join("\n")
|
74
76
|
progress.puts("#{Shell.color(message, :red)}\n#{images_list}\n\n")
|
75
77
|
end
|
@@ -91,14 +93,14 @@ module Command
|
|
91
93
|
end
|
92
94
|
|
93
95
|
def delete_workload(workload)
|
94
|
-
step("Deleting workload '#{workload}'") do
|
96
|
+
step("Deleting workload '#{workload}' from app '#{config.app}'") do
|
95
97
|
cp.delete_workload(workload)
|
96
98
|
end
|
97
99
|
end
|
98
100
|
|
99
101
|
def delete_volumesets
|
100
102
|
@volumesets.each do |volumeset|
|
101
|
-
step("Deleting volumeset '#{volumeset['name']}'") do
|
103
|
+
step("Deleting volumeset '#{volumeset['name']}' from app '#{config.app}'") do
|
102
104
|
# If the volumeset is attached to a workload, we need to delete the workload first
|
103
105
|
workload = volumeset.dig("status", "usedByWorkload")&.split("/")&.last
|
104
106
|
cp.delete_workload(workload) if workload
|
@@ -110,7 +112,7 @@ module Command
|
|
110
112
|
|
111
113
|
def delete_images
|
112
114
|
@images.each do |image|
|
113
|
-
step("Deleting image '#{image['name']}'") do
|
115
|
+
step("Deleting image '#{image['name']}' from app '#{config.app}'") do
|
114
116
|
cp.image_delete(image["name"])
|
115
117
|
end
|
116
118
|
end
|
@@ -127,7 +129,7 @@ module Command
|
|
127
129
|
end
|
128
130
|
return unless is_bound
|
129
131
|
|
130
|
-
step("Unbinding identity from policy") do
|
132
|
+
step("Unbinding identity from policy for app '#{config.app}'") do
|
131
133
|
cp.unbind_identity_from_policy(app_identity_link, app_secrets_policy)
|
132
134
|
end
|
133
135
|
end
|
data/lib/cpl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-05-
|
12
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: debug
|