service_image_builder 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21806e8b7cfe2b3e9b44268a0fde515b2ad7b0a9c1ebc83e57abd59926305d97
4
- data.tar.gz: f8f5c513210b0ad06629d9f6c6bea8e7a506f323a46d4731119cf4d79c58c025
3
+ metadata.gz: 8c8262a35662d3f437f013c16b2bc07e3a2cb2d2134540dc29f5f1658d86fbbd
4
+ data.tar.gz: 958a2d6ae6b05a5cb4d861c367e00e783914c9061fcba49111fd776d59da62f8
5
5
  SHA512:
6
- metadata.gz: c4e3f5fbc09afc534f3b3b43f54b5d6f2bcbd756ded4e80d4525fc3a659ff88d03c669f232e7446273f1575d9417fee66a864bcb4ea54918075f603ed9604135
7
- data.tar.gz: 250008f69b17e6ea30f85b2bebfa31455ae59ee0be2fbb729322c6a3a14d78d5cc11e260ddac775a7dafc332bd63b2c37d245f59c70a810e6803b4d7302b97da
6
+ metadata.gz: be9f00f831944d7692aa22a518c10ccfca329a9e1d11bcfb6fe9bd86bf139cb795f225b7925d5de28f3755d65fdc915aaa293c8c1ea38b651dbac833a13a05a2
7
+ data.tar.gz: df803efdb83c06d8b608f875cc1278af0888185f6c9464c75aaf747bb0d9633627c19be8c78eaaa317eec9676e236e493a8935663bdcfa27104bf1ac50de12b4
data/.gitlab-ci.yml CHANGED
@@ -1,9 +1,14 @@
1
- test:
2
- image: ruby:2.6
1
+ image: slushsystems/ruby:latest
2
+
3
+ cache:
4
+ paths:
5
+ - vendor/
6
+
7
+ before_script:
8
+ - bundle install --deployment
9
+
10
+ pre-flight check:
3
11
  stage: test
4
- before_script:
5
- - apt-get update -qy
6
- - bundle install
7
12
  script:
8
- - bundle exec rake
9
- - rubocop
13
+ - bundle exec rake
14
+ - bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -1,5 +1,9 @@
1
1
  AllCops:
2
2
  Exclude:
3
+ - node_modules/**/*
3
4
  - service_image_builder.gemspec
5
+ - vendor/**/*
4
6
  Metrics/LineLength:
5
7
  Max: 96
8
+ Metrics/MethodLength:
9
+ Max: 11
data/Dockerfile ADDED
@@ -0,0 +1,3 @@
1
+ FROM slushsystems/ruby:latest
2
+
3
+ RUN gem install service_image_builder
data/Gemfile.lock CHANGED
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- service_image_builder (0.1.0)
4
+ service_image_builder (0.1.2)
5
5
  activesupport (~> 5.2)
6
6
  docker-api (~> 1.34)
7
- pry-byebug (~> 3.7)
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
@@ -70,11 +69,12 @@ PLATFORMS
70
69
  ruby
71
70
 
72
71
  DEPENDENCIES
73
- bundler (~> 1.17)
72
+ bundler (~> 2)
73
+ pry-byebug (~> 3.7)
74
74
  rake (~> 10.0)
75
75
  rspec (~> 3.0)
76
76
  rubocop (~> 0.70)
77
77
  service_image_builder!
78
78
 
79
79
  BUNDLED WITH
80
- 1.17.2
80
+ 2.0.1
data/bin/sib CHANGED
@@ -19,8 +19,9 @@ current_commit_id = ENV.fetch('CI_COMMIT_SHA')
19
19
  docker_file = ENV.fetch('SIB_DOCKER_FILE', 'Dockerfile')
20
20
  image_repo = ENV.fetch('SIB_IMAGE_REPO')
21
21
  image_upstream_tag = ENV.fetch('SIB_UPSTREAM_TAG', 'latest')
22
- registry_user = ENV.fetch('SIB_REGISTRY_USER')
23
22
  registry_pass = ENV.fetch('SIB_REGISTRY_PASS')
23
+ registry_user = ENV.fetch('SIB_REGISTRY_USER')
24
+ squash = ENV.fetch('SIB_SQUASH', false)
24
25
 
25
26
  Docker.authenticate!('username' => registry_user, 'password' => registry_pass)
26
27
 
@@ -39,7 +40,7 @@ canary_build_args = {
39
40
  'systems.slush.commit-id' => current_commit_id,
40
41
  'systems.slush.timestamp' => Time.now.utc.iso8601
41
42
  }.to_json,
42
- 'squash' => true
43
+ 'squash' => squash
43
44
  }
44
45
  canary = SIB::Image.new(
45
46
  image: Docker::Image.build_from_dir(build_dir, canary_build_args)
@@ -36,12 +36,15 @@ module SIB
36
36
 
37
37
  # Image#package_manifest creates a container from @image and generates the
38
38
  # package-manifest from it
39
+ # TODO extract the entire factor system out into its own object
40
+ # After that, remove the `Metrics/MethodLength` cop override
39
41
  def package_manifest
40
42
  @package_manifest ||= String.new.tap do |manifest|
41
43
  container = Docker::Container.create(
42
44
  'Cmd' => ['/bin/bash', '-c',
43
45
  'dnf list installed | sha256sum | colrm 65 > /package-manifest'],
44
- 'Image' => image.id
46
+ 'Image' => image.id,
47
+ 'User' => 'root'
45
48
  )
46
49
  container.tap(&:start).tap(&:wait)
47
50
  manifest << container.read_file('/package-manifest').chomp
@@ -50,7 +53,7 @@ module SIB
50
53
  end
51
54
 
52
55
  def timestamp
53
- @timestamp ||= labels.fetch('systems.slush.timestamp', nil)
56
+ @timestamp ||= Time.parse(labels.fetch('systems.slush.timestamp', nil))
54
57
  end
55
58
  end
56
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SIB
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -5,8 +5,8 @@ require 'active_support/core_ext/time' # cherry pick Time extensions
5
5
  require 'active_support/core_ext/numeric/time' # cherry pick Time extensions
6
6
  require 'active_support/core_ext/integer/time' # cherry pick Time extensions
7
7
  require 'active_support/core_ext/object/blank' # cherry pick Object#blank?
8
- require 'pry-byebug'
9
8
  require 'digest'
10
9
  require 'docker'
10
+ require 'json'
11
11
 
12
12
  require_relative 'service_image_builder/image'
@@ -33,7 +33,7 @@ registry.'
33
33
  spec.add_dependency 'activesupport', '~> 5.2'
34
34
  spec.add_dependency 'docker-api', '~> 1.34'
35
35
 
36
- spec.add_development_dependency 'bundler', '~> 1.17'
36
+ spec.add_development_dependency 'bundler', '~> 2'
37
37
  spec.add_development_dependency 'pry-byebug', '~> 3.7'
38
38
  spec.add_development_dependency 'rake', '~> 10.0'
39
39
  spec.add_development_dependency 'rspec', '~> 3.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_image_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Jacobs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-01 00:00:00.000000000 Z
11
+ date: 2019-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.17'
47
+ version: '2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.17'
54
+ version: '2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry-byebug
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -125,6 +125,7 @@ files:
125
125
  - ".rspec"
126
126
  - ".rubocop.yml"
127
127
  - CODE_OF_CONDUCT.md
128
+ - Dockerfile
128
129
  - Gemfile
129
130
  - Gemfile.lock
130
131
  - LICENSE.txt