cpflow 4.1.1 → 4.2.0
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/.github/workflows/claude-code-review.yml +44 -0
- data/.github/workflows/claude.yml +50 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +13 -1
- data/Gemfile.lock +2 -2
- data/README.md +11 -8
- data/docs/ci-automation.md +28 -0
- data/docs/commands.md +5 -1
- data/lib/command/ps_wait.rb +5 -1
- data/lib/command/run.rb +3 -20
- data/lib/core/config.rb +1 -1
- data/lib/core/controlplane.rb +4 -3
- data/lib/core/controlplane_api_direct.rb +23 -1
- data/lib/cpflow/version.rb +1 -1
- data/lib/cpflow.rb +1 -0
- metadata +6 -3
- /data/docs/{migrating.md → migrating-heroku-to-control-plane.md} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc6063b9255b39b0e28fba089bec5fd9ac88d05db3902c4f3f79d89afa6c38f0
|
|
4
|
+
data.tar.gz: febd4388547d3ed2a25ca0f9c8231d704891f26457c2860bb3586bf9ad75f745
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef1a7b52cfd4166056d66e5997b497bee2dadfbaf31185ef276ac5c030937acae95866400edcfe43fece6c9304d5865a811a615632f25f0586b0cf08ced74be9
|
|
7
|
+
data.tar.gz: 0fe9f702f59c555935d21fbb2fd9eec3285c99ed3f915414ffafa40330e4cc9066a122f577098e7e4f2f162146775c607db516c137464986983dcfbda7318272
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Claude Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, ready_for_review, reopened]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
claude-review:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: write
|
|
13
|
+
issues: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v6
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 1
|
|
21
|
+
|
|
22
|
+
- name: Run Claude Code Review
|
|
23
|
+
id: claude-review
|
|
24
|
+
uses: anthropics/claude-code-action@v1
|
|
25
|
+
with:
|
|
26
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
27
|
+
prompt: |
|
|
28
|
+
REPO: ${{ github.repository }}
|
|
29
|
+
PR NUMBER: ${{ github.event.pull_request.number }}
|
|
30
|
+
|
|
31
|
+
Please review this pull request with a focus on:
|
|
32
|
+
- Code quality and best practices
|
|
33
|
+
- Potential bugs or issues
|
|
34
|
+
- Security implications
|
|
35
|
+
- Performance considerations
|
|
36
|
+
|
|
37
|
+
Note: The PR branch is already checked out in the current working directory.
|
|
38
|
+
|
|
39
|
+
Use `gh pr comment` for top-level feedback.
|
|
40
|
+
Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues.
|
|
41
|
+
Only post GitHub comments - don't submit review text as messages.
|
|
42
|
+
|
|
43
|
+
claude_args: |
|
|
44
|
+
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Claude Code
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request_review_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
issues:
|
|
9
|
+
types: [opened, assigned]
|
|
10
|
+
pull_request_review:
|
|
11
|
+
types: [submitted]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
claude:
|
|
15
|
+
if: |
|
|
16
|
+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
17
|
+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
18
|
+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
|
19
|
+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
pull-requests: read
|
|
24
|
+
issues: read
|
|
25
|
+
id-token: write
|
|
26
|
+
actions: read # Required for Claude to read CI results on PRs
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout repository
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 1
|
|
32
|
+
|
|
33
|
+
- name: Run Claude Code
|
|
34
|
+
id: claude
|
|
35
|
+
uses: anthropics/claude-code-action@v1
|
|
36
|
+
with:
|
|
37
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
38
|
+
|
|
39
|
+
# This is an optional setting that allows Claude to read CI results on PRs
|
|
40
|
+
additional_permissions: |
|
|
41
|
+
actions: read
|
|
42
|
+
|
|
43
|
+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
|
44
|
+
# prompt: 'Update the pull request description to include a summary of changes.'
|
|
45
|
+
|
|
46
|
+
# Optional: Add claude_args to customize behavior and configuration
|
|
47
|
+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
48
|
+
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
49
|
+
# claude_args: '--allowed-tools Bash(gh pr:*)'
|
|
50
|
+
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,17 @@ Changes since the last non-beta release.
|
|
|
14
14
|
|
|
15
15
|
_Please add entries here for your pull requests that have not yet been released._
|
|
16
16
|
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed issue where `run` command could hang indefinitely when updating runner workload. [PR 260](https://github.com/shakacode/control-plane-flow/pull/260) by [Sergey Tarasov](https://github.com/dzirtusss).
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Redact sensitive data (Authorization headers, tokens) from `--trace` output. [PR 261](https://github.com/shakacode/control-plane-flow/pull/261) by [Sergey Tarasov](https://github.com/dzirtusss).
|
|
24
|
+
|
|
25
|
+
## [4.1.1] - 2025-03-14
|
|
26
|
+
|
|
27
|
+
|
|
17
28
|
### Fixed
|
|
18
29
|
|
|
19
30
|
- Fixed issue where `ps`, `ps:start`, `ps:stop`, `ps:wait`, and `run` commands fail when trying to fetch replicas with CPLN CLI. [PR 254](https://github.com/shakacode/control-plane-flow/pull/254) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
|
@@ -280,7 +291,8 @@ Deprecated `cpl` gem. New gem is `cpflow`.
|
|
|
280
291
|
|
|
281
292
|
First release.
|
|
282
293
|
|
|
283
|
-
[Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v4.1.
|
|
294
|
+
[Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v4.1.1...HEAD
|
|
295
|
+
[4.1.1]: https://github.com/shakacode/control-plane-flow/compare/v4.1.0...v4.1.1
|
|
284
296
|
[4.1.0]: https://github.com/shakacode/control-plane-flow/compare/v4.0.0...v4.1.0
|
|
285
297
|
[4.0.0]: https://github.com/shakacode/control-plane-flow/compare/v3.0.1...v4.0.0
|
|
286
298
|
[3.0.1]: https://github.com/shakacode/control-plane-flow/compare/v3.0.0...v3.0.1
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
cpflow (4.
|
|
4
|
+
cpflow (4.2.0)
|
|
5
5
|
dotenv (~> 2.8.1)
|
|
6
6
|
jwt (~> 2.8.1)
|
|
7
7
|
psych (~> 5.1.0)
|
|
@@ -13,7 +13,7 @@ GEM
|
|
|
13
13
|
addressable (2.8.7)
|
|
14
14
|
public_suffix (>= 2.0.2, < 7.0)
|
|
15
15
|
ast (2.4.2)
|
|
16
|
-
base64 (0.
|
|
16
|
+
base64 (0.3.0)
|
|
17
17
|
bigdecimal (3.1.8)
|
|
18
18
|
childprocess (4.1.0)
|
|
19
19
|
crack (1.0.0)
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ many "Heroku" abstractions and naming conventions.
|
|
|
37
37
|
|
|
38
38
|
Control Plane provides access to raw cloud computing power but lacks the simple abstractions of Heroku. The `cpflow` CLI bridges this gap, delivering a streamlined and familiar experience for developers.
|
|
39
39
|
|
|
40
|
-
While this repository simplifies migration from Heroku, the `cpflow` CLI is versatile and can be used for
|
|
40
|
+
While this repository simplifies migration from Heroku, the `cpflow` CLI is versatile and can be used for any application. This document contains **concept mapping** and **helper CLI** approach to streamline deployment workflows and minimize manual effort.
|
|
41
41
|
|
|
42
42
|
Additionally, the documentation includes numerous examples and practical tips for teams transitioning from Heroku to Kubernetes, helping them make the most of Control Plane's advanced features.
|
|
43
43
|
|
|
@@ -82,7 +82,7 @@ On Control Plane, we can map a Heroku app to a GVC (Global Virtual Cloud). Such
|
|
|
82
82
|
be anything that can run as a container.
|
|
83
83
|
|
|
84
84
|
| Heroku | Control Plane |
|
|
85
|
-
|
|
85
|
+
|------------------|---------------------------------------------|
|
|
86
86
|
| _app_ | _GVC_ (Global Virtual Cloud) |
|
|
87
87
|
| _dyno_ | _workload_ |
|
|
88
88
|
| _add-on_ | either a _workload_ or an external resource |
|
|
@@ -105,7 +105,12 @@ For the typical Rails app, this means:
|
|
|
105
105
|
| in-memory db | `redis`, `memcached` | add-on | external provider or can be set up for development/testing with Docker image (lacks persistence between restarts) |
|
|
106
106
|
| others | `mailtrap` | add-on | external provider or can be set up for development/testing with Docker image (lacks persistence between restarts) |
|
|
107
107
|
|
|
108
|
-
##
|
|
108
|
+
## Migration Strategy
|
|
109
|
+
See this doc for [detailed migration steps](./docs/migrating-heroku-to-control-plane.md) from Heroku to Control Plane. Even if you are coming from a platform other than Heroku, you can still benefit from the migration steps.
|
|
110
|
+
|
|
111
|
+
## System Prerequisites
|
|
112
|
+
|
|
113
|
+
_Note, if you want to use Terraform with cpflow, you will start the same way below._
|
|
109
114
|
|
|
110
115
|
1. Ensure your [Control Plane](https://shakacode.controlplane.com/) account is set up. Set up an `organization` `<your-org>` for testing in that account and modify the value for `aliases.common.cpln_org` in `.controlplane/controlplane.yml`, or you can also set it with the `CPLN_ORG` environment variable. If you need an organization, please [contact Shakacode](mailto:controlplane@shakacode.com).
|
|
111
116
|
|
|
@@ -130,15 +135,11 @@ npm update -g @controlplane/cli
|
|
|
130
135
|
|
|
131
136
|
6. Install Control Plane Flow `cpflow` CLI as a [Ruby gem](https://rubygems.org/gems/cpflow): `gem install cpflow`. If you want to use `cpflow` from Rake tasks in a Rails project, use `Bundler.with_unbundled_env { `cpflow help` } or else you'll get an error that `cpflow` cannot be found. While you can add `cpflow` to your Gemfile, it's not recommended because it might trigger conflicts with other gems.
|
|
132
137
|
|
|
133
|
-
7. You can use [this Dockerfile](https://github.com/shakacode/
|
|
138
|
+
7. You will need a production-ready Dockerfile. If you're using Rails, consider the default one that ships with Rails 8. You can use [this Dockerfile](https://github.com/shakacode/rails-v8-kamal-v2-terraform-gcp-tutorial/blob/master/Dockerfile) as an example for your project. Ensure that you have Docker running.
|
|
134
139
|
|
|
135
140
|
**Note:** Do not confuse the `cpflow` CLI with the `cpln` CLI. The `cpflow` CLI is the Control Plane Flow playbook CLI.
|
|
136
141
|
The `cpln` CLI is the Control Plane CLI.
|
|
137
142
|
|
|
138
|
-
## Steps to Migrate
|
|
139
|
-
|
|
140
|
-
Click [here](https://www.shakacode.com/control-plane-flow/docs/migrating/) to see the steps to migrate.
|
|
141
|
-
|
|
142
143
|
## Configuration Files
|
|
143
144
|
|
|
144
145
|
The `cpflow` gem is based on several configuration files within a `/.controlplane` top-level directory in your project.
|
|
@@ -331,6 +332,8 @@ apps:
|
|
|
331
332
|
|
|
332
333
|
For a live example, see the [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/.controlplane/readme.md) repository.
|
|
333
334
|
|
|
335
|
+
You can use this repository as a reference for setting up your own project.
|
|
336
|
+
|
|
334
337
|
This example should closely match the below example.
|
|
335
338
|
|
|
336
339
|
Suppose your app is called `tutorial-app`. You can run the following commands.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# CI Automation, Review Apps, Staging, and Promoting to Production
|
|
2
|
+
|
|
3
|
+
## Setting up Tokens for CI Automation
|
|
4
|
+
|
|
5
|
+
This example uses Github Actions. The same applies to Circle CI and other similar CI/CD tools.
|
|
6
|
+
|
|
7
|
+
1. Ensure that you have two orgs:
|
|
8
|
+
1. `company-staging` (for staging deployments, developers have access)
|
|
9
|
+
2. `company-production` (for production deployments, limited access)
|
|
10
|
+
2. Create the token for staging org and set on Github repository secrets and variables:
|
|
11
|
+
1. Go to the Control Plane UI for your organization's staging org
|
|
12
|
+
2. Make a new service account called `github-actions-staging`
|
|
13
|
+
3. Assign to the group `superusers`
|
|
14
|
+
4. Click "Keys" and create a one with description "Github Actions" and copy the token (or download it).
|
|
15
|
+
5. Add this key to your Github repository **secrets** as `CPLN_TOKEN_STAGING`
|
|
16
|
+
6. Add another key to your Github repository **variables** as `CPLN_ORG_STAGING` with the name of the staging org, like `company-staging`
|
|
17
|
+
3. Create the token for production org, and set on Github repository secrets and variables.
|
|
18
|
+
1. Go to the Control Plane UI for your organization's production org
|
|
19
|
+
2. Make a new service account called `github-actions-production`
|
|
20
|
+
3. Assign to the group `superusers`
|
|
21
|
+
4. Click "Keys" and create a one with description "Github Actions" and copy the token (or download it).
|
|
22
|
+
5. Add this key to your Github repository **secrets** as `CPLN_TOKEN_PRODUCTION`
|
|
23
|
+
6. Add another key to your Github repository **variables** as `CPLN_ORG_PRODUCTION` with the name of the production org, like `company-production`
|
|
24
|
+
4. Create a few more ENV **variables** for the app name and the app prefix:
|
|
25
|
+
1. `STAGING_APP_NAME` - the name of the app in Control Plane for staging, which is the GVC name, like `app-name-staging`
|
|
26
|
+
2. `PRODUCTION_APP_NAME` - the name of the app in Control Plane for production, which is the GVC name, like `app-name-production`
|
|
27
|
+
3. `REVIEW_APP_PREFIX` - the prefix for the review apps in Control Plane. The Review apps are named `$REVIEW_APP_PREFIX-pr-$PR_NUMBER`
|
|
28
|
+
5. All in all, you should have 2 secrets and 5 variables set in your Github repository
|
data/docs/commands.md
CHANGED
|
@@ -354,13 +354,17 @@ cpflow ps:stop -a $APP_NAME -w $WORKLOAD_NAME -r $REPLICA_NAME
|
|
|
354
354
|
### `ps:wait`
|
|
355
355
|
|
|
356
356
|
- Waits for workloads in app to be ready after re-deployment
|
|
357
|
+
- Use Unix timeout command to set a maximum wait time (e.g., `timeout 300 cpflow ps:wait ...`)
|
|
357
358
|
|
|
358
359
|
```sh
|
|
359
360
|
# Waits for all workloads in app.
|
|
360
361
|
cpflow ps:wait -a $APP_NAME
|
|
361
362
|
|
|
362
363
|
# Waits for a specific workload in app.
|
|
363
|
-
cpflow ps:
|
|
364
|
+
cpflow ps:wait -a $APP_NAME -w $WORKLOAD_NAME
|
|
365
|
+
|
|
366
|
+
# Waits for all workloads with a 5-minute timeout.
|
|
367
|
+
timeout 300 cpflow ps:wait -a $APP_NAME
|
|
364
368
|
```
|
|
365
369
|
|
|
366
370
|
### `run`
|
data/lib/command/ps_wait.rb
CHANGED
|
@@ -11,6 +11,7 @@ module Command
|
|
|
11
11
|
DESCRIPTION = "Waits for workloads in app to be ready after re-deployment"
|
|
12
12
|
LONG_DESCRIPTION = <<~DESC
|
|
13
13
|
- Waits for workloads in app to be ready after re-deployment
|
|
14
|
+
- Use Unix timeout command to set a maximum wait time (e.g., `timeout 300 cpflow ps:wait ...`)
|
|
14
15
|
DESC
|
|
15
16
|
EXAMPLES = <<~EX
|
|
16
17
|
```sh
|
|
@@ -18,7 +19,10 @@ module Command
|
|
|
18
19
|
cpflow ps:wait -a $APP_NAME
|
|
19
20
|
|
|
20
21
|
# Waits for a specific workload in app.
|
|
21
|
-
cpflow ps:
|
|
22
|
+
cpflow ps:wait -a $APP_NAME -w $WORKLOAD_NAME
|
|
23
|
+
|
|
24
|
+
# Waits for all workloads with a 5-minute timeout.
|
|
25
|
+
timeout 300 cpflow ps:wait -a $APP_NAME
|
|
22
26
|
```
|
|
23
27
|
EX
|
|
24
28
|
|
data/lib/command/run.rb
CHANGED
|
@@ -97,7 +97,7 @@ module Command
|
|
|
97
97
|
|
|
98
98
|
attr_reader :interactive, :detached, :location, :original_workload, :runner_workload,
|
|
99
99
|
:default_image, :default_cpu, :default_memory, :job_timeout, :job_history_limit,
|
|
100
|
-
:container, :
|
|
100
|
+
:container, :job, :replica, :command
|
|
101
101
|
|
|
102
102
|
def call # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
103
103
|
@interactive = config.options[:interactive] || interactive_command?
|
|
@@ -126,10 +126,7 @@ module Command
|
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
create_runner_workload if cp.fetch_workload(runner_workload).nil?
|
|
129
|
-
wait_for_runner_workload_deploy
|
|
130
129
|
update_runner_workload
|
|
131
|
-
wait_for_runner_workload_update if expected_deployed_version
|
|
132
|
-
|
|
133
130
|
start_job
|
|
134
131
|
wait_for_replica_for_job
|
|
135
132
|
|
|
@@ -191,7 +188,7 @@ module Command
|
|
|
191
188
|
}
|
|
192
189
|
|
|
193
190
|
# Create runner workload
|
|
194
|
-
cp.apply_hash("kind" => "workload", "name" => runner_workload, "spec" => spec)
|
|
191
|
+
cp.apply_hash({ "kind" => "workload", "name" => runner_workload, "spec" => spec }, wait: true)
|
|
195
192
|
end
|
|
196
193
|
end
|
|
197
194
|
|
|
@@ -242,21 +239,7 @@ module Command
|
|
|
242
239
|
return unless should_update
|
|
243
240
|
|
|
244
241
|
step("Updating runner workload '#{runner_workload}'") do
|
|
245
|
-
|
|
246
|
-
@expected_deployed_version = (cp.cron_workload_deployed_version(runner_workload) || 0) + 1
|
|
247
|
-
cp.apply_hash("kind" => "workload", "name" => runner_workload, "spec" => spec)
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
def wait_for_runner_workload_deploy
|
|
252
|
-
step("Waiting for runner workload '#{runner_workload}' to be deployed", retry_on_failure: true) do
|
|
253
|
-
!cp.cron_workload_deployed_version(runner_workload).nil?
|
|
254
|
-
end
|
|
255
|
-
end
|
|
256
|
-
|
|
257
|
-
def wait_for_runner_workload_update
|
|
258
|
-
step("Waiting for runner workload '#{runner_workload}' to be updated", retry_on_failure: true) do
|
|
259
|
-
(cp.cron_workload_deployed_version(runner_workload) || 0) >= expected_deployed_version
|
|
242
|
+
cp.apply_hash({ "kind" => "workload", "name" => runner_workload, "spec" => spec }, wait: true)
|
|
260
243
|
end
|
|
261
244
|
end
|
|
262
245
|
|
data/lib/core/config.rb
CHANGED
|
@@ -25,7 +25,7 @@ class Config # rubocop:disable Metrics/ClassLength
|
|
|
25
25
|
return unless trace_mode
|
|
26
26
|
|
|
27
27
|
ControlplaneApiDirect.trace = trace_mode
|
|
28
|
-
Shell.warn("Trace mode is enabled
|
|
28
|
+
Shell.warn("Trace mode is enabled. Sensitive data is redacted, but please review output before sharing.")
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def org
|
data/lib/core/controlplane.rb
CHANGED
|
@@ -404,11 +404,12 @@ class Controlplane # rubocop:disable Metrics/ClassLength
|
|
|
404
404
|
end
|
|
405
405
|
|
|
406
406
|
# apply
|
|
407
|
-
def apply_template(data) # rubocop:disable Metrics/MethodLength
|
|
407
|
+
def apply_template(data, wait: false) # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
408
408
|
Tempfile.create do |f|
|
|
409
409
|
f.write(data)
|
|
410
410
|
f.rewind
|
|
411
411
|
cmd = "cpln apply #{gvc_org} --file #{f.path}"
|
|
412
|
+
cmd += " --ready" if wait && ENV.fetch("DISABLE_APPLY_READY", nil).nil?
|
|
412
413
|
if Shell.tmp_stderr
|
|
413
414
|
cmd += " 2> #{Shell.tmp_stderr.path}" if Shell.should_hide_output?
|
|
414
415
|
|
|
@@ -429,8 +430,8 @@ class Controlplane # rubocop:disable Metrics/ClassLength
|
|
|
429
430
|
end
|
|
430
431
|
end
|
|
431
432
|
|
|
432
|
-
def apply_hash(data)
|
|
433
|
-
apply_template(data.to_yaml)
|
|
433
|
+
def apply_hash(data, wait: false)
|
|
434
|
+
apply_template(data.to_yaml, wait: wait)
|
|
434
435
|
end
|
|
435
436
|
|
|
436
437
|
def parse_apply_result(result) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
class RedactedDebugOutput
|
|
4
|
+
SAFE_HEADERS = %w[Content-Type Content-Length Accept Host Date Cache-Control Connection].freeze
|
|
5
|
+
HEADER_REGEX = /^([A-Za-z\-]+): (.+)$/.freeze
|
|
6
|
+
|
|
7
|
+
def <<(msg)
|
|
8
|
+
$stdout << redact(msg)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def redact(msg)
|
|
14
|
+
msg.lines.map { |line| redact_line(line) }.join
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def redact_line(line)
|
|
18
|
+
match = line.match(HEADER_REGEX)
|
|
19
|
+
return line.gsub(/[\w\-._]{50,}/, "[REDACTED]") unless match
|
|
20
|
+
|
|
21
|
+
SAFE_HEADERS.any? { |h| h.casecmp(match[1]).zero? } ? line : "#{match[1]}: [REDACTED]\n"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
3
25
|
class ControlplaneApiDirect
|
|
4
26
|
API_METHODS = {
|
|
5
27
|
get: Net::HTTP::Get,
|
|
@@ -37,7 +59,7 @@ class ControlplaneApiDirect
|
|
|
37
59
|
|
|
38
60
|
http = Net::HTTP.new(uri.hostname, uri.port)
|
|
39
61
|
http.use_ssl = uri.scheme == "https"
|
|
40
|
-
http.set_debug_output(
|
|
62
|
+
http.set_debug_output(RedactedDebugOutput.new) if trace
|
|
41
63
|
|
|
42
64
|
response = http.start { |ht| ht.request(request) }
|
|
43
65
|
|
data/lib/cpflow/version.rb
CHANGED
data/lib/cpflow.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpflow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.2.0
|
|
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:
|
|
12
|
+
date: 2026-02-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: dotenv
|
|
@@ -77,6 +77,8 @@ extensions: []
|
|
|
77
77
|
extra_rdoc_files: []
|
|
78
78
|
files:
|
|
79
79
|
- ".github/workflows/check_cpln_links.yml"
|
|
80
|
+
- ".github/workflows/claude-code-review.yml"
|
|
81
|
+
- ".github/workflows/claude.yml"
|
|
80
82
|
- ".github/workflows/command_docs.yml"
|
|
81
83
|
- ".github/workflows/rspec-shared.yml"
|
|
82
84
|
- ".github/workflows/rspec-specific.yml"
|
|
@@ -100,9 +102,10 @@ files:
|
|
|
100
102
|
- docs/assets/grafana-alert.png
|
|
101
103
|
- docs/assets/memcached.png
|
|
102
104
|
- docs/assets/sidekiq-pre-stop-hook.png
|
|
105
|
+
- docs/ci-automation.md
|
|
103
106
|
- docs/commands.md
|
|
104
107
|
- docs/dns.md
|
|
105
|
-
- docs/migrating.md
|
|
108
|
+
- docs/migrating-heroku-to-control-plane.md
|
|
106
109
|
- docs/postgres.md
|
|
107
110
|
- docs/redis.md
|
|
108
111
|
- docs/secrets-and-env-values.md
|
|
File without changes
|