cpflow 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ad89476407f58ede33a74893c0b6c3f12d5484a89c728277cce513070100d5a
4
- data.tar.gz: da2971df0ae3f45d3f3c5e0cde54ac2a95ad68570254f0f26999380a93b5a84f
3
+ metadata.gz: b703678fbaeb6b6300473a8f4529a7c9e62dcc2439ab22cae79abe1a01f83fad
4
+ data.tar.gz: 9a75cf47df352fce3efe005ebc283d1581befdc5185d8628de8eca0b3df70c5a
5
5
  SHA512:
6
- metadata.gz: 88e7fed762aff1c68521fd22e1cddacfee31170fcc1e03acf1731e0e45884c02264882c141bcc5a9d48afd353071ce0b977655553ca06916879b7edcbf1c8ded
7
- data.tar.gz: cd66a49df7bc1f8a797795199c1125045a46bf8e78db58f7d32a899085d6af726833a8611363c87517f9e3a91c271300312ebc7e75b124aa4c573b3779c9eb84
6
+ metadata.gz: 26cff99f48b33180c93f3d90d1f726c766f7cf49ed983bb1079cc4260affa95f1e8d8596f21817f910f2abead651fca7856284245d2cb8ae936b100fde7507e9
7
+ data.tar.gz: aa7160f2cb036ccff1aa99484a5566102331f07cabf0afe6e5fe4f592a0a1de68cb1c205706a694a91e10bc5ff5f2104dd5edc9d235985fd67e136f3a4b2b1f7
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "2.7"
19
+ ruby-version: "3.2"
20
20
  bundler-cache: true
21
21
  - name: Install dependencies
22
22
  run: bundle install
@@ -3,19 +3,22 @@ name: RSpec Shared
3
3
  on:
4
4
  workflow_call:
5
5
  inputs:
6
- os-version:
6
+ os_version:
7
7
  required: true
8
8
  type: string
9
- ruby-version:
9
+ ruby_version:
10
10
  required: true
11
11
  type: string
12
- test-tag:
13
- required: true
12
+ test_tag:
13
+ required: false
14
+ type: string
15
+ spec_paths:
16
+ required: false
14
17
  type: string
15
18
 
16
19
  jobs:
17
20
  rspec:
18
- runs-on: ${{ inputs.os-version }}
21
+ runs-on: ${{ inputs.os_version }}
19
22
  env:
20
23
  RAILS_ENV: test
21
24
  # We have to add "_CI" to the end, otherwise it messes with tests where we switch profiles,
@@ -28,7 +31,7 @@ jobs:
28
31
  - name: Set up Ruby
29
32
  uses: ruby/setup-ruby@v1
30
33
  with:
31
- ruby-version: ${{ inputs.ruby-version }}
34
+ ruby-version: ${{ inputs.ruby_version }}
32
35
  bundler-cache: true
33
36
  - name: Install dependencies
34
37
  run: bundle install
@@ -41,16 +44,16 @@ jobs:
41
44
  cpln profile create default --token $CPLN_TOKEN_CI --org $CPLN_ORG
42
45
  cpln image docker-login
43
46
  - name: Run tests
44
- run: bundle exec rspec --format documentation --tag ${{ inputs.test-tag }}
47
+ run: bundle exec rspec --format documentation ${{ inputs.test_tag && format('--tag {0}', inputs.test_tag) }} ${{ inputs.spec_paths }}
45
48
  - name: Upload spec log
46
49
  uses: actions/upload-artifact@master
47
50
  if: always()
48
51
  with:
49
- name: spec-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}.log
52
+ name: spec-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}.log
50
53
  path: spec.log
51
54
  - name: Upload coverage results
52
55
  uses: actions/upload-artifact@master
53
56
  if: always()
54
57
  with:
55
- name: coverage-report-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}
58
+ name: coverage-report-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}
56
59
  path: coverage
