cpl 2.0.0.rc.0 → 2.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +1 -1
- data/docs/migrating.md +1 -1
- data/lib/command/run.rb +29 -21
- data/lib/core/controlplane.rb +10 -0
- 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: '03793c0046fc403a4fb42583e57c3449394a52da4c03191d3af845e2e5e0b53f'
|
4
|
+
data.tar.gz: c882856e066cc3a63f0d8f52738e8e432a72cec33dc565224159a554949a2f5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788fa61c7d5710e72ea00db402770d3fcfd037938ce0ce1ef8134e0614a024cddb7e4629223598a509f33abf2dec499e64bf23a52b0b86b823eafe59b3522cd5
|
7
|
+
data.tar.gz: 6ba9d8cdab48da090c7efd86eb9e14f05845ed1f219c6d251ce18ad636e34d678562d092ad52806dae3a4d106cd4760402463c823d9e66158f14e6cd806fc520
|
data/CHANGELOG.md
CHANGED
@@ -14,12 +14,26 @@ 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
|
+
## [2.0.0.rc.0] - 2024-05-10
|
18
|
+
|
19
|
+
### BREAKING CHANGES
|
20
|
+
|
21
|
+
- Commands that finished with a failure now exit with code `64` instead of `1`. [PR 132](https://github.com/shakacode/heroku-to-control-plane/pull/132) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
22
|
+
- `run:cleanup` command has been removed. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
23
|
+
- `deploy-image` command now runs the release script in the context of the `run` command. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
24
|
+
|
17
25
|
### Added
|
18
26
|
|
27
|
+
- Added options to `run` command to override the workload container's `--cpu`, `--memory`, and `--entrypoint`. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
28
|
+
- Added `--workload` option to `delete` command to delete a specific workload. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
29
|
+
- Added `--replica` option to `logs` command to see logs from a specific replica. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
30
|
+
- Added `--replica` option to `ps:stop` command to stop a specific replica. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
19
31
|
- Added option to set custom names for secrets and secrets policy, using `secrets_name` and `secrets_policy_name` in `controlplane.yml`. [PR 159](https://github.com/shakacode/heroku-to-control-plane/pull/159) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
20
32
|
|
21
33
|
### Changed
|
22
34
|
|
35
|
+
- `run` command now uses a single reusable cron workload and works for both interactive and non-interactive jobs. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
36
|
+
- `run:detached` command has been deprecated in favor of `run`. [PR 151](https://github.com/shakacode/heroku-to-control-plane/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
23
37
|
- `deploy-image` command now raises an error if image does not exist. [PR 153](https://github.com/shakacode/heroku-to-control-plane/pull/153) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
24
38
|
|
25
39
|
## [1.4.0] - 2024-03-20
|
@@ -164,7 +178,8 @@ _Please add entries here for your pull requests that are not yet released._
|
|
164
178
|
|
165
179
|
- Initial release
|
166
180
|
|
167
|
-
[Unreleased]: https://github.com/shakacode/heroku-to-control-plane/compare/
|
181
|
+
[Unreleased]: https://github.com/shakacode/heroku-to-control-plane/compare/v2.0.0.rc.0...HEAD
|
182
|
+
[2.0.0.rc.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.4.0...v2.0.0.rc.0
|
168
183
|
[1.4.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.3.0...v1.4.0
|
169
184
|
[1.3.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.2.0...v1.3.0
|
170
185
|
[1.2.0]: https://github.com/shakacode/heroku-to-control-plane/compare/v1.1.2...v1.2.0
|
data/Gemfile.lock
CHANGED
data/docs/migrating.md
CHANGED
@@ -47,7 +47,7 @@ Note how the templates correspond to files in the `.controlplane/templates/` dir
|
|
47
47
|
`cpl setup-app` and `cpl apply-template` commands.
|
48
48
|
|
49
49
|
Ensure that env vars point to the Heroku add-ons in the template for the app (`.controlplane/templates/app.yml`). See
|
50
|
-
[this example](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.controlplane/templates/
|
50
|
+
[this example](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.controlplane/templates/gvc.yml).
|
51
51
|
|
52
52
|
After that, create a Dockerfile in `.controlplane/Dockerfile` for your deployment. See
|
53
53
|
[this example](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.controlplane/Dockerfile).
|
data/lib/command/run.rb
CHANGED
@@ -87,9 +87,9 @@ module Command
|
|
87
87
|
MAGIC_END = "---cpl run command finished---"
|
88
88
|
|
89
89
|
attr_reader :interactive, :detached, :location, :original_workload, :runner_workload,
|
90
|
-
:container, :
|
90
|
+
:container, :expected_deployed_version, :job, :replica, :command
|
91
91
|
|
92
|
-
def call # rubocop:disable Metrics/
|
92
|
+
def call # rubocop:disable Metrics/MethodLength
|
93
93
|
@interactive = config.options[:interactive] || interactive_command?
|
94
94
|
@detached = config.options[:detached]
|
95
95
|
@log_method = config.options[:log_method]
|
@@ -117,11 +117,6 @@ module Command
|
|
117
117
|
update_runner_workload
|
118
118
|
wait_for_runner_workload_update
|
119
119
|
|
120
|
-
# NOTE: need to wait some time before starting the job,
|
121
|
-
# otherwise the image may not be updated yet
|
122
|
-
# TODO: need to figure out if there's a better way to do this
|
123
|
-
sleep 1 if image_changed
|
124
|
-
|
125
120
|
start_job
|
126
121
|
wait_for_replica_for_job
|
127
122
|
|
@@ -177,41 +172,54 @@ module Command
|
|
177
172
|
end
|
178
173
|
end
|
179
174
|
|
180
|
-
def update_runner_workload # rubocop:disable Metrics/MethodLength
|
181
|
-
step("Updating runner workload '#{runner_workload}' based on '#{original_workload}'") do
|
175
|
+
def update_runner_workload # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
176
|
+
step("Updating runner workload '#{runner_workload}' based on '#{original_workload}'") do # rubocop:disable Metrics/BlockLength
|
177
|
+
@expected_deployed_version = cp.cron_workload_deployed_version(runner_workload)
|
178
|
+
should_update = false
|
179
|
+
|
182
180
|
_, original_container_spec = base_workload_specs(original_workload)
|
183
181
|
spec, container_spec = base_workload_specs(runner_workload)
|
184
182
|
|
185
183
|
# Override image if specified
|
186
184
|
image = config.options[:image]
|
187
|
-
if image
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
185
|
+
image_link = if image
|
186
|
+
image = latest_image if image == "latest"
|
187
|
+
"/org/#{config.org}/image/#{image}"
|
188
|
+
else
|
189
|
+
original_container_spec["image"]
|
190
|
+
end
|
191
|
+
if container_spec["image"] != image_link
|
192
|
+
container_spec["image"] = image_link
|
193
|
+
should_update = true
|
192
194
|
end
|
193
|
-
@image_changed = container_spec["image"] != image_link
|
194
|
-
container_spec["image"] = image_link
|
195
195
|
|
196
196
|
# Container overrides
|
197
|
-
|
198
|
-
|
197
|
+
if config.options[:cpu] && container_spec["cpu"] != config.options[:cpu]
|
198
|
+
container_spec["cpu"] = config.options[:cpu]
|
199
|
+
should_update = true
|
200
|
+
end
|
201
|
+
if config.options[:memory] && container_spec["memory"] != config.options[:memory]
|
202
|
+
container_spec["memory"] = config.options[:memory]
|
203
|
+
should_update = true
|
204
|
+
end
|
205
|
+
|
206
|
+
next true unless should_update
|
199
207
|
|
200
208
|
# Update runner workload
|
209
|
+
@expected_deployed_version += 1
|
201
210
|
cp.apply_hash("kind" => "workload", "name" => runner_workload, "spec" => spec)
|
202
211
|
end
|
203
212
|
end
|
204
213
|
|
205
214
|
def wait_for_runner_workload_create
|
206
215
|
step("Waiting for runner workload '#{runner_workload}' to be created", retry_on_failure: true) do
|
207
|
-
cp.
|
216
|
+
!cp.cron_workload_deployed_version(runner_workload).nil?
|
208
217
|
end
|
209
218
|
end
|
210
219
|
|
211
220
|
def wait_for_runner_workload_update
|
212
221
|
step("Waiting for runner workload '#{runner_workload}' to be updated", retry_on_failure: true) do
|
213
|
-
|
214
|
-
container_spec["image"] == image_link
|
222
|
+
cp.cron_workload_deployed_version(runner_workload) >= expected_deployed_version
|
215
223
|
end
|
216
224
|
end
|
217
225
|
|
data/lib/core/controlplane.rb
CHANGED
@@ -245,6 +245,16 @@ class Controlplane # rubocop:disable Metrics/ClassLength
|
|
245
245
|
perform_yaml(cmd)
|
246
246
|
end
|
247
247
|
|
248
|
+
def cron_workload_deployed_version(workload)
|
249
|
+
current_deployment = fetch_workload_deployments(workload)&.dig("items")&.first
|
250
|
+
return nil unless current_deployment
|
251
|
+
|
252
|
+
ready = current_deployment.dig("status", "ready")
|
253
|
+
last_processed_version = current_deployment.dig("status", "lastProcessedVersion")
|
254
|
+
|
255
|
+
ready ? last_processed_version : nil
|
256
|
+
end
|
257
|
+
|
248
258
|
# volumeset
|
249
259
|
|
250
260
|
def fetch_volumesets(a_gvc = gvc)
|
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.0.rc.
|
4
|
+
version: 2.0.0.rc.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-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: debug
|