fidoci 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/d +5 -2
- data/lib/fidoci/env.rb +15 -3
- data/lib/fidoci/main.rb +4 -4
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2ce994dd006c83361b2e4e94b8d52f81bed0acd
|
4
|
+
data.tar.gz: 24ea65effdf2450f8ae6fac3354b373349fc6092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb37b879aaed5e513207013e7faaba1b47e68ce12d578fbf92422e5bbb5687d8c65fbfe45b61528cee4edaf5f2bd23af74fb6ff288756efaa3e2b3b039e77ebb
|
7
|
+
data.tar.gz: c08b5bb1f14e0f829dfb3241224090f50badcf88daab133af6199e5dbb4fe28b00a383cfcad8f590343ee1e9e524f2dfacfb6a1027247580107f70e06b74b527
|
data/bin/d
CHANGED
@@ -31,10 +31,13 @@ when '--clean'
|
|
31
31
|
# clean service and intermediate docker images
|
32
32
|
environment.clean
|
33
33
|
when '--build'
|
34
|
-
# d --build success-tag build-id
|
34
|
+
# d --build success-tag build-id [registry]
|
35
35
|
# build image, test it and if successful, tag as latest-staging
|
36
36
|
# if --clean is present, will clean all intermediate docker images after
|
37
|
-
|
37
|
+
registry = ''
|
38
|
+
registry = ARGV.drop(1)[2] + "/" if ARGV.drop(1).size >= 3
|
39
|
+
puts "Using registry: #{registry}"
|
40
|
+
if environment.build(ARGV.drop(1)[0], ARGV.drop(1)[1], registry)
|
38
41
|
exit 0
|
39
42
|
else
|
40
43
|
exit 1
|
data/lib/fidoci/env.rb
CHANGED
@@ -78,12 +78,24 @@ module Fidoci
|
|
78
78
|
repo_tag = "#{@image}:#{tag}"
|
79
79
|
image = Docker::Image.get(repo_tag)
|
80
80
|
|
81
|
-
|
81
|
+
if ENV['DOCKER_AUTH_FILE']
|
82
|
+
# load file
|
83
|
+
auth_file = JSON.parse(File.read ENV['DOCKER_AUTH_FILE'])
|
84
|
+
image_parts = @image.split('/')
|
85
|
+
registry = image_parts.size == 2 ? "https://#{image_parts[0]}" : "https://index.docker.io/v1/"
|
86
|
+
creds = auth_file['auths'][registry]
|
87
|
+
if creds['auth']
|
88
|
+
creds['username'], creds['password'] = Base64.decode64(creds['auth']).split(':', 2)
|
89
|
+
creds.delete 'auth'
|
90
|
+
end
|
91
|
+
else
|
92
|
+
creds = {
|
82
93
|
'username' => ENV['DOCKER_REGISTRY_USERNAME'],
|
83
94
|
'password' => ENV['DOCKER_REGISTRY_PASSWORD'],
|
84
95
|
'email' => ENV['DOCKER_REGISTRY_EMAIL']
|
85
|
-
|
86
|
-
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
87
99
|
info "Pushing #{repo_tag}..."
|
88
100
|
image.push(creds, 'repo_tag' => repo_tag) do |msg|
|
89
101
|
json = JSON.parse(msg)
|
data/lib/fidoci/main.rb
CHANGED
@@ -40,8 +40,8 @@ module Fidoci
|
|
40
40
|
# Create environment instance with given name
|
41
41
|
# name - key that will be used to configure this env
|
42
42
|
# id - unique identifier of env that will be used to tag containers and images
|
43
|
-
def env(name, id)
|
44
|
-
Env.new(repository_name, id.to_s, config[name.to_s])
|
43
|
+
def env(name, id, registry = '')
|
44
|
+
Env.new(registry + repository_name, id.to_s, config[name.to_s])
|
45
45
|
end
|
46
46
|
|
47
47
|
# Clean system
|
@@ -57,10 +57,10 @@ module Fidoci
|
|
57
57
|
# Build image and run test in it
|
58
58
|
# tag - tag name to tag image after successful build and test
|
59
59
|
# build_id - unique build_id to be used to identify docker images and containers
|
60
|
-
def build(tag, build_id)
|
60
|
+
def build(tag, build_id, registry = '')
|
61
61
|
build_id = SecureRandom.hex(10) unless build_id
|
62
62
|
|
63
|
-
test_env = env(:build, build_id)
|
63
|
+
test_env = env(:build, build_id, registry)
|
64
64
|
test_env.clean!
|
65
65
|
|
66
66
|
success = test_env.commands
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fidoci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Dolezal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -56,9 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.5.1
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: Finally Docker CI
|
63
63
|
test_files: []
|
64
|
-
has_rdoc:
|