harrison 0.8.0 → 0.9.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: 6afee83edbb748c4ee652e3272decd68030c971c94a253ac79961c35f74207b4
4
- data.tar.gz: c2df93b7c6eb654e14654a3f644e73bc4b5fe42565b49463ff5f5726dce7fd04
3
+ metadata.gz: 9a145afbc3b9cbd07594d187e9152eb774003e8117587c2d016f7ed05fb16b4c
4
+ data.tar.gz: 486fb39b730ce546a2fd0721dfb846daf259f9fe04df950bb4882f634a4d7933
5
5
  SHA512:
6
- metadata.gz: 32f722766b9d7e9ea232e76de095c38666ea3837cd7911895ab1ce947bd2346eb7eaec85b9832c164e9acc4efffbf62546ef88204c5b331315cb0dbcc5b222b6
7
- data.tar.gz: 07fe4f8efb94892f6476be98ba44c602a32e1d17be927790bbe4f1749eb772c91c08eb564e02bdb623afeeb6eacd143d25643bf059dc6b6493c0b3b7cdb5ccee
6
+ metadata.gz: ca4e5c1faa31d7c11e12d0ac6c41ba409a5f6796dac19c91b86798ba0db0b34d10effecd724e74873049e9ceed312c055b17fec7a17bd42d481879bfb2be41dd
7
+ data.tar.gz: 5ade0469ba48eca21d5e2a863c1d554bcf48327996929ecf845a0d1348d0de2fd98b8a220e722ef6c415b7fd40a18c63672265e689147542e10cf0211a57ffd2
@@ -0,0 +1,30 @@
1
+ name: ruby-rspec
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ test:
13
+ name: Test with Ruby ${{ matrix.ruby_version }}
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ ruby: [2.7, 2.6]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v1
21
+ - name: Set up Ruby ${{ matrix.ruby }}
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+
26
+ - name: Build and test with Rspec
27
+ run: |
28
+ gem install bundler
29
+ bundle install --jobs 4 --retry 3
30
+ bundle exec rspec
data/.gitignore CHANGED
@@ -4,7 +4,6 @@
4
4
  .bundle
5
5
  .config
6
6
  .yardoc
7
- Gemfile.lock
8
7
  InstalledFiles
9
8
  _yardoc
10
9
  coverage
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ 0.9.2
2
+ -------------------
3
+ - Bumped dependencies on highline and bundler to latest majors
4
+
5
+ 0.9.1
6
+ -------------------
7
+ - Bumped dependencies on net-ssh and net-scp to latest majors
8
+
9
+ 0.9.0
10
+ -------------------
11
+ - Added ability to package via Docker
12
+ - Added ability to generate multiple builds from a single invocation (when building via Docker)
13
+
1
14
  0.8.0
2
15
  -------------------
3
16
  - BREAKING: Bumped required Ruby version to >= 2.3.1
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @puppetlabs/forge-team
data/Gemfile.lock ADDED
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ harrison (0.9.2)
5
+ highline (~> 2.0.3)
6
+ net-scp (~> 3.0)
7
+ net-ssh (~> 6.1)
8
+ trollop (~> 2.1.2)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ byebug (11.1.3)
14
+ coderay (1.1.3)
15
+ diff-lcs (1.5.0)
16
+ docile (1.4.0)
17
+ file-tail (1.2.0)
18
+ tins (~> 1.0)
19
+ highline (2.0.3)
20
+ method_source (1.0.0)
21
+ net-scp (3.0.0)
22
+ net-ssh (>= 2.6.5, < 7.0.0)
23
+ net-ssh (6.1.0)
24
+ pry (0.13.1)
25
+ coderay (~> 1.1)
26
+ method_source (~> 1.0)
27
+ pry-byebug (3.9.0)
28
+ byebug (~> 11.0)
29
+ pry (~> 0.13.0)
30
+ rake (13.0.6)
31
+ rspec (3.11.0)
32
+ rspec-core (~> 3.11.0)
33
+ rspec-expectations (~> 3.11.0)
34
+ rspec-mocks (~> 3.11.0)
35
+ rspec-core (3.11.0)
36
+ rspec-support (~> 3.11.0)
37
+ rspec-expectations (3.11.0)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.11.0)
40
+ rspec-mocks (3.11.0)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.11.0)
43
+ rspec-support (3.11.0)
44
+ ruby2ruby (2.4.4)
45
+ ruby_parser (~> 3.1)
46
+ sexp_processor (~> 4.6)
47
+ ruby_parser (3.18.1)
48
+ sexp_processor (~> 4.16)
49
+ sexp_processor (4.16.0)
50
+ simplecov (0.21.2)
51
+ docile (~> 1.1)
52
+ simplecov-html (~> 0.11)
53
+ simplecov_json_formatter (~> 0.1)
54
+ simplecov-html (0.12.3)
55
+ simplecov_json_formatter (0.1.4)
56
+ sourcify (0.5.0)
57
+ file-tail (>= 1.0.5)
58
+ ruby2ruby (>= 1.2.5)
59
+ ruby_parser (>= 2.0.5)
60
+ sexp_processor (>= 3.0.5)
61
+ sync (0.5.0)
62
+ tins (1.31.0)
63
+ sync
64
+ trollop (2.1.3)
65
+
66
+ PLATFORMS
67
+ x86_64-darwin-18
68
+
69
+ DEPENDENCIES
70
+ bundler (~> 2.3)
71
+ harrison!
72
+ pry-byebug
73
+ rake
74
+ rspec (~> 3.0)
75
+ simplecov
76
+ sourcify
77
+
78
+ BUNDLED WITH
79
+ 2.3.7
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Simple artifact-based deployment for web applications.
4
4
 
