Sha256: 1533b5ee09b730c98e04dcaf247263dc6fb2c41f03b341412ad590b8e206192e

Contents?: true

Size: 1.95 KB

Versions: 30

Compression:

Stored size: 1.95 KB

Contents

desc 'security-update [STEP]', 'Support for performing security updates'
long_desc <<-LONGDESC
Preparation for security update: `geordi security-update`

After performing the update: `geordi security-update finish`

Switches branches, pulls, pushes and deploys as required by our workflow. Tells
what it will do before it does it.
LONGDESC

def security_update(step='prepare')
  case step
  when 'prepare'
    announce 'Preparing for security update'
    warn 'Please read https://makandracards.com/makandra/1587 before applying security updates!'
    note 'About to checkout production and pull'
    prompt('Continue?', 'y', /y|yes/) or fail 'Cancelled.'

    Util.system! 'git checkout production', :show_cmd => true
    Util.system! 'git pull', :show_cmd => true

    success 'Successfully prepared for security update'
    puts
    note 'Please apply the security update now.'
    note 'When you are done, run `geordi security-update finish`.'


  when 'finish'
    announce 'Finishing security update'

    # ensure everything is committed
    `git status --porcelain`.empty? or fail('There are uncommitted changes.')
    note 'Working directory clean.'

    prompt('Have you successfully run all tests?', 'n', /y|yes/) or fail 'Please run tests first.'

    note 'About to: push production, checkout & pull master, merge production, push master, deploy all stages'
    prompt('Continue?', 'n', /y|yes/) or fail 'Cancelled.'

    Util.system! 'git push', :show_cmd => true
    Util.system! 'git checkout master', :show_cmd => true
    Util.system! 'git pull', :show_cmd => true
    Util.system! 'git merge production', :show_cmd => true
    Util.system! 'git push', :show_cmd => true

    invoke_cmd 'capistrano', 'deploy:migrations'

    success 'Successfully pushed and deployed security update'
    puts
    note 'Now send an email to customer and project lead, informing them about the update.'
    note 'Do not forget to make a joblog on a security budget, if available.'
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
geordi-1.9.0 lib/geordi/commands/security_update.rb
geordi-1.8.0 lib/geordi/commands/security_update.rb
geordi-1.7.1 lib/geordi/commands/security_update.rb
geordi-1.7.0 lib/geordi/commands/security_update.rb
geordi-1.6.5 lib/geordi/commands/security_update.rb
geordi-1.6.4 lib/geordi/commands/security_update.rb
geordi-1.6.3 lib/geordi/commands/security_update.rb
geordi-1.6.2 lib/geordi/commands/security_update.rb
geordi-1.6.1 lib/geordi/commands/security_update.rb
geordi-1.6.0 lib/geordi/commands/security_update.rb
geordi-1.5.2 lib/geordi/commands/security_update.rb
geordi-1.5.1 lib/geordi/commands/security_update.rb
geordi-1.5.0 lib/geordi/commands/security_update.rb
geordi-1.4.3 lib/geordi/commands/security_update.rb
geordi-1.4.2 lib/geordi/commands/security_update.rb
geordi-1.4.1 lib/geordi/commands/security_update.rb
geordi-1.4.0 lib/geordi/commands/security_update.rb
geordi-1.3.2 lib/geordi/commands/security_update.rb
geordi-1.3.1 lib/geordi/commands/security_update.rb
geordi-1.3.0 lib/geordi/commands/security_update.rb