conjur-debify 1.7.4 → 1.8.0

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
- SHA1:
3
- metadata.gz: 25e7e371c95312fbb642c60bb40909bfe5f00e13
4
- data.tar.gz: 3fbf7dc8fcb6fcd9ff1600f3e129a1e5839ba67b
2
+ SHA256:
3
+ metadata.gz: 5b219503ab3f09f2373d24e4bac3e34bd72c2c589924129eb56de4b531eb5035
4
+ data.tar.gz: cf31ae9124e790229026c42137010f7cb309059e5faf1eb87bfe3586cfe25ba1
5
5
  SHA512:
6
- metadata.gz: 5b937e0e09ef9b403f268a853b1ea51eb07729810454e95c4cd8b19ed830c4afc42517354feb10e7aeb5e26c1365d1eb9b84aeeeb1766fbbd23f466cf9f3f5b7
7
- data.tar.gz: 8baaf6cf2589c30c888dafe41944817124d10923cc51607083e41e013a0a7f76df96e47cc44ab75f6a830c78938c4c930c0c8499531819603dfe9d2c94397044
6
+ metadata.gz: 90d8a3fe86a992b9789b0734d2b1438cc860b004eff656a6992790cb93668b4f0fbbe6ee2e81e0ffc3df8dda5b07271556190a0e3517286b865c7bd966efc0fb
7
+ data.tar.gz: 42229cbc3f2ed5b8e5e096995f5b229a5b52c5e383da102f7af8a9c0d434220a74c1c4189878aff0ab11531443921de9d9a1d2566dddb3cfe4582349781aea5f
@@ -1,3 +1,8 @@
1
+ # 1.8.0
2
+
3
+ * Added artifactory url option to `debian publish`, defaults to jfrog.io domain
4
+ * Added artifactory repo option to `debian publish`, defaults to 'debian-private'
5
+
1
6
  # 1.7.4
2
7
 
3
8
  * Fix publishing support in docker-debify
