minos 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3e9853e5a1c81483e6f0e946d8e670d1dc947ba9f1d17d045a32c9af2d121c3
4
- data.tar.gz: 62b4000e486b49a2fa3002d40b4921926e89ad891e9483c5451ef0fe18a3725a
3
+ metadata.gz: 6e990511ea43438c9374a1205d0a15417da89a57ed4c57c190e1bfa36b72946d
4
+ data.tar.gz: 1e7d4a3d6acbcbac2eab3705eb197fa9712e6bda4fe44f8c627801498483846f
5
5
  SHA512:
6
- metadata.gz: 8358d1a238ed0510a5a5d85bd1341d736e9c41a099eb87ced95d8c2db44d3cf555474a2fc9e9ba8ac4233a2022cbfffd04dd867cd227b574fb61f4a4487c0367
7
- data.tar.gz: b01639fef57b52f125f5157d1225556aba660a80c0d195c6d5f43bd9c37595a019333ce579e9166a75be74d9f013eaa6fc9d925ba399fd95819e52666e74069d
6
+ metadata.gz: 4e810c0cef87e648d29673b417461cf2e8b1a4dd4481372baa00eeccfafdc2fe63824b4b7165158f49d013bf8acfec6d70897626b3e8607fd8dc7068131337d1
7
+ data.tar.gz: 4561bf59c5110afd9e6f87ac21d0b16e481a5d6a334ca68d14c02f12b70d49ad7895813f5d24d19d2283929264acb1d3e6b18749bced538c05e5f8dc46a9e5c2
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minos (0.2.0)
4
+ minos (0.2.1)
5
5
  activesupport (~> 5.2)
6
6
  thor (~> 0.20)
