capistrano-ec2-selfdeploy-tag 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capistrano/ec2/selfdeploy/tag.rb +47 -0
- metadata +83 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
|
3
|
+
namespace :ec2 do
|
4
|
+
namespace :selfdeploy do
|
5
|
+
namespace :tag do
|
6
|
+
desc "Replace a specific Git tag with whatever just got deployed for use with EC2 self deploy."
|
7
|
+
|
8
|
+
task :update_tag do
|
9
|
+
update_tag = fetch(:update_selfdeploy_tag) rescue true
|
10
|
+
tag_name = fetch(:selfdeploy_tag) rescue "inproduction"
|
11
|
+
|
12
|
+
if update_tag
|
13
|
+
puts "Recreating Git selfdeploy tag '#{tag_name}'..."
|
14
|
+
|
15
|
+
user = `git config --get user.name`
|
16
|
+
email = `git config --get user.email`
|
17
|
+
|
18
|
+
puts `git tag -d #{tag_name}`
|
19
|
+
puts `git push origin :#{tag_name}`
|
20
|
+
puts `git tag #{tag_name} #{revision} -m "Selfdeploy tag recreated by #{user} <#{email}>"`
|
21
|
+
puts `git push --tags`
|
22
|
+
else
|
23
|
+
puts "This is a self deployment task - not recreating selfdeploy tag..."
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace :deploy do
|
32
|
+
after "deploy", "ec2:selfdeploy:tag:update_tag"
|
33
|
+
end
|
34
|
+
|
35
|
+
task :ec2_instance do
|
36
|
+
# The EC2 autoscale self deploy tool calls 'bundle exec cap ec2_instance deploy' to trigger this.
|
37
|
+
# We set 'update_selfdeploy_tag' to false so the selfdeploy_tag isn't altered during autoscaling.
|
38
|
+
# We also override the branch to deploy from to be the selfdeploy_tag.
|
39
|
+
|
40
|
+
set :deploy_via, :export # Git + capistrano don't like switching to a tag from master
|
41
|
+
set :update_selfdeploy_tag, false
|
42
|
+
|
43
|
+
tag_name = fetch(:selfdeploy_tag) rescue "inproduction"
|
44
|
+
set :branch, tag_name
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-ec2-selfdeploy-tag
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Conway
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-22 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: capistrano
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Recreates a specified Git tag every time you deploy, with whatever codebase just got pushed live. This tag is used alongside another system, to deploy the latest production code to a newly autoscaled instance.
|
38
|
+
email:
|
39
|
+
- ryan.conway@forward.co.uk
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- lib/capistrano/ec2/selfdeploy/tag.rb
|
48
|
+
has_rdoc: true
|
49
|
+
homepage: http://github.com/forward/capistrano-ec2-selfdeploy-tag
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project: capistrano-ec2-selfdeploy-tag
|
78
|
+
rubygems_version: 1.3.7
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Recreates a specified Git tag every time you deploy, with whatever codebase just got pushed live. This tag is used alongside another system, to deploy the latest production code to a newly autoscaled instance.
|
82
|
+
test_files: []
|
83
|
+
|