@@ -0,0 +1,18 @@
1
+ name: RSpec Specific
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ spec_paths:
7
+ description: "Test files or directories that should be run"
8
+ required: true
9
+
10
+ jobs:
11
+ rspec-specific:
12
+ name: RSpec (Specific)
13
+ uses: ./.github/workflows/rspec-shared.yml
14
+ with:
15
+ os_version: ubuntu-latest
16
+ ruby_version: "3.2"
17
+ spec_paths: ${{ inputs.spec_paths }}
18
+ secrets: inherit
@@ -12,9 +12,9 @@ jobs:
12
12
  name: RSpec (Fast)
13
13
  uses: ./.github/workflows/rspec-shared.yml
14
14
  with:
15
- os-version: ubuntu-latest
16
- ruby-version: "2.7"
17
- test-tag: ~slow
15
+ os_version: ubuntu-latest
16
+ ruby_version: "3.2"
17
+ test_tag: ~slow
18
18
  secrets: inherit
19
19
 
20
20
  rspec-slow:
@@ -22,7 +22,7 @@ jobs:
22
22
  uses: ./.github/workflows/rspec-shared.yml
23
23
  if: github.event_name == 'workflow_dispatch'
24
24
  with:
25
- os-version: ubuntu-latest
26
- ruby-version: "2.7"
27
- test-tag: slow
25
+ os_version: ubuntu-latest
26
+ ruby_version: "3.2"
27
+ test_tag: slow
28
28
  secrets: inherit
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: "2.7"
19
+ ruby-version: "3.2"
20
20
  bundler-cache: true
21
21
  - name: Install dependencies
22
22
  run: bundle install
data/.overcommit.yml CHANGED
@@ -10,7 +10,7 @@ PreCommit:
10
10
  on_warn: fail
11
11
  command: ["bundle", "exec", "rubocop"]
12
12
 