5
- [![Build Status](https://travis-ci.org/puppetlabs/harrison.svg?branch=master)](https://travis-ci.org/puppetlabs/harrison)
6
-
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
data/harrison.gemspec CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
20
20
  spec.required_ruby_version = '>= 2.3.1'
21
21
 
22
22
  spec.add_runtime_dependency "trollop", "~> 2.1.2"
23
- spec.add_runtime_dependency "net-ssh", "~> 5.2"
24
- spec.add_runtime_dependency "net-scp", "~> 2.0"
25
- spec.add_runtime_dependency "highline", "~> 1.7.8"
23
+ spec.add_runtime_dependency "net-ssh", "~> 6.1"
24
+ spec.add_runtime_dependency "net-scp", "~> 3.0"
25
+ spec.add_runtime_dependency "highline", "~> 2.0.3"
26
26
 
27
- spec.add_development_dependency "bundler", "~> 1.6"
27
+ spec.add_development_dependency "bundler", "~> 2.3"
28
28
  spec.add_development_dependency "rake"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
30
  spec.add_development_dependency "simplecov"
@@ -2,6 +2,8 @@ module Harrison
2
2
  class Package < Base
3
3
  def initialize(opts={})
4
4
  # Config helpers for Harrisonfile.
5
+ self.class.option_helper(:via)
6
+ self.class.option_helper(:dockerfiles)
5
7
  self.class.option_helper(:host)
6
8
  self.class.option_helper(:commit)
7
9
  self.class.option_helper(:purge)
@@ -39,6 +41,8 @@ module Harrison
39
41
  # Resolve commit ref to an actual short SHA.
40
42
  resolve_commit!
41
43
 
44
+ return run_docker if self.via == :docker
45
+
42
46
  if self.host.respond_to?(:call)
43
47
  resolved_host = self.host.call(self)
44
48
  self.host = resolved_host
@@ -122,6 +126,130 @@ module Harrison
122
126
 
123
127
  protected
124
128
 
129
+ def run_docker
130
+ require 'open3'
131
+
132
+ packages = []
133
+
134
+ git_worktree_prune_argv = [
135
+ "git",
136
+ "worktree",
137
+ "prune",
138
+ ].join(' ')
139
+
140
+ if Harrison::DEBUG
141
+ system(git_worktree_prune_argv) || (throw :failure)
142
+ else
143
+ _, gwtp_err, gwtp_status = Open3.capture3(git_worktree_prune_argv)
144
+
145
+ if gwtp_status != 0
146
+ puts gwtp_err
147
+ throw :failure
148
+ end
149
+ end
150
+
151
+ begin
152
+ tmp_dir = Dir.mktmpdir("harrison-#{project}", "/tmp")
153
+ tmp_src_dir = File.join(tmp_dir, 'src')
154
+
155
+ git_worktree_add_argv = [
156
+ "git",
157
+ "worktree",
158
+ "add",
159
+ "--force", # allow new worktree to check out duplicate branch
160
+ tmp_src_dir,
161
+ commit,
162
+ ].join(' ')
163
+
164
+ git_worktree_add_env = {
165
+ "OVERCOMMIT_DISABLE" => "1",
166
+ }
167
+
168
+ if Harrison::DEBUG
169
+ system(git_worktree_add_env, git_worktree_add_argv) || (throw :failure)
170
+ else
171
+ _, gwta_err, gwta_status = Open3.capture3(git_worktree_add_env, git_worktree_add_argv)
172
+
173
+ if gwta_status != 0
174
+ puts gwta_err
175
+ throw :failure
176
+ end
177
+ end
178
+
179
+ self.dockerfiles.each do |df|
180
+ df_basename = File.basename(df, '.Dockerfile')
181
+ docker_image_tag = "#{project}-harrison-#{df_basename}:latest"
182
+
183
+ docker_build_argv = [
184
+ 'docker', 'build',
185
+ '--file', df,
186
+ '--tag', docker_image_tag,
187
+ '.',
188
+ ].join(' ')
189
+
190
+ puts "Running: #{docker_build_argv}"
191
+
192
+ if Harrison::DEBUG
193
+ system(docker_build_argv) || (throw :failure)
194
+ else
195
+ _, build_err, build_status = Open3.capture3(docker_build_argv)
196
+
197
+ if build_status != 0
198
+ puts build_err
199
+ throw :failure
200
+ end
201
+ end
202
+
203
+ docker_run_argv = [
204
+ "docker", "run",
205
+ "--mount", "type=bind,source=#{tmp_src_dir},target=/src,readonly",
206
+ "--mount", "type=bind,source=\"$(pwd)/pkg\",target=/pkg",
207
+ docker_image_tag,
208
+ commit,
209
+ ].join(' ')
210
+
211
+ puts "Running: #{docker_run_argv}"
212
+
213
+ if Harrison::DEBUG
214
+ system(docker_run_argv) || (throw :failure)
215
+ else
216
+ pkg_out, pkg_err, pkg_status = Open3.capture3(docker_run_argv)
217
+
218
+ if pkg_status != 0
219
+ puts pkg_err
220
+ throw :failure
221
+ end
222
+ pkg_out_lines = pkg_out.split("\n")
223
+
224
+ packages << pkg_out_lines[-1]
225
+ end
226
+ end
227
+
228
+ git_worktree_remove_argv = [
229
+ "git",
230
+ "worktree",
231
+ "remove",
232
+ "--force", # don't care if worktree is unclean
233
+ tmp_src_dir,
234
+ ].join(' ')
235
+
236
+ if Harrison::DEBUG
237
+ system(git_worktree_remove_argv) || (throw :failure)
238
+ else
239
+ _, gwtr_err, gwtr_status = Open3.capture3(git_worktree_remove_argv)
240
+
241
+ if gwtr_status != 0
242
+ puts gwtr_err
243
+ throw :failure
244
+ end
245
+ end
246
+ ensure
247
+ FileUtils.rm_rf(tmp_dir, secure: true)
248
+ end
249
+
250
+ puts "\n#{packages.join("\n")}"
251
+ end
252
+
125
253
  def remote_project_dir
126
254
  "#{remote_dir}/#{project}"
127
255
  end
@@ -1,3 +1,3 @@
1
1
  module Harrison
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harrison
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-05 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
@@ -30,56 +30,56 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.2'
33
+ version: '6.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.2'
40
+ version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: net-scp
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '3.0'
48
48
  type: :runtime
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: '2.0'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: highline
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.7.8
61
+ version: 2.0.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.7.8
68
+ version: 2.0.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.6'
75
+ version: '2.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.6'
82
+ version: '2.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -158,11 +158,13 @@ executables:
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
+ - ".github/workflows/ruby-spec.yml"
161
162
  - ".gitignore"
162
163
  - ".rspec"
163
- - ".travis.yml"
164
164
  - CHANGELOG
165
+ - CODEOWNERS
165
166
  - Gemfile
167
+ - Gemfile.lock
166
168
  - IDEAS
167
169
  - LICENSE.txt
168
170
  - README.md
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - ruby-head
4
- - 2.1.1
5
- - 2.0.0
6
- - 1.9.3