kuby-core 0.6.1 → 0.7.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/kuby/docker/cli.rb +32 -0
- data/lib/kuby/docker/errors.rb +1 -0
- data/lib/kuby/docker/metadata.rb +4 -0
- data/lib/kuby/docker/timestamp_tag.rb +1 -1
- data/lib/kuby/tasks.rb +19 -0
- data/lib/kuby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d3f784993d379920477923911af9c73a7ac0f661a8831a3fdc21feea83e9d89
|
4
|
+
data.tar.gz: 97390f124219ba7e697253c551bbef2527b15d7234793a76431ebdde73e996ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95fceaebbb3959fb3b872b570b9202deb4dfd4a44dc363c25b20398f9e2a199091eb5fdecbeb07caceb2be104b94c07f3294e8b8158737416e2b83efe7e65ebe
|
7
|
+
data.tar.gz: 248b60b0c0ab90d10c780ce69e3f63ff6aa4b222cef82c5121abf2acb4b462c6534b245556a2683649ccf57440e758d5846e93322828f127c66784701ea11127
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.7.0
|
2
|
+
* Automatically perform `docker login` if not already logged into the Docker registry.
|
3
|
+
* Fix timestamp tag parsing issue causing deploy to fail with no available tags.
|
4
|
+
- Issue turned out to be ignoring the month of October in the validation regex.
|
5
|
+
|
1
6
|
## 0.6.1
|
2
7
|
* Fix issue causing database.yml to not be rewritten to point at correct database host.
|
3
8
|
|
data/lib/kuby/docker/cli.rb
CHANGED
@@ -10,6 +10,38 @@ module Kuby
|
|
10
10
|
@executable = executable || `which docker`.strip
|
11
11
|
end
|
12
12
|
|
13
|
+
def config_file
|
14
|
+
if File.exist?(default_config_file)
|
15
|
+
default_config_file
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_config_file
|
20
|
+
File.join(Dir.home, '.docker', 'config.json')
|
21
|
+
end
|
22
|
+
|
23
|
+
def login(url:, username:, password:)
|
24
|
+
cmd = [
|
25
|
+
executable, 'login', url, '--username', username, '--password-stdin'
|
26
|
+
]
|
27
|
+
|
28
|
+
open3_w({}, cmd) do |stdin, _wait_threads|
|
29
|
+
stdin.puts(password)
|
30
|
+
end
|
31
|
+
|
32
|
+
unless last_status.success?
|
33
|
+
raise LoginError, 'build failed: docker command exited with '\
|
34
|
+
"status code #{last_status.exitstatus}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def auths
|
39
|
+
return [] unless config_file
|
40
|
+
|
41
|
+
config = JSON.parse(File.read(config_file))
|
42
|
+
config.fetch('auths', {}).keys
|
43
|
+
end
|
44
|
+
|
13
45
|
def build(dockerfile:, image_url:, tags:)
|
14
46
|
cmd = [
|
15
47
|
executable, 'build',
|
data/lib/kuby/docker/errors.rb
CHANGED
data/lib/kuby/docker/metadata.rb
CHANGED
data/lib/kuby/tasks.rb
CHANGED
@@ -39,6 +39,24 @@ module Kuby
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def push
|
42
|
+
hostname = docker.metadata.image_hostname
|
43
|
+
|
44
|
+
unless docker.cli.auths.include?(hostname)
|
45
|
+
Kuby.logger.info("Attempting to log in to registry at #{hostname}")
|
46
|
+
|
47
|
+
begin
|
48
|
+
docker.cli.login(
|
49
|
+
url: docker.metadata.image_host,
|
50
|
+
username: docker.credentials.username,
|
51
|
+
password: docker.credentials.password
|
52
|
+
)
|
53
|
+
rescue Kuby::Docker::LoginError => e
|
54
|
+
Kuby.logger.fatal("Couldn't log in to the registry at #{hostname}")
|
55
|
+
Kuby.logger.fatal(e.message)
|
56
|
+
return
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
42
60
|
image_url = docker.metadata.image_url
|
43
61
|
|
44
62
|
begin
|
@@ -50,6 +68,7 @@ module Kuby
|
|
50
68
|
'Docker image before running this task.'
|
51
69
|
|
52
70
|
Kuby.logger.fatal(msg)
|
71
|
+
Kuby.logger.fatal(e.message)
|
53
72
|
end
|
54
73
|
end
|
55
74
|
|
data/lib/kuby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|