13
- PrePush:
14
- RSpec:
15
- enabled: true
16
- command: ["bundle", "exec", "rspec"]
13
+ # PrePush:
14
+ # RSpec:
15
+ # enabled: true
16
+ # command: ["bundle", "exec", "rspec"]
data/CHANGELOG.md CHANGED
@@ -14,6 +14,30 @@ 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
+
18
+ ## [4.0.0] - 2024-08-21
19
+
20
+ ### Fixed
21
+
22
+ - Fixed issue where common options are not forwarded to other commands. [PR 207](https://github.com/shakacode/control-plane-flow/pull/207) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
23
+ - Fixed BYOK endpoint. [PR 209](https://github.com/shakacode/control-plane-flow/pull/209) by [Sergey Tarasov](https://github.com/dzirtusss).
24
+ - Fixed issue where `generate` command fails if no project config exists. [PR 219](https://github.com/shakacode/control-plane-flow/pull/219) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr).
25
+ - Bumped min `cpln` version to `3.1.0` and fixed `cpln workload exec` calls. [PR 226](https://github.com/shakacode/control-plane-flow/pull/226) by [Rafael Gomes](https://github.com/rafaelgomesxyz).
26
+
27
+ ## [3.0.1] - 2024-06-26
28
+
29
+ ### Fixed
30
+
31
+ - Moved development dependencies to Gemfile and updated many of them. [PR 208](https://github.com/shakacode/control-plane-flow/pull/208) by [Justin Gordon](https://github.com/justin808).
32
+
33
+ ## [3.0.0] - 2024-06-21
34
+
35
+ First release of `cpflow`.
36
+
37
+ ## [2.2.4] - 2024-06-21
38
+
39
+ Deprecated `cpl` gem. New gem is `cpflow`.
40
+
17
41
  ## [2.2.1] - 2024-06-17
18
42
 
19
43
  ### Fixed
@@ -57,17 +81,17 @@ _Please add entries here for your pull requests that have not yet been released.
57
81
  - 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
82
  - 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
83
 
60
- ## [2.0.2] - 2024-05-17
84
+ ## [2.0.2] - 2024-05-18
61
85
 
62
86
  - 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
87
 
64
- ## [2.0.1] - 2024-05-15
88
+ ## [2.0.1] - 2024-05-16
65
89
 
66
90
  ### Fixed
67
91
 
68
92
  - 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
93
 
70
- ## [2.0.0] - 2024-05-14
94
+ ## [2.0.0] - 2024-05-15
71
95
 
72
96
  ### BREAKING CHANGES
73
97
 
@@ -97,7 +121,7 @@ _Please add entries here for your pull requests that have not yet been released.
97
121
  - `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
122
  - `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
123
 
100
- ## [1.4.0] - 2024-03-20
124
+ ## [1.4.0] - 2024-03-21
101
125
 
102
126
  ### Added
103
127
 
@@ -134,12 +158,12 @@ _Please add entries here for your pull requests that have not yet been released.
134
158
  - `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
159
  - 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
160
 
137
- ## [1.2.0] - 2024-01-03
161
+ ## [1.2.0] - 2024-01-04
138
162
 
139
163
  ### Fixed
140
164
 
141
165
  - 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).
166
+ - Fixed issues with running `cpflow --version` and `cpflow --help` where no configuration file exists. [PR 109](https://github.com/shakacode/control-plane-flow/pull/109) by [Mostafa Ahangarha](https://github.com/ahangarha).
143
167
  - 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
168
 
145
169
  ### Added
@@ -150,19 +174,19 @@ _Please add entries here for your pull requests that have not yet been released.
150
174
  - 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
175
  - 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
176
  - 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)
177
+ - Added `--trace` option to all commands for more detailed logs. [PR 124](https://github.com/shakacode/control-plane-flow/pull/124) by [Justin Gordon](https://github.com/justin808).
178
+ - Added better error message to check the org name in case of a 403 error. [PR 124](https://github.com/shakacode/control-plane-flow/pull/124) by [Justin Gordon](https://github.com/justin808).
155
179
 
156
180
  ### Changed
157
181
 
158
182
  - `--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
183
  - 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
184
 
161
- ## [1.1.2] - 2023-10-17
185
+ ## [1.1.2] - 2023-10-25
162
186
 
163
187
  ### Fixed
164
188
 
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).
189
+ - 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 [Justin Gordon](https://github.com/justin808).
166
190
 
167
191
  ### Added
168
192
 
@@ -174,7 +198,7 @@ _Please add entries here for your pull requests that have not yet been released.
174
198
 
175
199
  - 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
200
 
177
- ## [1.1.1] - 2023-09-23
201
+ ## [1.1.1] - 2023-09-21
178
202
 
179
203
  ### Fixed
180
204
 
@@ -198,7 +222,7 @@ _Please add entries here for your pull requests that have not yet been released.
198
222
  - 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
223
  - 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
224
 
201
- ## [1.0.4] - 2023-07-21
225
+ ## [1.0.4] - 2023-07-24
202
226
 
203
227
  ### Fixed
204
228
 
@@ -237,9 +261,13 @@ _Please add entries here for your pull requests that have not yet been released.
237
261
 
238
262
  ## [1.0.0] - 2023-05-29
239
263
 
240
- - Initial release
264
+ First release.
241
265
 
242
- [Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v2.2.1...HEAD
266
+ [Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v4.0.0...HEAD
267
+ [4.0.0]: https://github.com/shakacode/control-plane-flow/compare/v3.0.1...v4.0.0
268
+ [3.0.1]: https://github.com/shakacode/control-plane-flow/compare/v3.0.0...v3.0.1
269
+ [3.0.0]: https://github.com/shakacode/control-plane-flow/compare/v2.2.4...v3.0.0
270
+ [2.2.4]: https://github.com/shakacode/control-plane-flow/compare/v2.2.1...v2.2.4
243
271
  [2.2.1]: https://github.com/shakacode/control-plane-flow/compare/v2.2.0...v2.2.1
244
272
  [2.2.0]: https://github.com/shakacode/control-plane-flow/compare/v2.1.0...v2.2.0
245
273
  [2.1.0]: https://github.com/shakacode/control-plane-flow/compare/v2.0.2...v2.1.0
data/CONTRIBUTING.md CHANGED
@@ -64,7 +64,7 @@ CPLN_ORG=your-org-for-tests bundle exec rspec --tag slow
64
64
  2. Use the `--trace` option to see full logging of HTTP requests. Warning, this will display keys to your logs or console.
65
65
  1. Add a breakpoint (`debugger`) to any line of code you want to debug.
66
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
67
+ `run_cpflow_command` (e.g., `run_cpflow_command("deploy-image", "-a", "my-app-name")` would be the same as running
68
68
  `cpflow deploy-image -a my-app-name`).
69
69
  3. Run the `test` command in your test app with a `.controlplane` directory.
70
70
 
data/Gemfile CHANGED
@@ -4,4 +4,14 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
+ gem "debug", "~> 1"
8
+ gem "overcommit", "~> 0.60.0"
7
9
  gem "rake", "~> 13.0"
10
+ gem "rspec", "~> 3.12.0"
11
+ gem "rspec-retry", "~> 0.6.2"
12
+ gem "rubocop", "~> 1.64.1"
13
+ gem "rubocop-rake", "~> 0.6.0"
14
+ gem "rubocop-rspec", "~> 3.0.1"
15
+ gem "simplecov", "~> 0.22.0"
16
+ gem "timecop", "~> 0.9.6"
17
+ gem "webmock", "~> 3.18.1"
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cpflow (3.0.0)
5
- debug (~> 1.7.1)
4
+ cpflow (4.0.0)
6
5
  dotenv (~> 2.8.1)
7
6
  jwt (~> 2.8.1)
8
7
  psych (~> 5.1.0)
@@ -11,18 +10,18 @@ PATH
11
10
  GEM
12
11
  remote: https://rubygems.org/
13
12
  specs:
14
- addressable (2.8.6)
15
- public_suffix (>= 2.0.2, < 6.0)
13
+ addressable (2.8.7)
14
+ public_suffix (>= 2.0.2, < 7.0)
16
15
  ast (2.4.2)
17
16
  base64 (0.2.0)
18
- bigdecimal (3.1.7)
17
+ bigdecimal (3.1.8)
19
18
  childprocess (4.1.0)
20
19
  crack (1.0.0)
21
20
  bigdecimal
22
21
  rexml
23
- debug (1.7.2)
24
- irb (>= 1.5.0)
25
- reline (>= 0.3.1)
22
+ debug (1.9.2)
23
+ irb (~> 1.10)
24
+ reline (>= 0.3.8)
26
25
  diff-lcs (1.5.1)
27
26
  docile (1.4.0)
28
27
  dotenv (2.8.1)
@@ -35,26 +34,28 @@ GEM
35
34
  json (2.7.2)
36
35
  jwt (2.8.2)
37
36
  base64
37
+ language_server-protocol (3.17.0.3)
38
38
  overcommit (0.60.0)
39
39
  childprocess (>= 0.6.3, < 5)
40
40
  iniparse (~> 1.4)
41
41
  rexml (~> 3.2)
42
- parallel (1.24.0)
43
- parser (3.3.0.5)
42
+ parallel (1.25.1)
43
+ parser (3.3.3.0)
44
44
  ast (~> 2.4.1)
45
45
  racc
46
46
  psych (5.1.2)
47
47
  stringio
48
- public_suffix (5.0.5)
49
- racc (1.7.3)
48
+ public_suffix (6.0.0)
49
+ racc (1.8.0)
50
50
  rainbow (3.1.1)
51
51
  rake (13.2.1)
52
52
  rdoc (6.7.0)
53
53
  psych (>= 4.0.0)
54
- regexp_parser (2.9.0)
54
+ regexp_parser (2.9.2)
55
55
  reline (0.5.9)
56
56
  io-console (~> 0.5)
57
- rexml (3.2.6)
57
+ rexml (3.3.1)
58
+ strscan
58
59
  rspec (3.12.0)
59
60
  rspec-core (~> 3.12.0)
60
61
  rspec-expectations (~> 3.12.0)
@@ -70,25 +71,23 @@ GEM
70
71
  rspec-retry (0.6.2)
71
72
  rspec-core (> 3.3)
72
73
  rspec-support (3.12.2)
73
- rubocop (1.45.1)
74
+ rubocop (1.64.1)
74
75
  json (~> 2.3)
76
+ language_server-protocol (>= 3.17.0)
75
77
  parallel (~> 1.10)
76
- parser (>= 3.2.0.0)
78
+ parser (>= 3.3.0.2)
77
79
  rainbow (>= 2.2.2, < 4.0)
78
80
  regexp_parser (>= 1.8, < 3.0)
79
81
  rexml (>= 3.2.5, < 4.0)
80
- rubocop-ast (>= 1.24.1, < 2.0)
82
+ rubocop-ast (>= 1.31.1, < 2.0)
81
83
  ruby-progressbar (~> 1.7)
82
84
  unicode-display_width (>= 2.4.0, < 3.0)
83
- rubocop-ast (1.31.2)
84
- parser (>= 3.3.0.4)
85
- rubocop-capybara (2.20.0)
86
- rubocop (~> 1.41)
85
+ rubocop-ast (1.31.3)
86
+ parser (>= 3.3.1.0)
87
87
  rubocop-rake (0.6.0)
88
88
  rubocop (~> 1.0)
89
- rubocop-rspec (2.18.1)
90
- rubocop (~> 1.33)
91
- rubocop-capybara (~> 2.17)
89
+ rubocop-rspec (3.0.1)
90
+ rubocop (~> 1.61)
92
91
  ruby-progressbar (1.13.0)
93
92
  simplecov (0.22.0)
94
93
  docile (~> 1.1)
@@ -97,8 +96,9 @@ GEM
97
96
  simplecov-html (0.12.3)
98
97
  simplecov_json_formatter (0.1.4)
99
98
  stringio (3.1.1)
99
+ strscan (3.1.0)
100
100
  thor (1.2.2)
101
- timecop (0.9.8)
101
+ timecop (0.9.10)
102
102
  unicode-display_width (2.5.0)
103
103
  webmock (3.18.1)
104
104
  addressable (>= 2.8.0)
@@ -111,13 +111,14 @@ PLATFORMS
111
111
 
112
112
  DEPENDENCIES
113
113
  cpflow!
114
+ debug (~> 1)
114
115
  overcommit (~> 0.60.0)
115
116
  rake (~> 13.0)
116
117
  rspec (~> 3.12.0)
117
118
  rspec-retry (~> 0.6.2)
118
- rubocop (~> 1.45.0)
119
+ rubocop (~> 1.64.1)
119
120
  rubocop-rake (~> 0.6.0)
120
- rubocop-rspec (~> 2.18.1)
121
+ rubocop-rspec (~> 3.0.1)
121
122
  simplecov (~> 0.22.0)
122
123
  timecop (~> 0.9.6)
123
124
  webmock (~> 3.18.1)
data/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  [![Gem](https://badge.fury.io/rb/cpflow.svg)](https://badge.fury.io/rb/cpflow)
13
13
 
14
14
 
15
- Here's a playbook for migrating from [Heroku Flow](https://www.heroku.com/flow) to [Control Plane](https://shakacode.controlplane.com) with our `cpflow` gem source code.
15
+ Enable the [Heroku Flow](https://www.heroku.com/flow) deployment model with [Control Plane](https://shakacode.controlplane.com) using the `cpflow` gem.
16
16
 
17
17
  ----
18
18
 
data/cpflow.gemspec CHANGED
@@ -15,22 +15,11 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.required_ruby_version = ">= 2.7.0"
17
17
 
18
- spec.add_dependency "debug", "~> 1.7.1"
19
18
  spec.add_dependency "dotenv", "~> 2.8.1"
20
19
  spec.add_dependency "jwt", "~> 2.8.1"
21
20
  spec.add_dependency "psych", "~> 5.1.0"
22
21
  spec.add_dependency "thor", "~> 1.2.1"
23
22
 
24
- spec.add_development_dependency "overcommit", "~> 0.60.0"
25
- spec.add_development_dependency "rspec", "~> 3.12.0"
26
- spec.add_development_dependency "rspec-retry", "~> 0.6.2"
27
- spec.add_development_dependency "rubocop", "~> 1.45.0"
28
- spec.add_development_dependency "rubocop-rake", "~> 0.6.0"
29
- spec.add_development_dependency "rubocop-rspec", "~> 2.18.1"
30
- spec.add_development_dependency "simplecov", "~> 0.22.0"
31
- spec.add_development_dependency "timecop", "~> 0.9.6"
32
- spec.add_development_dependency "webmock", "~> 3.18.1"
33
-
34
23
  spec.files = `git ls-files -z`.split("\x0").reject do |file|
35
24
  file.match(%r{^(coverage|pkg|spec|tmp)/})
36
25
  end
@@ -43,7 +43,7 @@ module Command
43
43
  VALIDATIONS = %w[config templates].freeze
44
44
 
45
45
  def call # rubocop:disable Metrics/MethodLength
46
- @template_parser = TemplateParser.new(config)
46
+ @template_parser = TemplateParser.new(self)
47
47
  @names_to_filenames = config.args.to_h do |name|
48
48
  [name, @template_parser.template_filename(name)]
49
49
  end
data/lib/command/base.rb CHANGED
@@ -405,7 +405,7 @@ module Command
405
405
  type: :string,
406
406
  required: required,
407
407
  default: VALIDATIONS_WITHOUT_ADDITIONAL_OPTIONS.join(","),
408
- valid_regex: /^(#{ALL_VALIDATIONS.join("|")})(,(#{ALL_VALIDATIONS.join("|")}))*$/
408
+ valid_regex: /^(#{ALL_VALIDATIONS.join('|')})(,(#{ALL_VALIDATIONS.join('|')}))*$/
409
409
  }
410
410
  }
411
411
  end
@@ -527,7 +527,7 @@ module Command
527
527
  progress.puts("Running #{title}...\n\n")
528
528
 
529
529
  begin
530
- Cpflow::Cli.start(["run", "-a", config.app, "--image", "latest", "--", command])
530
+ run_cpflow_command("run", "-a", config.app, "--image", "latest", "--", command)
531
531
  rescue SystemExit => e
532
532
  progress.puts
533
533
 
@@ -536,5 +536,19 @@ module Command
536
536
  progress.puts("Finished running #{title}.\n\n")
537
537
  end
538
538
  end
539
+
540
+ def run_cpflow_command(command, *args)
541
+ common_args = []
542
+
543
+ self.class.common_options.each do |option|
544
+ value = config.options[option[:name]]
545
+ next if value.nil?
546
+
547
+ name = "--#{option[:name].to_s.tr('_', '-')}"
548
+ common_args.push(name, value)
549
+ end
550
+
551
+ Cpflow::Cli.start([command, *common_args, *args])
552
+ end
539
553
  end
540
554
  end
@@ -38,7 +38,11 @@ module Command
38
38
  docker_args: config.args,
39
39
  build_args: build_args)
40
40
 
41
- progress.puts("\nPushed image to '/org/#{config.org}/image/#{image_name}'.\n\n")
41
+ push_path = "/org/#{config.org}/image/#{image_name}"
42
+
43
+ progress.puts("\nPushing image to '#{push_path}'...\n\n")
44
+ cp.image_push(image_url)
45
+ progress.puts("\nPushed image to '#{push_path}'.\n\n")
42
46
 
43
47
  step("Waiting for image to be available", retry_on_failure: true) do
44
48
  images = cp.query_images["items"]
@@ -73,7 +73,7 @@ module Command
73
73
  end
74
74
 
75
75
  def delete_app(app)
76
- Cpflow::Cli.start(["delete", "-a", app, "--yes"])
76
+ run_cpflow_command("delete", "-a", app, "--yes")
77
77
  end
78
78
  end
79
79
  end
@@ -35,7 +35,7 @@ module Command
35
35
  container_name = container["name"]
36
36
  step("Deploying image '#{image}' for workload '#{container_name}'") do
37
37
  cp.workload_set_image_ref(workload, container: container_name, image: image)
38
- deployed_endpoints[container_name] = workload_data.dig("status", "endpoint")
38
+ deployed_endpoints[container_name] = endpoint_for_workload(workload_data)
39
39
  end
40
40
  end
41
41
  end
@@ -48,6 +48,15 @@ module Command
48
48
 
49
49
  private
50
50
 
51
+ def endpoint_for_workload(workload_data)
52
+ endpoint = workload_data.dig("status", "endpoint")
53
+ Resolv.getaddress(endpoint.split("/").last)
54
+ endpoint
55
+ rescue Resolv::ResolvError
56
+ deployments = cp.fetch_workload_deployments(workload_data["name"])
57
+ deployments.dig("items", 0, "status", "endpoint")
58
+ end
59
+
51
60
  def run_release_script
52
61
  release_script = config[:release_script]
53
62
  run_command_in_latest_image(release_script, title: "release script")
@@ -29,7 +29,7 @@ module Command
29
29
  validations = config.options[:validations].split(",")
30
30
  ensure_required_options!(validations)
31
31
 
32
- doctor_service = DoctorService.new(config)
32
+ doctor_service = DoctorService.new(self)
33
33
  doctor_service.run_validations(validations)
34
34
  end
35
35
 
@@ -26,6 +26,7 @@ module Command
26
26
  ```
27
27
  EX
28
28
  WITH_INFO_HEADER = false
29
+ VALIDATIONS = [].freeze
29
30
 
30
31
  def call
31
32
  if controlplane_directory_exists?
data/lib/command/info.rb CHANGED
@@ -75,7 +75,7 @@ module Command
75
75
  if config.org
76
76
  result.push(config.org)
77
77
  else
78
- config.apps.each do |_, app_options|
78
+ config.apps.each_value do |app_options|
79
79
  org = app_org(app_options)
80
80
  result.push(org) if org && !result.include?(org)
81
81
  end
@@ -173,7 +173,7 @@ module Command
173
173
  puts "\nThere are no apps starting with some names. If you wish to create any, do so with " \
174
174
  "(replace 'whatever' with whatever suffix you want):"
175
175
 
176
- @missing_apps_starting_with.each do |app, _workloads|
176
+ @missing_apps_starting_with.each_key do |app|
177
177
  puts " - `cpflow setup-app -a #{app}-whatever`"
178
178
  end
179
179
  end
@@ -17,26 +17,14 @@ module Command
17
17
  DESC
18
18
  WITH_INFO_HEADER = false
19
19
 
20
- def call # rubocop:disable Metrics/MethodLength
21
- one_off_workload = config[:one_off_workload]
22
- maintenance_workload = config.current[:maintenance_workload] || "maintenance"
20
+ def call
21
+ puts maintenance_mode.enabled? ? "on" : "off"
22
+ end
23
23
 
24
- domain_data = if config.domain
25
- cp.fetch_domain(config.domain)
26
- else
27
- cp.find_domain_for([one_off_workload, maintenance_workload])
28
- end
29
- unless domain_data
30
- raise "Can't find domain. " \
31
- "Maintenance mode is only supported for domains that use path based routing mode " \
32
- "and have a route configured for the prefix '/' on either port 80 or 443."
33
- end
24
+ private
34
25
 
35
- if cp.domain_workload_matches?(domain_data, maintenance_workload)
36
- puts "on"
37
- else
38
- puts "off"
39
- end
26
+ def maintenance_mode
27
+ @maintenance_mode ||= MaintenanceMode.new(self)
40
28
  end
41
29
  end
42
30
  end