@@ -31,8 +31,10 @@ pipeline {
31
31
  stage('Run feature tests') {
32
32
  steps {
33
33
  sh './test.sh'
34
- junit 'features/reports/*.xml'
35
34
  }
35
+ post { always {
36
+ junit 'features/reports/*.xml'
37
+ }}
36
38
  }
37
39
 
38
40
  stage('Push Docker image') {
@@ -78,14 +80,7 @@ pipeline {
78
80
 
79
81
  post {
80
82
  always {
81
- sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
82
- deleteDir()
83
- }
84
- failure {
85
- slackSend(color: 'danger', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} FAILURE (<${env.BUILD_URL}|Open>)")
86
- }
87
- unstable {
88
- slackSend(color: 'warning', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} UNSTABLE (<${env.BUILD_URL}|Open>)")
83
+ cleanupAndNotify(currentBuild.currentResult)
89
84
  }
90
85
  }
91
86
  }
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.4
1
+ 1.8.0
data/ci/test.sh CHANGED
@@ -3,6 +3,6 @@
3
3
  bundle
4
4
 
5
5
  for target in spec cucumber; do
6
- bundle exec rake $target || true
6
+ bundle exec rake $target
7
7
  done
8
8
 
@@ -120,30 +120,30 @@ arg_name "project-name -- <fpm-arguments>"
120
120
  command "clean" do |c|
121
121
  c.desc "Set the current working directory"
122
122
  c.flag [ :d, "dir" ]
123
-
123
+
124
124
  c.desc "Ignore (don't delete) a file or directory"
125
125
  c.flag [ :i, :ignore ]
126
-
126
+
127
127
  c.desc "Force file deletion even if if this doesn't look like a Jenkins environment"
128
128
  c.switch [ :force ]
129
-
129
+
130
130
  c.action do |global_options,cmd_options,args|
131
131
  def looks_like_jenkins?
132
132
  require 'etc'
133
133
  Etc.getlogin == 'jenkins' && ENV['BUILD_NUMBER']
134
134
  end
135
-
135
+
136
136
  require 'set'
137
137
  perform_deletion = cmd_options[:force] || looks_like_jenkins?
138
138
  if !perform_deletion
139
139
  $stderr.puts "No --force, and this doesn't look like Jenkins. I won't actually delete anything"
140
140
  end
141
141
  @ignore_list = Array(cmd_options[:ignore]) + [ '.', '..', '.git' ]
142
-
142
+
143
143
  def ignore_file? f
144
144
  @ignore_list.find{|ignore| f.index(ignore) == 0}
145
145
  end
146
-
146
+
147
147
  dir = cmd_options[:dir] || '.'
148
148
  dir = File.expand_path(dir)
149
149
  Dir.chdir dir do
@@ -154,7 +154,7 @@ command "clean" do |c|
154
154
  end
155
155
  find_files.compact!
156
156
  delete_files = (find_files - git_files)
157
- delete_files.delete_if{|file|
157
+ delete_files.delete_if{|file|
158
158
  File.directory?(file) || ignore_file?(file)
159
159
  }
160
160
  if perform_deletion
@@ -172,10 +172,10 @@ command "clean" do |c|
172
172
  container.start
173
173
  delete_files.each do |file|
174
174
  puts file
175
-
175
+
176
176
  file = "/src/#{file}"
177
177
  cmd = [ "rm", "-f", file ]
178
-
178
+
179
179
  stdout, stderr, status = container.exec cmd, &DebugMixin::DOCKER
180
180
  $stderr.puts "Failed to delete #{file}" unless status == 0
181
181
  end
@@ -200,39 +200,39 @@ The project directory is required to contain:
200
200
  * A Gemfile and Gemfile.lock
201
201
  * A shell script called debify.sh
202
202
 
203
- debify.sh is invoked by the package build process to create any custom
204
- files, other than the project source tree. For example, config files can be
203
+ debify.sh is invoked by the package build process to create any custom
204
+ files, other than the project source tree. For example, config files can be
205
205
  created in /opt/conjur/etc.
206
206
 
207
207
  The distrib folder in the project source tree is intended to create scripts
208
208
  for package pre-install, post-install etc. The distrib folder is not included
209
- in the deb package, so its contents should be copied to the file system or
209
+ in the deb package, so its contents should be copied to the file system or
210
210
  packaged using fpm arguments.
211
211
 
212
- All arguments to this command which follow the double-dash are propagated to
212
+ All arguments to this command which follow the double-dash are propagated to
213
213
  the fpm command.
214
214
  DESC
215
215
  arg_name "project-name -- <fpm-arguments>"
216
216
  command "package" do |c|
217
217
  c.desc "Set the current working directory"
218
218
  c.flag [ :d, "dir" ]
219
-
219
+
220
220
  c.desc "Specify the deb version; by default, it's read from the VERSION file"
221
221
  c.flag [ :v, :version ]
222
222
 
223
223
  c.desc "Specify a custom Dockerfile.fpm"
224
224
  c.flag [ :dockerfile]
225
-
225
+
226
226
  c.action do |global_options,cmd_options,args|
227
227
  raise "project-name is required" unless project_name = args.shift
228
-
228
+
229
229
  fpm_args = []
230
230
  if (delimeter = args.shift) == '--'
231
231
  fpm_args = args.dup
232
232
  else
233
233
  raise "Unexpected argument '#{delimeter}'"
234
234
  end
235
-
235
+
236
236
  dir = cmd_options[:dir] || '.'
237
237
  pwd = File.dirname(__FILE__)
238
238
 
@@ -245,7 +245,7 @@ command "package" do |c|
245
245
  dockerfile = File.read(dockerfile_path)
246
246
 
247
247
  package_name = "conjur-#{project_name}_#{version}_amd64.deb"
248
-
248
+
249
249
  output = StringIO.new
250
250
  Gem::Package::TarWriter.new(output) do |tar|
251
251
  git_files.each do |fname|
@@ -255,7 +255,7 @@ command "package" do |c|
255
255
  tar.add_file('Dockerfile', 0640) { |tar_file| tar_file.write dockerfile.gsub("@@image@@", fpm_image.id) }
256
256
  end
257
257
  output.rewind
258
-
258
+
259
259
  image = Docker::Image.build_from_tar output, &DebugMixin::DOCKER
260
260
 
261
261
  DebugMixin.debug_write "Built fpm image '#{image.id}' for project #{project_name}\n"
@@ -265,14 +265,14 @@ command "package" do |c|
265
265
  'Image' => image.id
266
266
  }
267
267
  options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
268
-
268
+
269
269
  container = Docker::Container.create options
270
270
  begin
271
271
  DebugMixin.debug_write "Packaging #{project_name} in container #{container.id}\n"
272
272
  container.tap(&:start).streaming_logs(follow: true, stdout: true, stderr: true) { |stream, chunk| $stderr.puts "#{chunk}" }
273
273
  status = container.wait
274
274
  raise "Failed to package #{project_name}" unless status['StatusCode'] == 0
275
-
275
+
276
276
  require 'rubygems/package'
277
277
  deb = StringIO.new
278
278
  container.copy("/src/#{package_name}") { |chunk| deb.write(chunk) }
@@ -312,12 +312,12 @@ password, etc). The project source tree is also mounted into the container, at
312
312
  This command then waits for Conjur to initialize and be healthy. It proceeds by
313
313
  installing the conjur-<project-name>_<version>_amd64.deb from the project working directory.
314
314
 
315
- Then the evoke "test-install" command is used to install the test code in the
315
+ Then the evoke "test-install" command is used to install the test code in the
316
316
  /src/<project-name>. Basically, the development bundle is installed and the database
317
317
  configuration (if any) is setup.
318
318
 
319
319
  Finally, a test script from the project source tree is run, again with the container
320
- id as the program argument.
320
+ id as the program argument.
321
321
 
322
322
  Then the Conjur container is deleted (use --keep to leave it running).
323
323
  DESC
@@ -333,10 +333,10 @@ command "test" do |c|
333
333
  c.desc "Image name"
334
334
  c.default_value "registry.tld/conjur-appliance-cuke-master"
335
335
  c.flag [ :i, :image ]
336
-
336
+
337
337
  c.desc "Image tag, e.g. 4.5-stable, 4.6-stable"
338
338
  c.flag [ :t, "image-tag"]
339
-
339
+
340
340
  c.desc "'docker pull' the Conjur container image"
341
341
  c.default_value true
342
342
  c.switch [ :pull ]
@@ -357,16 +357,16 @@ command "test" do |c|
357
357
 
358
358
  dir = cmd_options[:dir] || '.'
359
359
  dir = File.expand_path(dir)
360
-
360
+
361
361
  raise "Directory #{dir} does not exist or is not a directory" unless File.directory?(dir)
362
362
  raise "Directory #{dir} does not contain a .deb file" unless Dir["#{dir}/*.deb"].length >= 1
363
-
363
+
364
364
  Dir.chdir dir do
365
365
  image_tag = cmd_options["image-tag"] or raise "image-tag is required"
366
366
  appliance_image_id = [ cmd_options[:image], image_tag ].join(":")
367
367
  version = cmd_options[:version] || detect_version
368
368
  package_name = "conjur-#{project_name}_#{version}_amd64.deb"
369
-
369
+
370
370
  raise "#{test_script} does not exist or is not a file" unless File.file?(test_script)
371
371
 
372
372
  begin
@@ -377,7 +377,7 @@ command "test" do |c|
377
377
  retry unless (tries -= 1).zero?
378
378
  end
379
379
 
380
-
380
+
381
381
  def build_test_image(appliance_image_id, project_name, package_name)
382
382
  dockerfile = <<-DOCKERFILE
383
383
  FROM #{appliance_image_id}
@@ -411,7 +411,7 @@ RUN touch /etc/service/conjur/down
411
411
  login_to_registry appliance_image_id
412
412
  retry unless (tries -= 1).zero?
413
413
  end
414
-
414
+
415
415
  vendor_dir = File.expand_path("tmp/debify/#{project_name}/vendor", ENV['HOME'])
416
416
  dot_bundle_dir = File.expand_path("tmp/debify/#{project_name}/.bundle", ENV['HOME'])
417
417
  FileUtils.mkdir_p vendor_dir
@@ -438,7 +438,7 @@ RUN touch /etc/service/conjur/down
438
438
  end
439
439
 
440
440
  container = Docker::Container.create(options)
441
-
441
+
442
442
  begin
443
443
  DebugMixin.debug_write "Testing #{project_name} in container #{container.id}\n"
444
444
 
@@ -467,7 +467,7 @@ RUN touch /etc/service/conjur/down
467
467
  container_command container, "rm", "/etc/service/conjur/down"
468
468
  container_command container, "sv", "start", "conjur"
469
469
  wait_for_conjur appliance_image, container
470
-
470
+
471
471
  system "./#{test_script} #{container.id}"
472
472
  exit_now! "#{test_script} failed with exit code #{$?.exitstatus}", $?.exitstatus unless $?.exitstatus == 0
473
473
  ensure
@@ -496,13 +496,13 @@ command "sandbox" do |c|
496
496
  c.desc "Image name"
497
497
  c.default_value "registry.tld/conjur-appliance-cuke-master"
498
498
  c.flag [ :i, :image ]
499
-
499
+
500
500
  c.desc "Image tag, e.g. 4.5-stable, 4.6-stable"
501
501
  c.flag [ :t, "image-tag"]
502
502
 
503
503
  c.desc "Bind another source directory into the container. Use <src>:<dest>, where both are full paths."
504
504
  c.flag [ :"bind" ], :multiple => true
505
-
505
+
506
506
  c.desc "'docker pull' the Conjur container image"
507
507
  c.default_value false
508
508
  c.switch [ :pull ]
@@ -526,16 +526,16 @@ command "sandbox" do |c|
526
526
 
527
527
  c.action do |global_options,cmd_options,args|
528
528
  raise "Received extra command-line arguments" if args.shift
529
-
529
+
530
530
  dir = cmd_options[:dir] || '.'
531
531
  dir = File.expand_path(dir)
532
-
532
+
533
533
  raise "Directory #{dir} does not exist or is not a directory" unless File.directory?(dir)
534
-
534
+
535
535
  Dir.chdir dir do
536
536
  image_tag = cmd_options["image-tag"] or raise "image-tag is required"
537
537
  appliance_image_id = [ cmd_options[:image], image_tag ].join(":")
538
-
538
+
539
539
  appliance_image = if cmd_options[:pull]
540
540
  begin
541
541
  tries ||=2
@@ -547,15 +547,15 @@ command "sandbox" do |c|
547
547
  else
548
548
  Docker::Image.get appliance_image_id
549
549
  end
550
-
550
+
551
551
  project_name = File.basename(Dir.getwd)
552
552
  vendor_dir = File.expand_path("tmp/debify/#{project_name}/vendor", ENV['HOME'])
553
553
  dot_bundle_dir = File.expand_path("tmp/debify/#{project_name}/.bundle", ENV['HOME'])
554
554
  FileUtils.mkdir_p vendor_dir
555
555
  FileUtils.mkdir_p dot_bundle_dir
556
-
556
+
557
557
  options = {
558
- 'name' => "#{project_name}-sandbox",
558
+ 'name' => "#{project_name}-sandbox",
559
559
  'Image' => appliance_image.id,
560
560
  'WorkingDir' => "/src/#{project_name}",
561
561
  'Env' => [
@@ -630,13 +630,21 @@ arg_name "distribution project-name"
630
630
  command "publish" do |c|
631
631
  c.desc "Set the current working directory"
632
632
  c.flag [ :d, :dir ]
633
-
633
+
634
634
  c.desc "Specify the deb package version; by default, it's computed automatically"
635
635
  c.flag [ :v, :version ]
636
636
 
637
637
  c.desc "Component to publish to, either 'stable' or the name of the git branch"
638
638
  c.flag [ :c, :component ]
639
639
 
640
+ c.desc "Artifactory URL to publish to"
641
+ c.default_value "https://conjurinc.jfrog.io/conjurinc"
642
+ c.flag [ :u, :url]
643
+
644
+ c.desc "Artifactory Debian repo to publish package to"
645
+ c.default_value "debian-private"
646
+ c.flag [ :r, :repo]
647
+
640
648
  c.action do |global_options,cmd_options,args|
641
649
  require 'conjur/debify/action/publish'
642
650
  raise "distribution is required" unless distribution = args.shift
@@ -646,7 +654,7 @@ command "publish" do |c|
646
654
  Conjur::Debify::Action::Publish.new(distribution, project_name, cmd_options).run
647
655
  end
648
656
  end
649
-
657
+
650
658
  desc "Auto-detect and print the repository verison"
651
659
  command "detect-version" do |c|
652
660
  c.desc "Set the current working directory"
@@ -656,9 +664,9 @@ command "detect-version" do |c|
656
664
 
657
665
  dir = cmd_options[:dir] || '.'
658
666
  dir = File.expand_path(dir)
659
-
667
+
660
668
  raise "Directory #{dir} does not exist or is not a directory" unless File.directory?(dir)
661
-
669
+
662
670
  Dir.chdir dir do
663
671
  puts detect_version
664
672
  end
@@ -678,7 +686,7 @@ command 'config' do |c|
678
686
  end
679
687
  end
680
688
 
681
-
689
+
682
690
  pre do |global,command,options,args|
683
691
  # Pre logic here
684
692
  # Return true to proceed; false to abort and not call the
@@ -17,20 +17,23 @@ module Conjur::Debify
17
17
  @project_name = project_name
18
18
  @cmd_options = cmd_options
19
19
  end
20
-
20
+
21
21
  def run
22
22
  dir = cmd_options[:dir] || '.'
23
23
  dir = File.expand_path(dir)
24
24
  raise "Directory #{dir} does not exist or is not a directory" unless File.directory?(dir)
25
-
25
+
26
26
  Dir.chdir dir do
27
27
  version = cmd_options[:version] || detect_version
28
28
  component = cmd_options[:component] || detect_component
29
29
  package_name = "conjur-#{project_name}_#{version}_amd64.deb"
30
30
 
31
- publish_image = create_image
31
+ publish_image = create_image
32
32
  DebugMixin.debug_write "Built base publish image '#{publish_image.id}'\n"
33
33
 
34
+ art_url = cmd_options[:url]
35
+ art_repo = cmd_options[:repo]
36
+
34
37
  art_user = ENV['ARTIFACTORY_USER']
35
38
  art_password = ENV['ARTIFACTORY_PASSWORD']
36
39
  unless art_user && art_password
@@ -40,12 +43,12 @@ module Conjur::Debify
40
43
  options = {
41
44
  'Image' => publish_image.id,
42
45
  'Cmd' => [
43
- "art", "upload",
44
- "--url", "https://conjurinc.artifactoryonline.com/conjurinc",
46
+ "jfrog", "rt", "upload",
47
+ "--url", art_url,
45
48
  "--user", art_user,
46
49
  "--password", art_password,
47
50
  "--deb", "#{distribution}/#{component}/amd64",
48
- package_name, "debian-local/"
51
+ package_name, "#{art_repo}/"
49
52
  ],
50
53
  'Binds' => [
51
54
  [ dir, "/src" ].join(':')
@@ -67,7 +70,7 @@ module Conjur::Debify
67
70
  Conjur::Config.load
68
71
  Conjur::Config.apply
69
72
  conjur = Conjur::Authn.connect nil, noask: true
70
-
73
+
71
74
  username_var = 'ci/artifactory/users/jenkins/username'
72
75
  password_var = 'ci/artifactory/users/jenkins/password'
73
76
 
@@ -79,12 +82,12 @@ module Conjur::Debify
79
82
  begin
80
83
  container.tap(&:start).streaming_logs(follow: true, stdout: true, stderr: true) { |stream, chunk| puts "#{chunk}" }
81
84
  status = container.wait
82
- raise "Failed to publish #{package_name}" unless status['StatusCode'] == 0
85
+ raise "Failed to publish package" unless status['StatusCode'] == 0
83
86
  ensure
84
87
  container.delete(force: true)
85
88
  end
86
89
  end
87
-
90
+
88
91
  end
89
92
  end
90
93
  end
@@ -1,8 +1,11 @@
1
1
  FROM buildpack-deps:curl
2
2
 
3
+ ENV JFROG_CLI_OFFER_CONFIG=false
4
+ ENV JFROG_VERSION=1.13.1
5
+
3
6
  RUN curl -kL \
4
- -o /usr/bin/art \
5
- https://bintray.com/artifact/download/jfrog/artifactory-cli-go/1.2.1/artifactory-cli-linux-amd64/art && \
6
- chmod +x /usr/bin/art
7
+ -o /usr/bin/jfrog \
8
+ https://bintray.com/jfrog/jfrog-cli-go/download_file?file_path=${JFROG_VERSION}%2Fjfrog-cli-linux-amd64%2Fjfrog && \
9
+ chmod +x /usr/bin/jfrog
7
10
 
8
11
  WORKDIR /src
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-debify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-26 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project:
227
- rubygems_version: 2.6.14
227
+ rubygems_version: 2.7.4
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Utility commands to build and package Conjur services as Debian packages