cpflow 3.0.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 +7 -0
- data/.github/workflows/check_cpln_links.yml +19 -0
- data/.github/workflows/command_docs.yml +24 -0
- data/.github/workflows/rspec-shared.yml +56 -0
- data/.github/workflows/rspec.yml +28 -0
- data/.github/workflows/rubocop.yml +24 -0
- data/.gitignore +18 -0
- data/.overcommit.yml +16 -0
- data/.rubocop.yml +22 -0
- data/.simplecov_spawn.rb +10 -0
- data/CHANGELOG.md +259 -0
- data/CONTRIBUTING.md +73 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +126 -0
- data/LICENSE +21 -0
- data/README.md +546 -0
- data/Rakefile +21 -0
- data/bin/cpflow +6 -0
- data/cpflow +6 -0
- data/cpflow.gemspec +41 -0
- data/docs/assets/grafana-alert.png +0 -0
- data/docs/assets/memcached.png +0 -0
- data/docs/assets/sidekiq-pre-stop-hook.png +0 -0
- data/docs/commands.md +454 -0
- data/docs/dns.md +15 -0
- data/docs/migrating.md +262 -0
- data/docs/postgres.md +436 -0
- data/docs/redis.md +128 -0
- data/docs/secrets-and-env-values.md +42 -0
- data/docs/tips.md +150 -0
- data/docs/troubleshooting.md +6 -0
- data/examples/circleci.yml +104 -0
- data/examples/controlplane.yml +159 -0
- data/lib/command/apply_template.rb +209 -0
- data/lib/command/base.rb +540 -0
- data/lib/command/build_image.rb +49 -0
- data/lib/command/cleanup_images.rb +136 -0
- data/lib/command/cleanup_stale_apps.rb +79 -0
- data/lib/command/config.rb +48 -0
- data/lib/command/copy_image_from_upstream.rb +108 -0
- data/lib/command/delete.rb +149 -0
- data/lib/command/deploy_image.rb +56 -0
- data/lib/command/doctor.rb +47 -0
- data/lib/command/env.rb +22 -0
- data/lib/command/exists.rb +23 -0
- data/lib/command/generate.rb +45 -0
- data/lib/command/info.rb +222 -0
- data/lib/command/latest_image.rb +19 -0
- data/lib/command/logs.rb +49 -0
- data/lib/command/maintenance.rb +42 -0
- data/lib/command/maintenance_off.rb +62 -0
- data/lib/command/maintenance_on.rb +62 -0
- data/lib/command/maintenance_set_page.rb +34 -0
- data/lib/command/no_command.rb +23 -0
- data/lib/command/open.rb +33 -0
- data/lib/command/open_console.rb +26 -0
- data/lib/command/promote_app_from_upstream.rb +38 -0
- data/lib/command/ps.rb +41 -0
- data/lib/command/ps_restart.rb +37 -0
- data/lib/command/ps_start.rb +51 -0
- data/lib/command/ps_stop.rb +82 -0
- data/lib/command/ps_wait.rb +40 -0
- data/lib/command/run.rb +573 -0
- data/lib/command/setup_app.rb +113 -0
- data/lib/command/test.rb +23 -0
- data/lib/command/version.rb +18 -0
- data/lib/constants/exit_code.rb +7 -0
- data/lib/core/config.rb +316 -0
- data/lib/core/controlplane.rb +552 -0
- data/lib/core/controlplane_api.rb +170 -0
- data/lib/core/controlplane_api_direct.rb +112 -0
- data/lib/core/doctor_service.rb +104 -0
- data/lib/core/helpers.rb +26 -0
- data/lib/core/shell.rb +100 -0
- data/lib/core/template_parser.rb +76 -0
- data/lib/cpflow/version.rb +6 -0
- data/lib/cpflow.rb +288 -0
- data/lib/deprecated_commands.json +9 -0
- data/lib/generator_templates/Dockerfile +27 -0
- data/lib/generator_templates/controlplane.yml +62 -0
- data/lib/generator_templates/entrypoint.sh +8 -0
- data/lib/generator_templates/templates/app.yml +21 -0
- data/lib/generator_templates/templates/postgres.yml +176 -0
- data/lib/generator_templates/templates/rails.yml +36 -0
- data/rakelib/create_release.rake +81 -0
- data/script/add_command +37 -0
- data/script/check_command_docs +3 -0
- data/script/check_cpln_links +45 -0
- data/script/rename_command +43 -0
- data/script/update_command_docs +62 -0
- data/templates/app.yml +13 -0
- data/templates/daily-task.yml +32 -0
- data/templates/maintenance.yml +25 -0
- data/templates/memcached.yml +24 -0
- data/templates/postgres.yml +32 -0
- data/templates/rails.yml +27 -0
- data/templates/redis.yml +21 -0
- data/templates/redis2.yml +37 -0
- data/templates/sidekiq.yml +38 -0
- metadata +341 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1ad89476407f58ede33a74893c0b6c3f12d5484a89c728277cce513070100d5a
|
4
|
+
data.tar.gz: da2971df0ae3f45d3f3c5e0cde54ac2a95ad68570254f0f26999380a93b5a84f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88e7fed762aff1c68521fd22e1cddacfee31170fcc1e03acf1731e0e45884c02264882c141bcc5a9d48afd353071ce0b977655553ca06916879b7edcbf1c8ded
|
7
|
+
data.tar.gz: cd66a49df7bc1f8a797795199c1125045a46bf8e78db58f7d32a899085d6af726833a8611363c87517f9e3a91c271300312ebc7e75b124aa4c573b3779c9eb84
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Check Links
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
check_cpln_links:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: Check Links
|
13
|
+
steps:
|
14
|
+
- name: Checkout repository
|
15
|
+
uses: actions/checkout@v3
|
16
|
+
- name: Validate outgoing links to Control Plane
|
17
|
+
run: |
|
18
|
+
TERM=xterm-color ./script/check_cpln_links
|
19
|
+
shell: bash
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Command Docs
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: Command Docs
|
13
|
+
steps:
|
14
|
+
- name: Checkout code
|
15
|
+
uses: actions/checkout@v3
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: "2.7"
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Install dependencies
|
22
|
+
run: bundle install
|
23
|
+
- name: Check if command docs are up to date
|
24
|
+
run: bundle exec rake check_command_docs
|
@@ -0,0 +1,56 @@
|
|
1
|
+
name: RSpec Shared
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_call:
|
5
|
+
inputs:
|
6
|
+
os-version:
|
7
|
+
required: true
|
8
|
+
type: string
|
9
|
+
ruby-version:
|
10
|
+
required: true
|
11
|
+
type: string
|
12
|
+
test-tag:
|
13
|
+
required: true
|
14
|
+
type: string
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
rspec:
|
18
|
+
runs-on: ${{ inputs.os-version }}
|
19
|
+
env:
|
20
|
+
RAILS_ENV: test
|
21
|
+
# We have to add "_CI" to the end, otherwise it messes with tests where we switch profiles,
|
22
|
+
# as Control Plane will try to use this token's profile instead.
|
23
|
+
CPLN_TOKEN_CI: ${{ secrets.CPLN_TOKEN }}
|
24
|
+
CPLN_ORG: ${{ vars.CPLN_ORG }}
|
25
|
+
steps:
|
26
|
+
- name: Checkout code
|
27
|
+
uses: actions/checkout@v3
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ inputs.ruby-version }}
|
32
|
+
bundler-cache: true
|
33
|
+
- name: Install dependencies
|
34
|
+
run: bundle install
|
35
|
+
- name: Install Control Plane tools
|
36
|
+
run: |
|
37
|
+
sudo npm install -g @controlplane/cli
|
38
|
+
cpln --version
|
39
|
+
- name: Setup Control Plane tools
|
40
|
+
run: |
|
41
|
+
cpln profile create default --token $CPLN_TOKEN_CI --org $CPLN_ORG
|
42
|
+
cpln image docker-login
|
43
|
+
- name: Run tests
|
44
|
+
run: bundle exec rspec --format documentation --tag ${{ inputs.test-tag }}
|
45
|
+
- name: Upload spec log
|
46
|
+
uses: actions/upload-artifact@master
|
47
|
+
if: always()
|
48
|
+
with:
|
49
|
+
name: spec-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}.log
|
50
|
+
path: spec.log
|
51
|
+
- name: Upload coverage results
|
52
|
+
uses: actions/upload-artifact@master
|
53
|
+
if: always()
|
54
|
+
with:
|
55
|
+
name: coverage-report-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}
|
56
|
+
path: coverage
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: RSpec
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
workflow_dispatch:
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
rspec-fast:
|
12
|
+
name: RSpec (Fast)
|
13
|
+
uses: ./.github/workflows/rspec-shared.yml
|
14
|
+
with:
|
15
|
+
os-version: ubuntu-latest
|
16
|
+
ruby-version: "2.7"
|
17
|
+
test-tag: ~slow
|
18
|
+
secrets: inherit
|
19
|
+
|
20
|
+
rspec-slow:
|
21
|
+
name: RSpec (Slow)
|
22
|
+
uses: ./.github/workflows/rspec-shared.yml
|
23
|
+
if: github.event_name == 'workflow_dispatch'
|
24
|
+
with:
|
25
|
+
os-version: ubuntu-latest
|
26
|
+
ruby-version: "2.7"
|
27
|
+
test-tag: slow
|
28
|
+
secrets: inherit
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rubocop:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: Rubocop
|
13
|
+
steps:
|
14
|
+
- name: Checkout code
|
15
|
+
uses: actions/checkout@v3
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: "2.7"
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Install dependencies
|
22
|
+
run: bundle install
|
23
|
+
- name: Analyze code
|
24
|
+
run: bundle exec rubocop
|
data/.gitignore
ADDED
data/.overcommit.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
PreCommit:
|
2
|
+
ValidateLinks:
|
3
|
+
enabled: true
|
4
|
+
command: ["bash", "./script/check_cpln_links"]
|
5
|
+
CommandDocs:
|
6
|
+
enabled: true
|
7
|
+
command: ["bundle", "exec", "rake", "check_command_docs"]
|
8
|
+
RuboCop:
|
9
|
+
enabled: true
|
10
|
+
on_warn: fail
|
11
|
+
command: ["bundle", "exec", "rubocop"]
|
12
|
+
|
13
|
+
PrePush:
|
14
|
+
RSpec:
|
15
|
+
enabled: true
|
16
|
+
command: ["bundle", "exec", "rspec"]
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rake
|
3
|
+
- rubocop-rspec
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.7
|
7
|
+
NewCops: enable
|
8
|
+
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Style/Documentation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Style/StringLiterals:
|
16
|
+
EnforcedStyle: double_quotes
|
17
|
+
|
18
|
+
RSpec/ExampleLength:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
RSpec/MultipleExpectations:
|
22
|
+
Enabled: false
|
data/.simplecov_spawn.rb
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project's source code will be documented in this file. Items under `Unreleased` are upcoming features that will be out in the next version.
|
4
|
+
|
5
|
+
## Contributors
|
6
|
+
|
7
|
+
Please follow the recommendations outlined at [keepachangelog.com](https://keepachangelog.com). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare it to the latest release version.
|
8
|
+
|
9
|
+
## Versions
|
10
|
+
|
11
|
+
## [Unreleased]
|
12
|
+
|
13
|
+
Changes since the last non-beta release.
|
14
|
+
|
15
|
+
_Please add entries here for your pull requests that have not yet been released._
|
16
|
+
|
17
|
+
## [2.2.1] - 2024-06-17
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
|
21
|
+
- Fixed issue where latest image may be incorrect. [PR 201](https://github.com/shakacode/control-plane-flow/pull/201) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
22
|
+
- Fixed issue where `build-image` command hangs forever waiting for image to be available. [PR 201](https://github.com/shakacode/control-plane-flow/pull/201) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
23
|
+
|
24
|
+
## [2.2.0] - 2024-06-07
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- Fixed issue where `ps:wait` command hangs forever if workloads are suspended. [PR 198](https://github.com/shakacode/control-plane-flow/pull/198) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
29
|
+
|
30
|
+
### Added
|
31
|
+
|
32
|
+
- Added a timeout for `run` jobs (6 hours by default, but configurable through `runner_job_timeout` in `controlplane.yml`). [PR 194](https://github.com/shakacode/control-plane-flow/pull/194) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
33
|
+
|
34
|
+
### Changed
|
35
|
+
|
36
|
+
- `run` command now overrides the `--image`, `--cpu`, and `--memory` for each job separately, which completely removes any race conditions when running simultaneous jobs with different overrides. [PR 182](https://github.com/shakacode/control-plane-flow/pull/182) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
37
|
+
- `run` jobs now use a CPU size of 1 (1 core) and a memory size of 2Gi (2 gibibytes) by default (configurable through `runner_job_default_cpu` and `runner_job_default_memory` in `controlplane.yml`). [PR 182](https://github.com/shakacode/control-plane-flow/pull/182) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
38
|
+
- `run` command now keeps ENV values synced between original and runner workloads. [PR 196](https://github.com/shakacode/control-plane-flow/pull/196) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
39
|
+
|
40
|
+
## [2.1.0] - 2024-05-27
|
41
|
+
|
42
|
+
### Fixed
|
43
|
+
|
44
|
+
- Fixed issue where release script was not running from the app image. [PR 183](https://github.com/shakacode/control-plane-flow/pull/183) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
45
|
+
- Fixed issue where deprecated options were not being warned. [PR 183](https://github.com/shakacode/control-plane-flow/pull/183) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
46
|
+
|
47
|
+
### Added
|
48
|
+
|
49
|
+
- Added post-creation hook to `setup-app` command (configurable through `hooks.post_creation` in `controlplane.yml`). [PR 183](https://github.com/shakacode/control-plane-flow/pull/183) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
50
|
+
- Added pre-deletion hook to `delete` command (configurable through `hooks.pre_deletion` in `controlplane.yml`). [PR 183](https://github.com/shakacode/control-plane-flow/pull/183) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
51
|
+
- Added `doctor` command to run validations. [PR 185](https://github.com/shakacode/control-plane-flow/pull/185) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
52
|
+
|
53
|
+
### Changed
|
54
|
+
|
55
|
+
- `cpflow` now sets `CPLN_SKIP_UPDATE_CHECK` to `true` for all internal `cpln` calls, which disables the version check and prevents cluttering the logs. [PR 180](https://github.com/shakacode/control-plane-flow/pull/180) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
56
|
+
- `setup-app` command now automatically creates a secret, policy, and identity for the app if they do not exist. The `--skip-secrets-setup` option prevents this behavior. [PR 181](https://github.com/shakacode/control-plane-flow/pull/181) by [Rafael Gomes](https://github.com/rafaelgomesxyz). [PR 190](https://github.com/shakacode/control-plane-flow/pull/190) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
57
|
+
- Specific validations are now run before commands, and the command will exit with a non-zero code if any validation fails. Can be disabled by setting `DISABLE_VALIDATIONS` env var to `true`. [PR 185](https://github.com/shakacode/control-plane-flow/pull/185) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
58
|
+
- Deprecated the `--skip-secret-access-binding` option in favor of `--skip-secrets-setup`. This can also now be configured through `skip_secrets_setup` in `controlplane.yml` [PR 190](https://github.com/shakacode/control-plane-flow/pull/190) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
59
|
+
|
60
|
+
## [2.0.2] - 2024-05-17
|
61
|
+
|
62
|
+
- Fixed issue with improper handling of job statuses. Fixed issue with interactive magic string showing and exit code. [PR 177](https://github.com/shakacode/control-plane-flow/pull/177) by [Sergey Tarasov](https://github.com/dzirtusss).
|
63
|
+
|
64
|
+
## [2.0.1] - 2024-05-15
|
65
|
+
|
66
|
+
### Fixed
|
67
|
+
|
68
|
+
- Fixed issue where `cleanup-stale-apps` command fails to delete apps with volumesets. [PR 175](https://github.com/shakacode/control-plane-flow/pull/175) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
69
|
+
|
70
|
+
## [2.0.0] - 2024-05-14
|
71
|
+
|
72
|
+
### BREAKING CHANGES
|
73
|
+
|
74
|
+
- Commands that finished with a failure now exit with code `64` instead of `1`. [PR 132](https://github.com/shakacode/control-plane-flow/pull/132) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
75
|
+
- Bumped minimum `cpln` version to `2.0.1` (`cpln workload cron get` is required). [PR 171](https://github.com/shakacode/control-plane-flow/pull/171) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
76
|
+
- `run:cleanup` command has been removed. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
77
|
+
- `deploy-image` command now runs the release script in the context of the `run` command. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
78
|
+
|
79
|
+
### Fixed
|
80
|
+
|
81
|
+
- Fixed race conditions when using latest image in `run` command. [PR 163](https://github.com/shakacode/control-plane-flow/pull/163) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
82
|
+
|
83
|
+
### Added
|
84
|
+
|
85
|
+
- Added options to `run` command to override the workload container's `--cpu`, `--memory`, and `--entrypoint`. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
86
|
+
- Added `--workload` option to `delete` command to delete a specific workload. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
87
|
+
- Added `--replica` option to `logs` command to see logs from a specific replica. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
88
|
+
- Added `--replica` option to `ps:stop` command to stop a specific replica. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
89
|
+
- 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/control-plane-flow/pull/159) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
90
|
+
|
91
|
+
### Changed
|
92
|
+
|
93
|
+
- An error is now raised if the org does not exist. [PR 167](https://github.com/shakacode/control-plane-flow/pull/167) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
94
|
+
- Common options are now shown in help. [PR 169](https://github.com/shakacode/control-plane-flow/pull/169) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
95
|
+
- `run` command now uses a single reusable cron workload and works for both interactive and non-interactive jobs. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
96
|
+
- `run:detached` command has been deprecated in favor of `run`. [PR 151](https://github.com/shakacode/control-plane-flow/pull/151) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
97
|
+
- `deploy-image` command now raises an error if image does not exist. [PR 153](https://github.com/shakacode/control-plane-flow/pull/153) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
98
|
+
- `delete` command now unbinds identity from policy (if bound) when deleting app. [PR 170](https://github.com/shakacode/control-plane-flow/pull/170) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
99
|
+
|
100
|
+
## [1.4.0] - 2024-03-20
|
101
|
+
|
102
|
+
### Added
|
103
|
+
|
104
|
+
- Added new template substitution variables (used by `apply-template` and `setup-app` commands): `{{APP_LOCATION_LINK}}`, `{{APP_IMAGE_LINK}}`, `{{APP_IDENTITY}}`, `{{APP_IDENTITY_LINK}}`, `{{APP_SECRETS}}` and `{{APP_SECRETS_POLICY}}`. [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
105
|
+
- Added `--run-release-phase` option to `deploy-image` command to run release script before deploying (same step as in `promote-app-from-upstream` command). [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
106
|
+
|
107
|
+
### Changed
|
108
|
+
|
109
|
+
- Template substitution (used by `apply-template` and `setup-app` commands) now uses double braces (e.g., `APP_ORG` -> `{{APP_ORG}}`). This change is backwards compatible. [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
110
|
+
- Renamed template substitution variable `APP_GVC` to `{{APP_NAME}}` (used by `apply-template` and `setup-app` commands). This change is backwards compatible. [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
111
|
+
- `setup-app` command now automatically binds the app to the secrets policy, as long as both the identity and the policy exist. Added `--skip-secret-access-binding` option to prevent this behavior. [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
112
|
+
- Local API token is now refreshed when it is about to expire. [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
113
|
+
- `apply-template` command now exits with non-zero code if failed to apply any templates. [PR 146](https://github.com/shakacode/control-plane-flow/pull/146) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
114
|
+
|
115
|
+
## [1.3.0] - 2024-03-19
|
116
|
+
|
117
|
+
### Fixed
|
118
|
+
|
119
|
+
- Fixed issue where cpln profile was not switched back to `default` if an error happened while running `copy-image-from-upstream` command. [PR 135](https://github.com/shakacode/control-plane-flow/pull/135) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
120
|
+
- Fixed issue that didn't allow using upstream with `match_if_app_name_starts_with` set to `true` in `copy-image-from-upstream` command. [PR 136](https://github.com/shakacode/control-plane-flow/pull/136) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
121
|
+
|
122
|
+
### Added
|
123
|
+
|
124
|
+
- Added `--no-clean-on-failure` option to `run:detached` command to skip deletion of failed workload run. [PR 133](https://github.com/shakacode/control-plane-flow/pull/133) by [Justin Gordon](https://github.com/justin808) and [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
125
|
+
- Added `--domain` option to `maintenance`, `maintenance:on` and `maintenance:off` commands. [PR 131](https://github.com/shakacode/control-plane-flow/pull/131) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
126
|
+
- Added `default_domain` config to specify domain for `maintenance`, `maintenance:on` and `maintenance:off` commands. [PR 131](https://github.com/shakacode/control-plane-flow/pull/131) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
127
|
+
- Added option to specify upstream for `copy-image-from-upstream` command through `CPLN_UPSTREAM` env var. [PR 138](https://github.com/shakacode/control-plane-flow/pull/138) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
128
|
+
|
129
|
+
### Changed
|
130
|
+
|
131
|
+
- `build-image` command now accepts extra options and passes them to `docker build`. [PR 126](https://github.com/shakacode/control-plane-flow/pull/126) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
132
|
+
- `CPLN_ORG_UPSTREAM` env var now takes precedence over config from `controlplane.yml` in `copy-image-from-upstream` command. [PR 137](https://github.com/shakacode/control-plane-flow/pull/137) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
133
|
+
- `info` command now works properly for apps with `match_if_app_name_starts_with` set to `true`.[PR 139](https://github.com/shakacode/control-plane-flow/pull/139) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
134
|
+
- `info` command now lists workloads in the same order as `controlplane.yml`. [PR 139](https://github.com/shakacode/control-plane-flow/pull/139) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
135
|
+
- Improved domain workload matching for `maintenance`, `maintenance:on` and `maintenance:off` commands (instead of matching only by workload, it now matches by org + app + workload, which is more accurate). [PR 140](https://github.com/shakacode/control-plane-flow/pull/140) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
136
|
+
|
137
|
+
## [1.2.0] - 2024-01-03
|
138
|
+
|
139
|
+
### Fixed
|
140
|
+
|
141
|
+
- Fixed issue where `info` command does not respect `CPLN_ORG` env var. [PR 88](https://github.com/shakacode/control-plane-flow/pull/88) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
142
|
+
- Fixed issues with running `cpflow --version` and `cpflow --help` where no configuration file exists. [PR 100](https://github.com/shakacode/control-plane-flow/pull/100) by [Mostafa Ahangarha](https://github.com/ahangarha).
|
143
|
+
- Fixed issue where `delete` command fails to delete apps with volumesets. [PR 123](https://github.com/shakacode/control-plane-flow/pull/123) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
144
|
+
|
145
|
+
### Added
|
146
|
+
|
147
|
+
- Added `--org` option to all commands. [PR 88](https://github.com/shakacode/control-plane-flow/pull/88) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
148
|
+
- Added option to set the app with a `CPLN_APP` env var. [PR 88](https://github.com/shakacode/control-plane-flow/pull/88) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
149
|
+
- Show `org` and `app` on every command excluding `info`, `version`, `maintenance`, `env`, `ps`, and `latest_image`. [PR 94](https://github.com/shakacode/control-plane-flow/pull/94) by [Mostafa Ahangarha](https://github.com/ahangarha).
|
150
|
+
- Added option to only use `CPLN_ORG` and `CPLN_APP` env vars if `allow_org_override_by_env` and `allow_app_override_by_env` configs are set to `true` in `controlplane.yml`. [PR 109](https://github.com/shakacode/control-plane-flow/pull/109) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
151
|
+
- Added `CPLN_LOCATION` env variable and `--location` option for `apply-template`, `ps`, `run`, `run:detached`. [PR 105](https://github.com/shakacode/control-plane-flow/pull/105) by [Mostafa Ahangarha](https://github.com/ahangarha).
|
152
|
+
- Added `generate` command for creating basic Control Plane configuration directory. [PR 116](https://github.com/shakacode/control-plane-flow/pull/116) by [Mostafa Ahangarhga](https://github.com/ahangarha).
|
153
|
+
- Added `--trace` option to all commands for more detailed logs. [PR 124](https://github.com/shakacode/control-plane-flow/pull/124) by [justin808](https://github.com/justin808)
|
154
|
+
- Added better error message to check the org name in case of a 403 error. [PR 124](https://github.com/justin808) by [justin808](https://github.com/justin808)
|
155
|
+
|
156
|
+
### Changed
|
157
|
+
|
158
|
+
- `--org` option now takes precedence over `CPLN_ORG` env var, which takes precedence over `cpln_org` from `controlplane.yml`. [PR 88](https://github.com/shakacode/control-plane-flow/pull/88) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
159
|
+
- Renamed `setup` config into `setup_app_templates`. [PR 112](https://github.com/shakacode/control-plane-flow/pull/112) by [Mostafa Ahangarha](https://github.com/ahangarha).
|
160
|
+
|
161
|
+
## [1.1.2] - 2023-10-17
|
162
|
+
|
163
|
+
### Fixed
|
164
|
+
|
165
|
+
- Fixed failed build on MacOS by adding platform flag and fixed multiple files in yaml document for template. [PR 81](https://github.com/shakacode/control-plane-flow/pull/81) by [justin808](https://github.com/justin808).
|
166
|
+
|
167
|
+
### Added
|
168
|
+
|
169
|
+
- Added `open-console` command to open the app console on Control Plane. [PR 83](https://github.com/shakacode/control-plane-flow/pull/83) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
170
|
+
- Added option to set the org with a `CPLN_ORG`/`CPLN_ORG_UPSTREAM` env var. [PR 83](https://github.com/shakacode/control-plane-flow/pull/83) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
171
|
+
- Added `--verbose` option to all commands for more detailed logs. [PR 83](https://github.com/shakacode/control-plane-flow/pull/83) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
172
|
+
|
173
|
+
### Changed
|
174
|
+
|
175
|
+
- Calling `cpflow` with no command now shows the help menu. [PR 83](https://github.com/shakacode/control-plane-flow/pull/83) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
176
|
+
|
177
|
+
## [1.1.1] - 2023-09-23
|
178
|
+
|
179
|
+
### Fixed
|
180
|
+
|
181
|
+
- Fixed issue where API token is not reset when switching profile. [PR 77](https://github.com/shakacode/control-plane-flow/pull/77) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
182
|
+
|
183
|
+
## [1.1.0] - 2023-09-20
|
184
|
+
|
185
|
+
### Fixed
|
186
|
+
|
187
|
+
- Fixed issue where `copy-image-from-upstream` command does not copy commit. [PR 70](https://github.com/shakacode/control-plane-flow/pull/70) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
188
|
+
- Fixed issue where an error is not raised if the app is not defined. [PR 73](https://github.com/shakacode/control-plane-flow/pull/73) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
189
|
+
- Fixed issue where `CPLN_ENDPOINT` is not used if available. [PR 75](https://github.com/shakacode/control-plane-flow/pull/75) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
190
|
+
|
191
|
+
### Added
|
192
|
+
|
193
|
+
- Added `image_retention_max_qty` config to clean up images based on max quantity with `cleanup-images` command. [PR 72](https://github.com/shakacode/control-plane-flow/pull/72) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
194
|
+
|
195
|
+
### Changed
|
196
|
+
|
197
|
+
- Updated docs for `run` commands regarding passing arguments at the end. [PR 71](https://github.com/shakacode/control-plane-flow/pull/71) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
198
|
+
- Renamed `cleanup-old-images` command to `cleanup-images`. [PR 72](https://github.com/shakacode/control-plane-flow/pull/72) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
199
|
+
- Renamed `old_image_retention_days` config to `image_retention_days`. [PR 72](https://github.com/shakacode/control-plane-flow/pull/72) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
200
|
+
|
201
|
+
## [1.0.4] - 2023-07-21
|
202
|
+
|
203
|
+
### Fixed
|
204
|
+
|
205
|
+
- Fixed issue where `run` commands fail when not providing image. [PR 68](https://github.com/shakacode/control-plane-flow/pull/68) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
206
|
+
|
207
|
+
## [1.0.3] - 2023-07-07
|
208
|
+
|
209
|
+
### Fixed
|
210
|
+
|
211
|
+
- Fixed `run` commands when specifying image. [PR 62](https://github.com/shakacode/control-plane-flow/pull/62) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
212
|
+
- Fixed `run:cleanup` command for non-interactive workloads. [PR 63](https://github.com/shakacode/control-plane-flow/pull/63) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
213
|
+
- Fixed `run:cleanup` command for all apps that start with name. [PR 64](https://github.com/shakacode/control-plane-flow/pull/64) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
214
|
+
- Fixed `cleanup-old-images` command for all apps that start with name. [PR 65](https://github.com/shakacode/control-plane-flow/pull/65) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
215
|
+
- Fixed `--help` option. [PR 66](https://github.com/shakacode/control-plane-flow/pull/66) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
216
|
+
|
217
|
+
### Added
|
218
|
+
|
219
|
+
- Added `--use-local-token` option to `run:detached` command. [PR 61](https://github.com/shakacode/control-plane-flow/pull/61) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
220
|
+
|
221
|
+
## [1.0.2] - 2023-07-02
|
222
|
+
|
223
|
+
### Added
|
224
|
+
|
225
|
+
- Added steps to migrate to docs. [PR 57](https://github.com/shakacode/control-plane-flow/pull/57) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
226
|
+
- Added `ps:wait` command. [PR 58](https://github.com/shakacode/control-plane-flow/pull/58) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
227
|
+
|
228
|
+
## [1.0.1] - 2023-06-28
|
229
|
+
|
230
|
+
### Fixed
|
231
|
+
|
232
|
+
- Fixed `cleanup-stale-apps` command when app does not have image. [PR 55](https://github.com/shakacode/control-plane-flow/pull/55) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
233
|
+
|
234
|
+
### Changed
|
235
|
+
|
236
|
+
- Improved docs. [PR 50](https://github.com/shakacode/control-plane-flow/pull/50) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
|
237
|
+
|
238
|
+
## [1.0.0] - 2023-05-29
|
239
|
+
|
240
|
+
- Initial release
|
241
|
+
|
242
|
+
[Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v2.2.1...HEAD
|
243
|
+
[2.2.1]: https://github.com/shakacode/control-plane-flow/compare/v2.2.0...v2.2.1
|
244
|
+
[2.2.0]: https://github.com/shakacode/control-plane-flow/compare/v2.1.0...v2.2.0
|
245
|
+
[2.1.0]: https://github.com/shakacode/control-plane-flow/compare/v2.0.2...v2.1.0
|
246
|
+
[2.0.2]: https://github.com/shakacode/control-plane-flow/compare/v2.0.1...v2.0.2
|
247
|
+
[2.0.1]: https://github.com/shakacode/control-plane-flow/compare/v2.0.0...v2.0.1
|
248
|
+
[2.0.0]: https://github.com/shakacode/control-plane-flow/compare/v1.4.0...v2.0.0
|
249
|
+
[1.4.0]: https://github.com/shakacode/control-plane-flow/compare/v1.3.0...v1.4.0
|
250
|
+
[1.3.0]: https://github.com/shakacode/control-plane-flow/compare/v1.2.0...v1.3.0
|
251
|
+
[1.2.0]: https://github.com/shakacode/control-plane-flow/compare/v1.1.2...v1.2.0
|
252
|
+
[1.1.2]: https://github.com/shakacode/control-plane-flow/compare/v1.1.1...v1.1.2
|
253
|
+
[1.1.1]: https://github.com/shakacode/control-plane-flow/compare/v1.1.0...v1.1.1
|
254
|
+
[1.1.0]: https://github.com/shakacode/control-plane-flow/compare/v1.0.4...v1.1.0
|
255
|
+
[1.0.4]: https://github.com/shakacode/control-plane-flow/compare/v1.0.3...v1.0.4
|
256
|
+
[1.0.3]: https://github.com/shakacode/control-plane-flow/compare/v1.0.2...v1.0.3
|
257
|
+
[1.0.2]: https://github.com/shakacode/control-plane-flow/compare/v1.0.1...v1.0.2
|
258
|
+
[1.0.1]: https://github.com/shakacode/control-plane-flow/compare/v1.0.0...v1.0.1
|
259
|
+
[1.0.0]: https://github.com/shakacode/control-plane-flow/releases/tag/v1.0.0
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Rather than installing `cpflow` as a Ruby gem, install this repo locally and alias the `cpflow` command globally for easier
|
6
|
+
access, e.g.:
|
7
|
+
|
8
|
+
```sh
|
9
|
+
git clone https://github.com/shakacode/control-plane-flow
|
10
|
+
|
11
|
+
# Create an alias in some local shell startup script, e.g., `.profile`, `.bashrc`, etc.
|
12
|
+
alias cpflow="~/projects/control-plane-flow/bin/cpflow"
|
13
|
+
```
|
14
|
+
|
15
|
+
## Linting
|
16
|
+
|
17
|
+
Before committing or pushing code, be sure to:
|
18
|
+
|
19
|
+
- Run `bundle exec rake update_command_docs` to sync any doc changes made in the source code to the docs
|
20
|
+
- Run `bundle exec rubocop -a` to fix any linting errors
|
21
|
+
|
22
|
+
You can also install [overcommit](https://github.com/sds/overcommit) and let it automatically check for you:
|
23
|
+
|
24
|
+
```sh
|
25
|
+
gem install overcommit
|
26
|
+
|
27
|
+
overcommit --install
|
28
|
+
```
|
29
|
+
|
30
|
+
## Testing
|
31
|
+
|
32
|
+
We use real apps for the tests. You'll need to have full access to a Control Plane org, and then set it as the env var `CPLN_ORG` when running the tests (or in the `.env` file):
|
33
|
+
|
34
|
+
```sh
|
35
|
+
CPLN_ORG=your-org-for-tests bundle exec rspec
|
36
|
+
```
|
37
|
+
|
38
|
+
Alternatively, you might have a `.envrc` file with:
|
39
|
+
|
40
|
+
```sh
|
41
|
+
export CPLN_ORG=shakacode-heroku-to-control-plane-ci
|
42
|
+
export RSPEC_RETRY_RETRY_COUNT=1
|
43
|
+
```
|
44
|
+
|
45
|
+
Tests are separated between fast and slow. Slow tests can take a long time and usually involve building / deploying images and waiting for workloads to be ready / not ready, so they should only be run once in a while.
|
46
|
+
|
47
|
+
If you add a slow test, tag it with `slow`. Tests without a `slow` tag are considered fast by default.
|
48
|
+
|
49
|
+
To run fast tests:
|
50
|
+
|
51
|
+
```sh
|
52
|
+
CPLN_ORG=your-org-for-tests bundle exec rspec --tag ~slow
|
53
|
+
```
|
54
|
+
|
55
|
+
To run slow tests:
|
56
|
+
|
57
|
+
```sh
|
58
|
+
CPLN_ORG=your-org-for-tests bundle exec rspec --tag slow
|
59
|
+
```
|
60
|
+
|
61
|
+
## Debugging
|
62
|
+
|
63
|
+
1. Use the `--verbose` option to see more detailed logs.
|
64
|
+
2. Use the `--trace` option to see full logging of HTTP requests. Warning, this will display keys to your logs or console.
|
65
|
+
1. Add a breakpoint (`debugger`) to any line of code you want to debug.
|
66
|
+
2. Modify the `lib/command/test.rb` file to trigger the code you want to test. To simulate a command, you can use
|
67
|
+
`Cpflow::Cli.start` (e.g., `Cpflow::Cli.start(["deploy-image", "-a", "my-app-name"])` would be the same as running
|
68
|
+
`cpflow deploy-image -a my-app-name`).
|
69
|
+
3. Run the `test` command in your test app with a `.controlplane` directory.
|
70
|
+
|
71
|
+
```sh
|
72
|
+
cpflow test
|
73
|
+
```
|