containerci 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.rubocop.yml +30 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +30 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/circle.yml +3 -0
- data/containerci.gemspec +25 -0
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json.lock +0 -0
- data/feature/feature_helper.rb +31 -0
- data/lib/containerci/version.rb +3 -0
- data/lib/containerci.rb +146 -0
- data/metrics/bigfiles_high_water_mark +1 -0
- data/metrics/cane_high_water_mark +1 -0
- data/metrics/flay_high_water_mark +1 -0
- data/metrics/flog_high_water_mark +1 -0
- data/metrics/punchlist_high_water_mark +1 -0
- data/metrics/rubocop_high_water_mark +1 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c1025350f5ade0b3f3633886d3b40ccc106e318b
|
4
|
+
data.tar.gz: eed3c83efed695dc720bc0f992fe93b43835a275
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aec05edaee588f68c76697744ff9b27e908d2dec5a1ccac6a67094903e4446a16c3182e1db21f3901f886ea1b06adb32886e98937d80696996b9a1e56d2e8175
|
7
|
+
data.tar.gz: dfcef96634ded8ea6ace7a9c85873b49303f060d51c39204d46e904d86c5190013ed35a07d56b7e2e479482cd50c8c6f15b63dc12504e61cb2a5e5415023b00d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# I like trailing commas in maps. They let me insert new elements and
|
2
|
+
# see them as one line in a diff, not two.
|
3
|
+
TrailingComma:
|
4
|
+
Enabled: false
|
5
|
+
|
6
|
+
# I use keyword arguments for a poor man's dependency injection to cut
|
7
|
+
# down on the magic in my tests.
|
8
|
+
ParameterLists:
|
9
|
+
CountKeywordArgs: false
|
10
|
+
|
11
|
+
# If i'm using one function name and returning the contents of an
|
12
|
+
# attribute, that's OK. The alternative would be this, which I find
|
13
|
+
# confusing and often not really what I mean:
|
14
|
+
#
|
15
|
+
# attr_reader :something_else
|
16
|
+
# alias_method :something, :something_else
|
17
|
+
TrivialAccessors:
|
18
|
+
ExactNameMatch: true
|
19
|
+
|
20
|
+
#
|
21
|
+
# Add 'XXX' to the standard list
|
22
|
+
#
|
23
|
+
Style/CommentAnnotation:
|
24
|
+
Keywords:
|
25
|
+
- TODO
|
26
|
+
- FIXME
|
27
|
+
- OPTIMIZE
|
28
|
+
- HACK
|
29
|
+
- REVIEW
|
30
|
+
- XXX
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract_type (0.0.7)
|
5
|
+
adamantium (0.2.0)
|
6
|
+
ice_nine (~> 0.11.0)
|
7
|
+
memoizable (~> 0.4.0)
|
8
|
+
ast (2.0.0)
|
9
|
+
astrolabe (1.3.0)
|
10
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
11
|
+
bigfiles (0.0.3)
|
12
|
+
cane (2.6.2)
|
13
|
+
parallel
|
14
|
+
concord (0.1.5)
|
15
|
+
adamantium (~> 0.2.0)
|
16
|
+
equalizer (~> 0.0.9)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
docile (1.1.5)
|
19
|
+
equalizer (0.0.11)
|
20
|
+
flay (2.6.1)
|
21
|
+
ruby_parser (~> 3.0)
|
22
|
+
sexp_processor (~> 4.0)
|
23
|
+
flog (4.3.2)
|
24
|
+
ruby_parser (~> 3.1, > 3.1.0)
|
25
|
+
sexp_processor (~> 4.4)
|
26
|
+
ice_nine (0.11.1)
|
27
|
+
json (1.8.3)
|
28
|
+
memoizable (0.4.2)
|
29
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
30
|
+
parallel (1.6.0)
|
31
|
+
parser (2.2.2.6)
|
32
|
+
ast (>= 1.1, < 3.0)
|
33
|
+
powerpack (0.1.1)
|
34
|
+
procto (0.0.2)
|
35
|
+
punchlist (1.0.0)
|
36
|
+
quality (8.1.1)
|
37
|
+
bigfiles
|
38
|
+
cane (>= 2.6)
|
39
|
+
flay (>= 2.4, != 2.6.0)
|
40
|
+
flog (>= 4.1.1)
|
41
|
+
json
|
42
|
+
punchlist
|
43
|
+
reek (>= 1.3.4)
|
44
|
+
rubocop
|
45
|
+
ruby_parser (>= 3.2.2, != 3.6.6)
|
46
|
+
rainbow (2.0.0)
|
47
|
+
rake (10.4.2)
|
48
|
+
reek (3.0.3)
|
49
|
+
parser (~> 2.2.2.5)
|
50
|
+
rainbow (~> 2.0)
|
51
|
+
unparser (~> 0.2.2)
|
52
|
+
rspec (3.3.0)
|
53
|
+
rspec-core (~> 3.3.0)
|
54
|
+
rspec-expectations (~> 3.3.0)
|
55
|
+
rspec-mocks (~> 3.3.0)
|
56
|
+
rspec-core (3.3.1)
|
57
|
+
rspec-support (~> 3.3.0)
|
58
|
+
rspec-expectations (3.3.0)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.3.0)
|
61
|
+
rspec-mocks (3.3.1)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.3.0)
|
64
|
+
rspec-support (3.3.0)
|
65
|
+
rubocop (0.32.1)
|
66
|
+
astrolabe (~> 1.3)
|
67
|
+
parser (>= 2.2.2.5, < 3.0)
|
68
|
+
powerpack (~> 0.1)
|
69
|
+
rainbow (>= 1.99.1, < 3.0)
|
70
|
+
ruby-progressbar (~> 1.4)
|
71
|
+
ruby-progressbar (1.7.5)
|
72
|
+
ruby_parser (3.7.0)
|
73
|
+
sexp_processor (~> 4.1)
|
74
|
+
sexp_processor (4.6.0)
|
75
|
+
simplecov (0.10.0)
|
76
|
+
docile (~> 1.1.0)
|
77
|
+
json (~> 1.8)
|
78
|
+
simplecov-html (~> 0.10.0)
|
79
|
+
simplecov-html (0.10.0)
|
80
|
+
thread_safe (0.3.5)
|
81
|
+
unparser (0.2.4)
|
82
|
+
abstract_type (~> 0.0.7)
|
83
|
+
adamantium (~> 0.2.0)
|
84
|
+
concord (~> 0.1.5)
|
85
|
+
diff-lcs (~> 1.2.5)
|
86
|
+
equalizer (~> 0.0.9)
|
87
|
+
parser (~> 2.2.2)
|
88
|
+
procto (~> 0.0.2)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
bundler
|
95
|
+
quality
|
96
|
+
rake
|
97
|
+
rspec (>= 3)
|
98
|
+
simplecov
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
1.10.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Vince Broz
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# ContainerCI
|
2
|
+
|
3
|
+
This is a toolkit for creating automated builds for Docker containers.
|
4
|
+
|
5
|
+
It currently supports a limited workflow for a container in CircleCI
|
6
|
+
(i.e., something I needed to do twice), but contributions are welcome!
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'container-ci'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install container-ci
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Add this line to your applicatoin's Rakefile:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'container-ci'
|
30
|
+
```
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
|
+
|
38
|
+
### To test quality
|
39
|
+
```rake localtest```
|
40
|
+
|
41
|
+
### To run tests alone
|
42
|
+
```rake feature```
|
43
|
+
```rake spec```
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/container-ci. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
48
|
+
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
53
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'quality/rake/task'
|
4
|
+
|
5
|
+
Quality::Rake::Task.new do |task|
|
6
|
+
task.skip_tools = ['reek']
|
7
|
+
task.output_dir = 'metrics'
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Run specs'
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
12
|
+
task.pattern = 'spec/**/*_spec.rb'
|
13
|
+
task.rspec_opts = '--format doc'
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Run features'
|
17
|
+
RSpec::Core::RakeTask.new(:feature) do |task|
|
18
|
+
task.pattern = 'feature/**/*_spec.rb'
|
19
|
+
task.rspec_opts = '--format doc'
|
20
|
+
end
|
21
|
+
|
22
|
+
task :clear_metrics do |_t|
|
23
|
+
ret =
|
24
|
+
system('git checkout coverage/.last_run.json metrics/*_high_water_mark')
|
25
|
+
fail unless ret
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Default: Run specs and check quality.'
|
29
|
+
task localtest: [:clear_metrics, :spec, :feature, :quality]
|
30
|
+
task default: [:localtest]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "containerci"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/circle.yml
ADDED
data/containerci.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'containerci/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "containerci"
|
8
|
+
spec.version = Containerci::VERSION
|
9
|
+
spec.authors = ["Vince Broz"]
|
10
|
+
spec.email = ["vince@broz.cc"]
|
11
|
+
|
12
|
+
spec.summary = 'Rakefile toolkit for creating automated builds for ' \
|
13
|
+
'Docker containers.'
|
14
|
+
spec.homepage = "https://github.com/apiology/containerci"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
# Add the bin directory, to allow testing of gem executables as if the gem is
|
4
|
+
# already installed.
|
5
|
+
root_dir = RSpec::Core::RubyProject.root
|
6
|
+
exec_dir = root_dir.join('bin')
|
7
|
+
ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR)
|
8
|
+
|
9
|
+
# Courtesy of:
|
10
|
+
# https://raw.github.com/cupakromer/tao-of-tdd/master/adder/spec/support/
|
11
|
+
# capture_exec.rb
|
12
|
+
def exec_io(*cmd)
|
13
|
+
cmd = cmd.flatten
|
14
|
+
out_err, _exit_code = Open3.capture2e(*cmd)
|
15
|
+
|
16
|
+
out_err
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.filter_run_excluding :wip
|
21
|
+
config.run_all_when_everything_filtered = true
|
22
|
+
config.order = 'random'
|
23
|
+
config.alias_it_should_behave_like_to :has_behavior
|
24
|
+
config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
|
25
|
+
end
|
26
|
+
|
27
|
+
def let_double(*doubles)
|
28
|
+
doubles.each do |double_sym|
|
29
|
+
let(double_sym) { double(double_sym.to_s) }
|
30
|
+
end
|
31
|
+
end
|
data/lib/containerci.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
require "containerci/version"
|
2
|
+
|
3
|
+
module ContainerCI
|
4
|
+
#
|
5
|
+
# Exports a github project into a container--set up so that CI systems
|
6
|
+
# can push this and pull the latest source.
|
7
|
+
#
|
8
|
+
class ExportGithubProjectIntoContainer < ::Rake::TaskLib
|
9
|
+
def initialize(dsl: ::Rake::Task)
|
10
|
+
@dsl = dsl
|
11
|
+
define
|
12
|
+
end
|
13
|
+
|
14
|
+
def os
|
15
|
+
os = `uname -s`.chomp
|
16
|
+
os.downcase
|
17
|
+
end
|
18
|
+
|
19
|
+
def docker_machine_url
|
20
|
+
'https://github.com/docker/machine/releases/download/v0.3.0/' \
|
21
|
+
"docker-machine_#{os}-amd64"
|
22
|
+
end
|
23
|
+
|
24
|
+
def current_version
|
25
|
+
`docker images | grep -v latest | grep ^#{USER}/#{PROJECT_NAME} | \
|
26
|
+
awk '{print $2}' | head -1`
|
27
|
+
end
|
28
|
+
|
29
|
+
def next_version
|
30
|
+
@next_version ||= `sh -c 'TZ=UTC date +%Y-%m-%d-%H%M'`.chomp
|
31
|
+
end
|
32
|
+
|
33
|
+
def define
|
34
|
+
# XXX: Document circleci.yml
|
35
|
+
@dsl.define_task(:update_github_project) do
|
36
|
+
puts "pulling #{GITHUB_PROJECT}..."
|
37
|
+
if Dir.exist? GITHUB_PROJECT
|
38
|
+
sh "cd #{GITHUB_PROJECT} && git pull origin tests_passed"
|
39
|
+
else
|
40
|
+
sh 'git clone https://$GITHUB_OAUTH:x-oauth-basic@' \
|
41
|
+
"github.com/#{USER}/#{GITHUB_PROJECT}.git"
|
42
|
+
end
|
43
|
+
sh "cd #{GITHUB_PROJECT} && git checkout tests_passed"
|
44
|
+
puts 'done'
|
45
|
+
end
|
46
|
+
|
47
|
+
@dsl.define_task(:restore_cache) do
|
48
|
+
puts 'Restoring from docker cache...'
|
49
|
+
sh "if [ -e ~/docker/#{PROJECT_NAME}.tar ]; " \
|
50
|
+
'then ' \
|
51
|
+
' echo "restoring from cache"; ' \
|
52
|
+
" docker load -i ~/docker/#{PROJECT_NAME}.tar;" \
|
53
|
+
'fi; '
|
54
|
+
puts 'done'
|
55
|
+
end
|
56
|
+
|
57
|
+
# XXX: Why do we have to pull all images here, just to figure out what
|
58
|
+
# the latest version is? Wish we could just pull latest.
|
59
|
+
|
60
|
+
@dsl.define_task(:raw_docker_pull) do
|
61
|
+
puts 'Pulling from dockerhub...'
|
62
|
+
sh 'false; ' \
|
63
|
+
'until [ $? -eq 0 ]; do ' \
|
64
|
+
"docker pull #{USER}/#{PROJECT_NAME}:latest < /dev/null; done"
|
65
|
+
puts 'done'
|
66
|
+
end
|
67
|
+
|
68
|
+
@dsl.define_task(:save_new_cache) do
|
69
|
+
sh "mkdir -p ~/docker; docker save #{USER}/#{PROJECT_NAME}:latest > " \
|
70
|
+
" ~/docker/#{PROJECT_NAME}.tar"
|
71
|
+
end
|
72
|
+
|
73
|
+
@dsl.define_task(:get_docker_machine) do
|
74
|
+
sh 'if [ ! -d ~/docker-machine ]; ' \
|
75
|
+
'then ' \
|
76
|
+
' mkdir -p ~/docker-machine; ' \
|
77
|
+
'fi'
|
78
|
+
sh 'if [ ! -f ~/docker-machine/docker-machine ]; ' \
|
79
|
+
'then ' \
|
80
|
+
" curl -L #{docker_machine_url} > " \
|
81
|
+
' ~/docker-machine/docker-machine; ' \
|
82
|
+
'fi'
|
83
|
+
sh 'if [ ! -x ~/docker-machine/docker-machine ]; ' \
|
84
|
+
'then ' \
|
85
|
+
' chmod +x ~/docker-machine/docker-machine; ' \
|
86
|
+
'fi'
|
87
|
+
end
|
88
|
+
|
89
|
+
@dsl.define_task(docker_pull:
|
90
|
+
[:restore_cache, :raw_docker_pull, :save_new_cache])
|
91
|
+
|
92
|
+
@dsl.define_task(dependencies:
|
93
|
+
[:update_github_project, :docker_pull, :get_docker_machine])
|
94
|
+
|
95
|
+
@dsl.define_task(:print_next_version) do
|
96
|
+
puts "next version is #{next_version}"
|
97
|
+
end
|
98
|
+
|
99
|
+
@dsl.define_task(:docker_build_next_version) do
|
100
|
+
sh "docker build -t #{USER}/#{PROJECT_NAME}:#{next_version} ."
|
101
|
+
end
|
102
|
+
|
103
|
+
@dsl.define_task(:docker_tag) do
|
104
|
+
sh "docker tag -f #{USER}/#{PROJECT_NAME}:#{next_version} " \
|
105
|
+
"#{USER}/#{PROJECT_NAME}:latest"
|
106
|
+
end
|
107
|
+
|
108
|
+
@dsl.define_task(build:
|
109
|
+
[:print_next_version,
|
110
|
+
:docker_build_next_version,
|
111
|
+
:docker_tag])
|
112
|
+
|
113
|
+
@dsl.define_task(test:
|
114
|
+
[:build,
|
115
|
+
# :start_container, :verify_listening_on_port, :stop_container
|
116
|
+
])
|
117
|
+
|
118
|
+
@dsl.define_task(:docker_push) do
|
119
|
+
sh "docker push #{USER}/#{PROJECT_NAME}"
|
120
|
+
sh "docker push #{USER}/#{PROJECT_NAME}:#{current_version}"
|
121
|
+
end
|
122
|
+
|
123
|
+
@dsl.define_task(:manual_deploy) do
|
124
|
+
sh "in-sinatra-vld-prod docker pull #{USER}/#{PROJECT_NAME}:latest"
|
125
|
+
sh 'in-sinatra-vld-prod docker ps'
|
126
|
+
sh 'in-sinatra-vld-prod docker kill `in-sinatra-vld-prod docker ps -l -q`'
|
127
|
+
sh 'in-sinatra-vld-prod docker run -d -P -p 0.0.0.0:4567:4567 ' \
|
128
|
+
"-v /root/private:/root/private #{USER}/#{PROJECT_NAME}"
|
129
|
+
sh 'in-sinatra-vld-prod docker ' \
|
130
|
+
'exec -it `in-sinatra-vld-prod docker ps -l -q` /bin/dropbox ' \
|
131
|
+
'status'
|
132
|
+
puts "After connected, hit Control-C and run 'rake wait_for_dropbox'"
|
133
|
+
sh 'in-sinatra-vld-prod docker exec -it ' \
|
134
|
+
'`in-sinatra-vld-prod docker ps -l -q` ' \
|
135
|
+
'tail -f /var/log/dropbox/dropbox.log'
|
136
|
+
end
|
137
|
+
|
138
|
+
@dsl.define_task(after_test_success:
|
139
|
+
[:docker_push,
|
140
|
+
#:deploy_to_prod
|
141
|
+
])
|
142
|
+
end
|
143
|
+
# XXX: As configured in CircleCI, this runs regardless of whether test passed
|
144
|
+
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
81
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
@@ -0,0 +1 @@
|
|
1
|
+
0
|
@@ -0,0 +1 @@
|
|
1
|
+
4
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: containerci
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vince Broz
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- vince@broz.cc
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".ruby-version"
|
66
|
+
- ".travis.yml"
|
67
|
+
- CODE_OF_CONDUCT.md
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- bin/console
|
74
|
+
- bin/setup
|
75
|
+
- circle.yml
|
76
|
+
- containerci.gemspec
|
77
|
+
- coverage/.last_run.json
|
78
|
+
- coverage/.resultset.json.lock
|
79
|
+
- feature/feature_helper.rb
|
80
|
+
- lib/containerci.rb
|
81
|
+
- lib/containerci/version.rb
|
82
|
+
- metrics/bigfiles_high_water_mark
|
83
|
+
- metrics/cane_high_water_mark
|
84
|
+
- metrics/flay_high_water_mark
|
85
|
+
- metrics/flog_high_water_mark
|
86
|
+
- metrics/punchlist_high_water_mark
|
87
|
+
- metrics/rubocop_high_water_mark
|
88
|
+
homepage: https://github.com/apiology/containerci
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.4.6
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Rakefile toolkit for creating automated builds for Docker containers.
|
112
|
+
test_files: []
|