geordi 3.0.3 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b149c149a52f1e02ca3573aa238d31d5a1fb9a018f2bdea2a19498d75282650e
4
- data.tar.gz: 5bd2b8ddf0190307b93fab2081434fe05a7207c3b5105ec566eeb211d82532d0
3
+ metadata.gz: 3f2ea989e784592d99136278e2e7aeca1329d56460590dd0de0c713839d007f4
4
+ data.tar.gz: c3c001d594fa572a4c562cb91c8796ca1f1170fbfb0168be4f5ec2efaac87556
5
5
  SHA512:
6
- metadata.gz: 6a607dcb1475b70f9053c4fe950f8ee6fa2d657b0c6771b514c3356ac28c8f2704be396cfc2f19b8990edd3dc67dfdc7dad1a92344947c23fa30e72cf7a4564c
7
- data.tar.gz: d499c7936be74a6eb30f14287b0af2fd44dd89e6bc2dd4db772e6b7a0450f8013df200604027a95fd4808a32f3b860760876e40e0af5b7d9427c1c3cb8646e6f
6
+ metadata.gz: c516cd2e6716be0c8e487b5aea0ff741e8d4f99660ee1f9bc2c2277abe275f5b07a31ecd79392cb94c3b804c6357391077d27acd36d8511a1b9dd510baa88e49
7
+ data.tar.gz: be170bc924f84b7ea056a394348cef9aa24b4b89c2696ef4a400713ca03dad509e446c048217a5626390a459eafaaa52b63212d5990f6898b644acc120fb28c3
@@ -11,6 +11,15 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
11
11
  ### Breaking changes
12
12
 
13
13
 