7
+ wisper (~> 2.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -14,7 +15,7 @@ GEM
14
15
  minitest (~> 5.1)
15
16
  tzinfo (~> 1.1)
16
17
  concurrent-ruby (1.1.4)
17
- i18n (1.5.2)
18
+ i18n (1.5.3)
18
19
  concurrent-ruby (~> 1.0)
19
20
  minitest (5.11.3)
20
21
  rake (10.5.0)
@@ -22,6 +23,7 @@ GEM
22
23
  thread_safe (0.3.6)
23
24
  tzinfo (1.2.5)
24
25
  thread_safe (~> 0.1)
26
+ wisper (2.0.0)
25
27
 
26
28
  PLATFORMS
27
29
  ruby
@@ -0,0 +1,26 @@
1
+ ######################
2
+ # Stage: builder
3
+ FROM busybox as builder
4
+
5
+ ENV HOME /home/app
6
+ WORKDIR $HOME
7
+
8
+ RUN touch builder
9
+
10
+ CMD ["ls", "-l"]
11
+
12
+ ###############################
13
+ # Stage release
14
+ FROM busybox as release
15
+
16
+ ENV HOME /home/app
17
+ WORKDIR $HOME
18
+
19
+ RUN touch release
20
+
21
+ CMD ["ls", "-l"]
22
+
23
+ ARG ENV=production
24
+ ARG REVISION
25
+
26
+ ENV REVISION $REVISION
@@ -0,0 +1,32 @@
1
+ build:
2
+ artifacts:
3
+ - name: builder
4
+ image: textmasterapps/busybox
5
+ tags:
6
+ - "$TARGET-$REVISION"
7
+ - "$TARGET-latest"
8
+ docker:
9
+ file: ./examples/Dockerfile
10
+ tag: "$IMAGE:$TARGET" # $IMAGE and $TARGET are automatically populated as env vars for you
11
+ target: builder
12
+ cacheFrom:
13
+ - textmasterapps/busybox:builder
14
+ - textmasterapps/busybox:builder-$REVISION
15
+ - textmasterapps/busybox:builder-latest
16
+ - name: release
17
+ image: textmasterapps/busybox
18
+ tags:
19
+ - "$REVISION" # you can reference ENV variables from your shell
20
+ - "latest"
21
+ docker:
22
+ file: ./examples/Dockerfile
23
+ tag: "$IMAGE:$TARGET"
24
+ target: release
25
+ buildArg:
26
+ ENV: "production"
27
+ REVISION: "$REVISION"
28
+ cacheFrom:
29
+ - textmasterapps/busybox:builder
30
+ - textmasterapps/busybox:release
31
+ - textmasterapps/busybox:$REVISION
32
+ - textmasterapps/busybox:latest
@@ -2,6 +2,8 @@ require 'active_support/core_ext/string/inflections'
2
2
 
3
3
  module Minos
4
4
  class Artifact
5
+ include Wisper::Publisher
6
+
5
7
  attr_reader :artifact, :options
6
8
 
7
9
  def initialize(artifact, options: {})
@@ -9,9 +11,13 @@ module Minos
9
11
  @options = options
10
12
  end
11
13
 
14
+ def name
15
+ artifact['name']
16
+ end
17
+
12
18
  def pull
13
- caches.each do |cache|
14
- docker_pull(cache)
19
+ caches.each do |name|
20
+ docker_pull(name)
15
21
  end
16
22
  end
17
23
 
@@ -25,17 +31,22 @@ module Minos
25
31
 
26
32
  private
27
33
 
28
- def docker_pull(cache)
29
- run "docker inspect #{cache} -f '{{json .ID}}' > /dev/null 2>&1 || docker pull #{cache} 2> /dev/null"
34
+ def docker_pull(name)
35
+ broadcast(:pulling_cache_artifact, name)
36
+ run "docker inspect #{name} -f '{{json .ID}}' > /dev/null 2>&1 || docker pull #{name} 2> /dev/null"
30
37
  end
31
38
 
32
39
  def docker_build
40
+ broadcast(:building_artifact, name)
33
41
  run "docker build #{to_args(docker)} ."
42
+ broadcast(:artifact_built, name)
34
43
  end
35
44
 
36
45
  def docker_push
37
46
  tags.each do |tag|
47
+ broadcast(:tagging_artifact, "#{image}:#{target}", "#{image}:#{tag}")
38
48
  run "docker tag #{image}:#{target} #{image}:#{tag}"
49
+ broadcast(:pushing_artifact, "#{image}:#{tag}")
39
50
  run "docker push #{image}:#{tag}"
40
51
  end
41
52
  end
data/lib/minos/cli.rb CHANGED
@@ -18,5 +18,10 @@ module Minos
18
18
  def deploy
19
19
  invoke 'minos:k8s:deploy', []
20
20
  end
21
+
22
+ desc "version", "Display Minos version"
23
+ def version
24
+ puts Minos::VERSION
25
+ end
21
26
  end
22
27
  end
data/lib/minos/docker.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module Minos
2
2
  class Docker < Thor
3
+ include Thor::Shell
4
+
3
5
  class_option :manifest, default: "./minos.yaml", desc: "Manifest config file describing docker artifacts"
4
6
  class_option :only, type: :array, default: [], desc: "Process only given artifacts"
5
7
  class_option :except, type: :array, default: [], desc: "Process all but given artifacts"
@@ -8,6 +10,17 @@ module Minos
8
10
  def build
9
11
  artifacts.each do |a|
10
12
  artifact = Artifact.new(a, options: options)
13
+ artifact
14
+ .on(:pulling_cache_artifact) do |name|
15
+ say_status artifact.name, "Pulling #{name}"
16
+ end
17
+ .on(:building_artifact) do |name|
18
+ say_status artifact.name, "Building #{name}"
19
+ end
20
+ .on(:artifact_built) do |name|
21
+ say_status artifact.name, "Successfully built #{name}"
22
+ end
23
+
11
24
  artifact.pull
12
25
  artifact.build
13
26
  end
@@ -17,6 +30,14 @@ module Minos
17
30
  def push
18
31
  artifacts.each do |a|
19
32
  artifact = Artifact.new(a, options: options)
33
+ artifact
34
+ .on(:tagging_artifact) do |source, target|
35
+ say_status artifact.name, "Successfully tagged #{source} as #{target}"
36
+ end
37
+ .on(:pushing_artifact) do |name|
38
+ say_status artifact.name, "Pushing #{name}"
39
+ end
40
+
20
41
  artifact.push
21
42
  end
22
43
  end
data/lib/minos/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Minos
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
data/lib/minos.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'thor'
3
+ require 'wisper'
3
4
 
4
5
  require 'minos/artifact'
5
6
  require 'minos/docker'
data/minos.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_dependency "activesupport", "~> 5.2"
27
27
  spec.add_dependency "thor", "~> 0.20"
28
+ spec.add_dependency "wisper", "~> 2.0"
28
29
 
29
30
  spec.add_development_dependency "bundler", "~> 1.17"
30
31
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Louis Gottfrois
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-17 00:00:00.000000000 Z
11
+ date: 2019-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.20'
41
+ - !ruby/object:Gem::Dependency
42
+ name: wisper
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -83,6 +97,8 @@ files:
83
97
  - Rakefile
84
98
  - bin/console
85
99
  - bin/setup
100
+ - examples/Dockerfile
101
+ - examples/minos.yaml
86
102
  - exe/minos
87
103
  - lib/minos.rb
88
104
  - lib/minos/artifact.rb