14
+ ## 3.1.0 2020-06-03
15
+
16
+ ### Compatible changes
17
+
18
+ - Update security-update for improved workflow (#89): Deploy staging first and ask user, if application is still running. Then deploy other stages.
19
+
20
+ ### Breaking changes
21
+
22
+
14
23
  ## 3.0.3 2020-05-27
15
24
 
16
25
  ### Compatible changes
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (3.0.3)
4
+ geordi (3.1.0)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -54,6 +54,11 @@ Commit using a story title from Pivotal Tracker.
54
54
 
55
55
  Example: `geordi commit`
56
56
 
57
+ Any extra arguments are forwarded to `git commit -m <message>`.
58
+
59
+ If there are no staged changes, prints a warning but will continue to create
60
+ an empty commit.
61
+
57
62
  On the first execution we ask for your Pivotal Tracker API token. It will be
58
63
  stored in `~/.gitpt`.
59
64
 
@@ -255,10 +260,30 @@ Support for performing security updates.
255
260
 
256
261
  Preparation for security update: `geordi security-update`
257
262
 
263
+ Checks out production and pulls.
264
+
258
265
  After performing the update: `geordi security-update finish`
259
266
 
260
267
  Switches branches, pulls, pushes and deploys as required by our workflow. Tells
261
- what it will do before it does it.
268
+ what it will do before it does it. In detail:
269
+
270
+ 1. Asks user, if tests are green
271
+
272
+ 2. Pushes production
273
+
274
+ 3. Checks out master and pulls
275
+
276
+ 4. Merges production and pushes in master
277
+
278
+ 5. Deploys staging first, if there is a staging environment
279
+
280
+ 6. Asks user, if deployment log is okay and application is still running on staging
281
+
282
+ 7. Deploys other stages
283
+
284
+ 8. Asks user, if deployment log is okay and application is still running on all other stages
285
+
286
+ 9. Informs user about the next steps
262
287
 
263
288
 
264
289
  ### `geordi server [PORT]`
@@ -2,10 +2,30 @@ desc 'security-update [STEP]', 'Support for performing security updates'
2
2
  long_desc <<-LONGDESC
3
3
  Preparation for security update: `geordi security-update`
4
4
 
5
+ Checks out production and pulls.
6
+
5
7
  After performing the update: `geordi security-update finish`
6
8
 
7
9
  Switches branches, pulls, pushes and deploys as required by our workflow. Tells
8
- what it will do before it does it.
10
+ what it will do before it does it. In detail:
11
+
12
+ 1. Asks user, if tests are green
13
+
14
+ 2. Pushes production
15
+
16
+ 3. Checks out master and pulls
17
+
18
+ 4. Merges production and pushes in master
19
+
20
+ 5. Deploys staging first, if there is a staging environment
21
+
22
+ 6. Asks user, if deployment log is okay and application is still running on staging
23
+
24
+ 7. Deploys other stages
25
+
26
+ 8. Asks user, if deployment log is okay and application is still running on all other stages
27
+
28
+ 9. Informs user about the next steps
9
29
  LONGDESC
10
30
 
11
31
  def security_update(step = 'prepare')
@@ -13,7 +33,7 @@ def security_update(step = 'prepare')
13
33
  when 'prepare'
14
34
  Interaction.announce 'Preparing for security update'
15
35
  Interaction.warn 'Please read https://makandracards.com/makandra/1587 before applying security updates!'
16
- Interaction.note 'About to checkout production and pull'
36
+ Interaction.note 'About to checkout production and pull.'
17
37
  Interaction.prompt('Continue?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
18
38
 
19
39
  Util.system! 'git checkout production', show_cmd: true
@@ -27,13 +47,17 @@ def security_update(step = 'prepare')
27
47
 
28
48
  when 'f', 'finish'
29
49
  # ensure everything is committed
30
- `git status --porcelain`.empty? || Interaction.fail('Please commit your changes before finishing the update.')
50
+ if Util.testing?
51
+ puts 'Util.system! git status --porcelain'
52
+ else
53
+ `git status --porcelain`.empty? || Interaction.fail('Please commit your changes before finishing the update.')
54
+ end
31
55
 
32
56
  Interaction.announce 'Finishing security update'
33
57
  Interaction.note 'Working directory clean.'
34
58
  Interaction.prompt('Have you successfully run all tests?', 'n', /y|yes/) || Interaction.fail('Please run tests first.')
35
59
 
36
- Interaction.note 'About to: push production, checkout & pull master, merge production, push master'
60
+ Interaction.note 'About to: push production, checkout & pull master, merge production, push master.'
37
61
  Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
38
62
 
39
63
  Util.system! 'git push', show_cmd: true
@@ -42,9 +66,42 @@ def security_update(step = 'prepare')
42
66
  Util.system! 'git merge production', show_cmd: true
43
67
  Util.system! 'git push', show_cmd: true
44
68
 
45
- Interaction.announce 'Deploying all targets'
69
+ Interaction.announce 'Deployment'
46
70
  deploy = (Util.gem_major_version('capistrano') == 3) ? 'deploy' : 'deploy:migrations'
47
- invoke_cmd 'capistrano', deploy
71
+
72
+ all_deploy_targets = Util.deploy_targets
73
+ Interaction.fail 'There are no deploy targets!' if all_deploy_targets.empty?
74
+
75
+ if all_deploy_targets.include?('staging')
76
+ Interaction.note 'There is a staging environment.'
77
+ Interaction.prompt('Deploy staging now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
78
+
79
+ Interaction.announce 'Deploy staging'
80
+ Util.system! "bundle exec cap staging #{deploy}", show_cmd: true
81
+
82
+ Interaction.prompt('Is the deployment log okay and the application is still running on staging?', 'y', /y|yes/) || Interaction.fail('Please fix the deployment issues on staging before you continue.')
83
+ else
84
+ Interaction.note 'There is no staging environment.'
85
+ end
86
+
87
+ deploy_targets_without_staging = all_deploy_targets.select { |target| target != 'staging' }
88
+
89
+ if deploy_targets_without_staging.empty?
90
+ Interaction.note 'There are no other stages.'
91
+ else
92
+ puts
93
+ Interaction.note 'Found the following other stages:'
94
+ puts deploy_targets_without_staging
95
+ puts
96
+ Interaction.prompt('Deploy other stages now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
97
+
98
+ deploy_targets_without_staging.each do |target|
99
+ Interaction.announce "Deploy #{target}"
100
+ Util.system! "bundle exec cap #{target} #{deploy}", show_cmd: true
101
+ end
102
+
103
+ Interaction.prompt('Is the application still running on all other stages and the logs are okay?', 'y', /y|yes/) || Interaction.fail('Please fix the application immediately!')
104
+ end
48
105
 
49
106
  Interaction.success 'Successfully pushed and deployed security update'
50
107
  puts
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '3.0.3'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-27 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.1.3
147
+ rubygems_version: 3.1.4
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Collection of command line tools we use in our daily work with Ruby, Rails