conjur-debify 1.11.2 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa6af330a692efe6fc340c88506e232d9118e2b3b90303d025a851b103ef58f9
4
- data.tar.gz: c160e06f5a00c751c1a50f281b44f38925b9c4f03620e8f0c5203105c55af527
3
+ metadata.gz: 6f76a5ea0e2c4fc01e0666594176690174cf1894f478570118056908c03c5e81
4
+ data.tar.gz: ebdb065547d044394079979326f759118e264a640a5feb41341fdba6386de661
5
5
  SHA512:
6
- metadata.gz: a0672e9057d8ac3acbce9387dccd3523c3ce3db9446a7c88fa61518d667e8cead9acf4c9af74bfb81ff89a4799d52545a7c318a30b5186e626111d9e07105076
7
- data.tar.gz: 29df6653100104e47112ffdfa98b0d40133cbd8b34ab5b3cefcf7ff8aa014e4f302565c29f9793cd9add2d36e77fd95ad2ecb6925fe6ad0bcda3f52fc9f68c2e
6
+ metadata.gz: ed14d2fecc7c4229f8c3c59d289acd39b7defd6c046b5417d332d7adfe6b921cdc5dc16b81f95825b07e9d595f92ecc7924508fc0529f6ccce00bd182e0d8f65
7
+ data.tar.gz: 9c8aaaa932d2971d549a2db859c2e47c16f26890fc25ed6491c5cd854fb4d363af289312947e5f9deb950d55b044a6bc32158472445c391241bd19604d7a5725
data/.gitignore CHANGED
@@ -16,5 +16,6 @@ features/reports
16
16
  results.html
17
17
  mkmf.log
18
18
  *.deb
19
+ *.rpm
19
20
  *.gem
20
21
  docker-debify
@@ -1,3 +1,41 @@
1
+ ## [Unreleased]
2
+
3
+ # 2.0.0
4
+ ### Changed
5
+ - Debify now receives the flag `--output` as input to indicate the file type that it should package (e.g `rpm`). If this
6
+ flag is not given, the default value is `deb`.
7
+ [conjurinc/debify#56](https://github.com/conjurinc/debify/issues/56)
8
+
9
+ # 1.12.0
10
+
11
+ ### Added
12
+ - Debify now packages and publishes an RPM file, alongside a debian file.
13
+ [conjurinc/debify#49](https://github.com/conjurinc/debify/pull/49)
14
+ - `debify package` now offers an `--additional-files` flag to provide a comma
15
+ separated list of files to include in the FPM build that are not provided
16
+ automatically by `git ls-files`.
17
+ [conjurinc/debify#52](https://github.com/conjurinc/debify/pull/52)
18
+
19
+ ### Fixed
20
+ - Bug causing `all` files in the git repo to be added to the debian file.
21
+ [conjurinc/debify#50](https://github.com/conjurinc/debify/pull/50)
22
+
23
+ # 1.11.5
24
+
25
+ ### Changed
26
+ * Updated FPM and Test images to use a base image with FIPS-compliant Ruby and OpenSSL.
27
+
28
+ # 1.11.4
29
+
30
+ * Updated sandbox password to match Conjur password complexity requirements.
31
+
32
+ # 1.11.3
33
+
34
+ * Reverted to `bundler` v1. `bundler` v2 was creating incompatible paths for downstream
35
+ packages.
36
+ * Made FPM Ruby version use `ruby2.5` instead of `ruby2.6` since that is what
37
+ our appliance image uses otherwise the gems bundled in the packages are unusable.
38
+
1
39
  # 1.11.2
2
40
 
3
41
  * Upgraded to use Ruby 2.6 and latest version of FPM
@@ -10,6 +48,7 @@
10
48
  version available for Ubuntu 18.04.
11
49
 
12
50
  # 1.11.1
51
+
13
52
  * Upgrade `docker-debify` to use Ruby 2.6.
14
53
 
15
54
  # 1.11.0
@@ -0,0 +1,16 @@
1
+ # Contributing
2
+
3
+ For general contribution and community guidelines, please see the [community repo](https://github.com/cyberark/community).
4
+
5
+ ## Contributing
6
+
7
+ 1. [Fork the project](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)
8
+ 2. [Clone your fork](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
9
+ 3. Make local changes to your fork by editing files
10
+ 3. [Commit your changes](https://help.github.com/en/github/managing-files-in-a-repository/adding-a-file-to-a-repository-using-the-command-line)
11
+ 4. [Push your local changes to the remote server](https://help.github.com/en/github/using-git/pushing-commits-to-a-remote-repository)
12
+ 5. [Create new Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork)
13
+
14
+ From here your pull request will be reviewed and once you've responded to all
15
+ feedback it will be merged into the project. Congratulations, you're a
16
+ contributor!
data/Dockerfile CHANGED
@@ -1,30 +1,18 @@
1
1
  FROM ruby:2.6-stretch
2
2
 
3
- ### DockerInDocker support is take from
4
- ### https://github.com/jpetazzo/dind/blob/master/Dockerfile . I
5
- ### elected to base this image on ruby, then pull in the (slightly
6
- ### outdated) support for DockerInDocker. Creation of the official
7
- ### docker:dind image much more complicated and didn't lend itself to
8
- ### also running ruby.
9
-
10
- RUN apt-get update -qq && apt-get install -qqy \
3
+ RUN apt-get update -qq && \
4
+ apt-get dist-upgrade -qqy && \
5
+ apt-get install -qqy \
11
6
  apt-transport-https \
12
7
  ca-certificates \
13
- curl \
14
- lxc \
15
- iptables
8
+ curl
16
9
 
17
- # Install Docker from Docker Inc. repositories.
18
- RUN curl -sSL https://get.docker.com/ | sh
19
-
20
- # Install the magic wrapper.
21
- RUN curl -sSL -o /usr/local/bin/wrapdocker https://raw.githubusercontent.com/jpetazzo/dind/master/wrapdocker
22
- RUN chmod +x /usr/local/bin/wrapdocker
23
-
24
- # Define additional metadata for our image.
25
- VOLUME /var/lib/docker
26
-
27
- ### End of DockerInDocker support
10
+ # Install Docker client tools
11
+ ENV DOCKERVERSION=20.10.0
12
+ RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
13
+ && tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
14
+ -C /usr/local/bin docker/docker \
15
+ && rm docker-${DOCKERVERSION}.tgz
28
16
 
29
17
  RUN mkdir -p /debify
30
18
  WORKDIR /debify
@@ -32,6 +32,23 @@ pipeline {
32
32
  }
33
33
  }
34
34
 
35
+ stage('Scan Docker image') {
36
+ parallel {
37
+ stage('Scan Docker image for fixable issues') {
38
+ steps{
39
+ script {
40
+ VERSION = sh(returnStdout: true, script: 'cat VERSION')
41
+ }
42
+ scanAndReport("debify:${VERSION}", "HIGH", false)
43
+ }
44
+ }
45
+ // No all report generated because it currently adds 10-12 minutes of
46
+ // build time just to write the trivy report. It'll be added once we've
47
+ // cleaned up and/or ignored enough issues to reduce the impact
48
+ // on build time.
49
+ }
50
+ }
51
+
35
52
  stage('Run feature tests') {
36
53
  steps {
37
54
  sh './test.sh'
@@ -49,7 +66,6 @@ pipeline {
49
66
  }
50
67
 
51
68
  stage('Publish to RubyGems') {
52
- agent { label 'releaser-v2' }
53
69
  when {
54
70
  allOf {
55
71
  branch 'master'
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Kevin Gilpin
1
+ Copyright (c) 2020 CyberArk Software Ltd. All rights reserved.
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Debify
2
2
 
3
+ Debify is a tool used for building and testing DAP appliance packages.
4
+ It is mainly used to package and publish debian packages that are consumed into the
5
+ appliance image in its build stage. However, it also packages and publishes an
6
+ RPM package whenever it does so for a debian.
7
+
3
8
  ## Installation
4
9
 
5
10
  There are two different ways of installing debify: as a gem, or as a Docker image.
@@ -293,8 +298,6 @@ root@7d4217655332:/src/example# getent hosts mydb
293
298
 
294
299
  ## Contributing
295
300
 
296
- 1. Fork it ( https://github.com/[my-github-username]/debify/fork )
297
- 2. Create your feature branch (`git checkout -b my-new-feature`)
298
- 3. Commit your changes (`git commit -am 'Add some feature'`)
299
- 4. Push to the branch (`git push origin my-new-feature`)
300
- 5. Create a new Pull Request
301
+ For instructions on how to get started and
302
+ descriptions of our development workflows, please see our
303
+ [contributing guide](CONTRIBUTING.md).
data/Rakefile CHANGED
@@ -33,7 +33,8 @@ if cucumber?
33
33
  Cucumber::Rake::Task.new(:features) do |t|
34
34
  opts = "features --format junit -o #{CUKE_RESULTS} --format pretty -x"
35
35
  opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
36
- t.cucumber_opts = opts
36
+ opts += " --tags ~@skip"
37
+ t.cucumber_opts = opts
37
38
  t.fork = false
38
39
  end
39
40
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.11.2
1
+ 2.0.0
data/ci/test.sh CHANGED
@@ -2,11 +2,6 @@
2
2
 
3
3
  bundle
4
4
 
5
- # Some tests need to be logged in to the registry, to pull a base
6
- # image if it's not already available. Have entrypoint.sh do something
7
- # simple, and log in as a side effect.
8
- /debify/distrib/entrypoint.sh detect-version
9
-
10
5
  for target in spec cucumber; do
11
6
  bundle exec rake $target
12
7
  done
@@ -6,8 +6,8 @@ require 'conjur/debify/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "conjur-debify"
8
8
  spec.version = Conjur::Debify::VERSION
9
- spec.authors = ["Kevin Gilpin"]
10
- spec.email = ["kgilpin@conjur.net"]
9
+ spec.authors = ["CyberArk Software, Inc."]
10
+ spec.email = ["conj_maintainers@cyberark.com"]
11
11
  spec.summary = %q{Utility commands to build and package Conjur services as Debian packages}
12
12
  spec.homepage = "https://github.com/conjurinc/debify"
13
13
  spec.license = "MIT"
@@ -24,14 +24,14 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.7"
26
26
  spec.add_development_dependency "fakefs", "~> 0"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 12.3.3"
28
28
 
29
29
  # Pin to cucumbe v2. cucumber v3 changes (breaks) the behavior of
30
30
  # unmatched capture groups with \(d+). In v3, the value of such a
31
31
  # group is 0 instead of nil, which breaks aruba's "I successfully
32
32
  # run...." steps.
33
33
  spec.add_development_dependency "cucumber", '~> 2'
34
- spec.add_development_dependency "aruba"
34
+ spec.add_development_dependency "aruba", "~> 0.14"
35
35
  spec.add_development_dependency 'rspec', '~> 3'
36
36
  spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
37
37
  end
@@ -6,17 +6,14 @@ set +x
6
6
 
7
7
  creds=( $(ruby /debify/distrib/conjur_creds.rb) )
8
8
 
9
- # If there are creds, use them to log in to the registry. Then, run
10
- # the magic DockerInDocker wrapper script so debify can interact with
11
- # the Docker daemon.
9
+ # If there are creds, use them to log in to the registry.
12
10
  #
13
- # If there are no creds, just run debify itself. Any commands that do
11
+ # If there are no creds, any commands that do
14
12
  # Docker stuff will fail, but the non-Docker commands (e.g. the config
15
13
  # subcommands) will work fine.
16
14
  if [[ ${#creds[*]} > 0 ]]; then
17
15
  echo -n "${creds[1]}" | docker login registry.tld -u ${creds[0]} --password-stdin >/dev/null 2>&1
18
- exec wrapdocker debify "$@"
19
- else
20
- exec debify "$@"
21
16
  fi
22
17
 
18
+ exec debify "$@"
19
+
@@ -1,17 +1,23 @@
1
+ @skip
1
2
  @announce-output
2
3
  Feature: Packaging
3
4
 
4
5
  Background:
5
- Given I successfully run `env DEBUG=true GLI_DEBUG=true debify package -d ../../example -v 0.0.1 example -- --post-install /distrib/postinstall.sh`
6
+ # We use version 0.0.1-suffix to verify that RPM converts dashes to underscores
7
+ # in the version as we expect
8
+ Given I successfully run `env DEBUG=true GLI_DEBUG=true debify package -d ../../example -v 0.0.1-suffix example -- --post-install /distrib/postinstall.sh`
6
9
 
7
10
  Scenario: 'example' project can be packaged successfully
8
- Then the stdout should contain "conjur-example_0.0.1_amd64.deb"
9
- And the stdout should contain "conjur-example-dev_0.0.1_amd64.deb"
11
+ Then the stdout should contain "conjur-example_0.0.1-suffix_amd64.deb"
12
+ And the stdout should contain "conjur-example-dev_0.0.1-suffix_amd64.deb"
13
+ And the stdout should contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
14
+ And the stdout should contain "conjur-example-dev-0.0.1_suffix-1.x86_64.rpm"
10
15
 
11
16
  Scenario: 'clean' command will delete non-Git-managed files
12
17
  When I successfully run `env DEBUG=true GLI_DEBUG=true debify clean -d ../../example --force`
13
18
  And I successfully run `find ../../example`
14
- Then the stdout from "find ../../example" should not contain "conjur-example_0.0.1_amd64.deb"
15
-
19
+ Then the stdout from "find ../../example" should not contain "conjur-example_0.0.1-suffix_amd64.deb"
20
+ And the stdout from "find ../../example" should not contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
21
+
16
22
  Scenario: 'example' project can be published
17
- When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1 -d ../../example 4.9 example`
23
+ When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1-suffix -d ../../example 4.9 example`
@@ -2,6 +2,10 @@
2
2
  Feature: Running a sandbox
3
3
  Background:
4
4
  Given I successfully run `docker pull registry.tld/conjur-appliance-cuke-master:4.9-stable`
5
+ # The extra containers will use the `alpine` image, so we need to pull it first on the
6
+ # host to use the authenticated DockerHub connection. This avoids hitting DockerHub
7
+ # rate limits.
8
+ And I successfully run `docker pull alpine`
5
9
 
6
10
  Scenario: sandbox for 'example' project be started
7
11
  Given I successfully start a sandbox for "example" with arguments "-t 4.9-stable --no-pull"
@@ -12,11 +12,10 @@ When /^I start a container named "(.*?)"(?: on network "(.*?)")*$/ do |name, net
12
12
  networks << network
13
13
  end
14
14
 
15
- alpine = Docker::Image.create('fromImage' => 'alpine')
16
15
  options = {
17
16
  'name' => name,
18
17
  'Cmd' => [ "sh", "-c", "while true; do sleep 1; done" ],
19
- 'Image' => alpine.id
18
+ 'Image' => 'alpine'
20
19
  }
21
20
  options['HostConfig'] = { 'NetworkMode' => net_name } if net_name
22
21
 
@@ -4,6 +4,7 @@ require 'fileutils'
4
4
  require 'gli'
5
5
  require 'json'
6
6
  require 'base64'
7
+ require 'tmpdir'
7
8
 
8
9
  require 'conjur/debify/utils'
9
10
 
@@ -12,6 +13,8 @@ require 'active_support/core_ext'
12
13
 
13
14
  include GLI::App
14
15
 
16
+ DEFAULT_FILE_TYPE = "deb"
17
+
15
18
  config_file '.debifyrc'
16
19
 
17
20
  desc 'Set an environment variable (e.g. TERM=xterm) when starting a container'
@@ -49,7 +52,7 @@ module DebugMixin
49
52
  if a.length == 2 && a[0].is_a?(Symbol)
50
53
  debug a.last
51
54
  else
52
- a.each do |line|
55
+ a.each do |line|
53
56
  begin
54
57
  line = JSON.parse(line)
55
58
  line.keys.each do |k|
@@ -79,7 +82,7 @@ def detect_version
79
82
  base_version = File.read("VERSION").strip
80
83
  commits_since = `git log #{base_commit}..HEAD --pretty='%h'`.split("\n").size
81
84
  hash = `git rev-parse --short HEAD`.strip
82
- [ [ base_version, commits_since ].join('.'), hash ].join("-")
85
+ [[base_version, commits_since].join('.'), hash].join("-")
83
86
  else
84
87
  `git describe --long --tags --abbrev=7 --match 'v*.*.*' | sed -e 's/^v//'`.strip.tap do |version|
85
88
  raise "No Git version (tag) for project" if version.empty?
@@ -124,15 +127,15 @@ DESC
124
127
  arg_name "project-name -- <fpm-arguments>"
125
128
  command "clean" do |c|
126
129
  c.desc "Set the current working directory"
127
- c.flag [ :d, "dir" ]
130
+ c.flag [:d, "dir"]
128
131
 
129
132
  c.desc "Ignore (don't delete) a file or directory"
130
- c.flag [ :i, :ignore ]
133
+ c.flag [:i, :ignore]
131
134
 
132
135
  c.desc "Force file deletion even if if this doesn't look like a Jenkins environment"
133
- c.switch [ :force ]
136
+ c.switch [:force]
134
137
 
135
- c.action do |global_options,cmd_options,args|
138
+ c.action do |global_options, cmd_options, args|
136
139
  def looks_like_jenkins?
137
140
  require 'etc'
138
141
  Etc.getlogin == 'jenkins' && ENV['BUILD_NUMBER']
@@ -143,10 +146,10 @@ command "clean" do |c|
143
146
  if !perform_deletion
144
147
  $stderr.puts "No --force, and this doesn't look like Jenkins. I won't actually delete anything"
145
148
  end
146
- @ignore_list = Array(cmd_options[:ignore]) + [ '.', '..', '.git' ]
149
+ @ignore_list = Array(cmd_options[:ignore]) + ['.', '..', '.git']
147
150
 
148
151
  def ignore_file? f
149
- @ignore_list.find{|ignore| f.index(ignore) == 0}
152
+ @ignore_list.find { |ignore| f.index(ignore) == 0 }
150
153
  end
151
154
 
152
155
  dir = cmd_options[:dir] || '.'
@@ -159,16 +162,16 @@ command "clean" do |c|
159
162
  end
160
163
  find_files.compact!
161
164
  delete_files = (find_files - git_files)
162
- delete_files.delete_if{|file|
165
+ delete_files.delete_if { |file|
163
166
  File.directory?(file) || ignore_file?(file)
164
167
  }
165
168
  if perform_deletion
166
169
  image = Docker::Image.create 'fromImage' => "alpine:3.3"
167
170
  options = {
168
- 'Cmd' => [ "sh", "-c", "while true; do sleep 1; done" ],
171
+ 'Cmd' => ["sh", "-c", "while true; do sleep 1; done"],
169
172
  'Image' => image.id,
170
173
  'Binds' => [
171
- [ dir, "/src" ].join(':'),
174
+ [dir, "/src"].join(':'),
172
175
  ]
173
176
  }
174
177
  options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
@@ -179,7 +182,7 @@ command "clean" do |c|
179
182
  puts file
180
183
 
181
184
  file = "/src/#{file}"
182
- cmd = [ "rm", "-f", file ]
185
+ cmd = ["rm", "-f", file]
183
186
 
184
187
  stdout, stderr, status = container.exec cmd, &DebugMixin::DOCKER
185
188
  $stderr.puts "Failed to delete #{file}" unless status == 0
@@ -196,6 +199,17 @@ command "clean" do |c|
196
199
  end
197
200
  end
198
201
 
202
+ def copy_packages_from_container(container, package_name, dev_package_name)
203
+ Conjur::Debify::Utils.copy_from_container container, "/src/#{package_name}"
204
+ puts "#{package_name}"
205
+ begin
206
+ Conjur::Debify::Utils.copy_from_container container, "/dev-pkg/#{dev_package_name}"
207
+ puts "#{dev_package_name}"
208
+ rescue Docker::Error::NotFoundError
209
+ warn "#{dev_package_name} not found. The package might not have any development dependencies."
210
+ end
211
+ end
212
+
199
213
  desc "Build a debian package for a project"
200
214
  long_desc <<DESC
201
215
  The package is built using fpm (https://github.com/jordansissel/fpm).
@@ -220,15 +234,21 @@ DESC
220
234
  arg_name "project-name -- <fpm-arguments>"
221
235
  command "package" do |c|
222
236
  c.desc "Set the current working directory"
223
- c.flag [ :d, "dir" ]
237
+ c.flag [:d, "dir"]
238
+
239
+ c.desc "Set the output file type of the fpm command (e.g rpm)"
240
+ c.flag [:o, :output]
224
241
 
225
242
  c.desc "Specify the deb version; by default, it's read from the VERSION file"
226
- c.flag [ :v, :version ]
243
+ c.flag [:v, :version]
227
244
 
228
245
  c.desc "Specify a custom Dockerfile.fpm"
229
- c.flag [ :dockerfile]
246
+ c.flag [:dockerfile]
247
+
248
+ c.desc "Specify files to add to the FPM image that are not included from the git repo"
249
+ c.flag [:'additional-files']
230
250
 
231
- c.action do |global_options,cmd_options,args|
251
+ c.action do |global_options, cmd_options, args|
232
252
  raise "project-name is required" unless project_name = args.shift
233
253
 
234
254
  fpm_args = []
@@ -241,30 +261,52 @@ command "package" do |c|
241
261
  dir = cmd_options[:dir] || '.'
242
262
  pwd = File.dirname(__FILE__)
243
263
 
264
+ additional_files = []
265
+ if cmd_options[:'additional-files']
266
+ additional_files = cmd_options[:'additional-files'].split(',').map(&:strip)
267
+ end
268
+
244
269
  fpm_image = Docker::Image.build_from_dir File.expand_path('fpm', File.dirname(__FILE__)), tag: "debify-fpm", &DebugMixin::DOCKER
245
270
  DebugMixin.debug_write "Built base fpm image '#{fpm_image.id}'\n"
246
271
  dir = File.expand_path(dir)
272
+
247
273
  Dir.chdir dir do
248
274
  version = cmd_options[:version] || detect_version
249
- dockerfile_path = cmd_options[:dockerfile] || File.expand_path("debify/Dockerfile.fpm", pwd)
250
- dockerfile = File.read(dockerfile_path)
251
275
 
252
- output = StringIO.new
253
- Gem::Package::TarWriter.new(output) do |tar|
254
- git_files.each do |fname|
255
- stat = File.stat(fname)
256
- tar.add_file(fname, stat.mode) { |tar_file| tar_file.write(File.read(fname)) }
257
- end
258
- tar.add_file('Dockerfile', 0640) { |tar_file| tar_file.write dockerfile.gsub("@@image@@", fpm_image.id) }
276
+ # move git files and Dockerfile to temp dir to make deb from
277
+ # we do this to avoid adding "non-git" files
278
+ # that aren't mentioned in the dockerignore to the deb
279
+ temp_dir = Dir.mktmpdir
280
+ DebugMixin.debug_write "Copying git files to tmp dir '#{temp_dir}'\n"
281
+ (git_files + additional_files).each do |fname|
282
+ original_file = File.join(dir, fname)
283
+ destination_path = File.join(temp_dir, fname)
284
+ FileUtils.mkdir_p(File.dirname(destination_path))
285
+ FileUtils.cp(original_file, destination_path)
259
286
  end
260
- output.rewind
261
287
 
262
- image = Docker::Image.build_from_tar output, &DebugMixin::DOCKER
288
+ # rename specified dockerfile to 'Dockerfile' during copy, incase name is different
289
+ dockerfile_path = cmd_options[:dockerfile] || File.expand_path("debify/Dockerfile.fpm", pwd)
290
+ temp_dockerfile = File.join(temp_dir, "Dockerfile")
291
+
292
+ # change image variable in specified Dockerfile
293
+ dockerfile = File.read(dockerfile_path)
294
+ replace_image = dockerfile.gsub("@@image@@", fpm_image.id)
295
+ File.open(temp_dockerfile, "w") { |file| file.puts replace_image }
296
+
297
+ # build image from project being debified dir
298
+ image = Docker::Image.build_from_dir temp_dir, &DebugMixin::DOCKER
263
299
 
264
300
  DebugMixin.debug_write "Built fpm image '#{image.id}' for project #{project_name}\n"
265
301
 
302
+ container_cmd_options = [project_name, version]
303
+
304
+ # Set the output file type if present
305
+ file_type = cmd_options[:output] || DEFAULT_FILE_TYPE
306
+ container_cmd_options << "--file-type=#{file_type}"
307
+
266
308
  options = {
267
- 'Cmd' => [ project_name, version ] + fpm_args,
309
+ 'Cmd' => container_cmd_options + fpm_args,
268
310
  'Image' => image.id
269
311
  }
270
312
  options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
@@ -276,15 +318,22 @@ command "package" do |c|
276
318
  status = container.wait
277
319
  raise "Failed to package #{project_name}" unless status['StatusCode'] == 0
278
320
 
279
- pkg = "conjur-#{project_name}_#{version}_amd64.deb"
280
- dev_pkg = "conjur-#{project_name}-dev_#{version}_amd64.deb"
281
- Conjur::Debify::Utils.copy_from_container container, "/src/#{pkg}"
282
- puts "#{pkg}"
283
- begin
284
- Conjur::Debify::Utils.copy_from_container container, "/dev-pkg/#{dev_pkg}"
285
- puts "#{dev_pkg}"
286
- rescue Docker::Error::NotFoundError
287
- warn "#{dev_pkg} not found. The package might not have any development dependencies."
321
+ if file_type == "deb"
322
+ # Copy deb packages
323
+ copy_packages_from_container(
324
+ container,
325
+ "conjur-#{project_name}_#{version}_amd64.deb",
326
+ "conjur-#{project_name}-dev_#{version}_amd64.deb"
327
+ )
328
+ elsif file_type == "rpm"
329
+ # Copy rpm packages
330
+ # The rpm builder replaces dashes with underscores in the version
331
+ rpm_version = version.tr('-', '_')
332
+ copy_packages_from_container(
333
+ container,
334
+ "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm",
335
+ "conjur-#{project_name}-dev-#{rpm_version}-1.x86_64.rpm"
336
+ )
288
337
  end
289
338
  ensure
290
339
  container.delete(force: true)
@@ -308,10 +357,10 @@ end
308
357
 
309
358
  def network_options(cmd)
310
359
  cmd.desc "Specify link for test container"
311
- cmd.flag [ :l, :link ], :multiple => true
312
-
360
+ cmd.flag [:l, :link], :multiple => true
361
+
313
362
  cmd.desc 'Attach to the specified network'
314
- cmd.flag [ :n, :net ]
363
+ cmd.flag [:n, :net]
315
364
  end
316
365
 
317
366
  def short_id(id)
@@ -327,7 +376,7 @@ end
327
376
  # instead. (Docker doesn't add full container ids as network aliases,
328
377
  # only short ids).
329
378
  def shorten_source_id(link)
330
- src,dest = link.split(':')
379
+ src, dest = link.split(':')
331
380
  src && dest ? "#{short_id(src)}:#{dest}" : link
332
381
  end
333
382
 
@@ -377,32 +426,32 @@ DESC
377
426
  arg_name "project-name test-script"
378
427
  command "test" do |c|
379
428
  c.desc "Set the current working directory"
380
- c.flag [ :d, :dir ]
429
+ c.flag [:d, :dir]
381
430
 
382
431
  c.desc "Keep the Conjur appliance container after the command finishes"
383
432
  c.default_value false
384
- c.switch [ :k, :keep ]
433
+ c.switch [:k, :keep]
385
434
 
386
435
  c.desc "Image name"
387
436
  c.default_value "registry.tld/conjur-appliance-cuke-master"
388
- c.flag [ :i, :image ]
437
+ c.flag [:i, :image]
389
438
 
390
439
  c.desc "Image tag, e.g. 4.5-stable, 4.6-stable"
391
- c.flag [ :t, "image-tag"]
440
+ c.flag [:t, "image-tag"]
392
441
 
393
442
  c.desc "'docker pull' the Conjur container image"
394
443
  c.default_value true
395
- c.switch [ :pull ]
444
+ c.switch [:pull]
396
445
 
397
446
  c.desc "Specify the deb version; by default, it's read from the VERSION file"
398
- c.flag [ :v, :version ]
447
+ c.flag [:v, :version]
399
448
 
400
449
  c.desc "Specify volume for test container"
401
- c.flag [ :'volumes-from' ], :multiple => true
450
+ c.flag [:'volumes-from'], :multiple => true
402
451
 
403
452
  network_options(c)
404
-
405
- c.action do |global_options,cmd_options,args|
453
+
454
+ c.action do |global_options, cmd_options, args|
406
455
  raise "project-name is required" unless project_name = args.shift
407
456
  raise "test-script is required" unless test_script = args.shift
408
457
  raise "Received extra command-line arguments" if args.shift
@@ -415,7 +464,7 @@ command "test" do |c|
415
464
 
416
465
  Dir.chdir dir do
417
466
  image_tag = cmd_options["image-tag"] or raise "image-tag is required"
418
- appliance_image_id = [ cmd_options[:image], image_tag ].join(":")
467
+ appliance_image_id = [cmd_options[:image], image_tag].join(":")
419
468
  version = cmd_options[:version] || detect_version
420
469
  package_name = "conjur-#{project_name}_#{version}_amd64.deb"
421
470
  dev_package_name = "conjur-#{project_name}-dev_#{version}_amd64.deb"
@@ -423,7 +472,7 @@ command "test" do |c|
423
472
  raise "#{test_script} does not exist or is not a file" unless File.file?(test_script)
424
473
 
425
474
  begin
426
- tries ||=2
475
+ tries ||= 2
427
476
  Docker::Image.create 'fromImage' => appliance_image_id, &DebugMixin::DOCKER if cmd_options[:pull]
428
477
  rescue
429
478
  login_to_registry appliance_image_id
@@ -462,7 +511,7 @@ RUN touch /etc/service/conjur/down
462
511
  packages << dev_package_name if File.exist? dev_package_name
463
512
 
464
513
  begin
465
- tries ||=2
514
+ tries ||= 2
466
515
  appliance_image = build_test_image(appliance_image_id, project_name, packages)
467
516
  rescue
468
517
  login_to_registry appliance_image_id
@@ -478,34 +527,34 @@ RUN touch /etc/service/conjur/down
478
527
  'Env' => [
479
528
  "CONJUR_AUTHN_LOGIN=admin",
480
529
  "CONJUR_ENV=appliance",
481
- "CONJUR_AUTHN_API_KEY=secret",
482
- "CONJUR_ADMIN_PASSWORD=secret",
530
+ "CONJUR_AUTHN_API_KEY=SEcret12!!!!",
531
+ "CONJUR_ADMIN_PASSWORD=SEcret12!!!!",
483
532
  ] + global_options[:env],
484
533
  'HostConfig' => {
485
534
  'Binds' => [
486
- [ dir, "/src/#{project_name}" ].join(':')
535
+ [dir, "/src/#{project_name}"].join(':')
487
536
  ]
488
537
  }
489
538
  }
490
539
  host_config = options['HostConfig']
491
-
540
+
492
541
  host_config['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
493
542
  host_config['VolumesFrom'] = cmd_options[:'volumes-from'] if cmd_options[:'volumes-from'] && !cmd_options[:'volumes-from'].empty?
494
543
 
495
544
  add_network_config(options, cmd_options)
496
-
545
+
497
546
  if global_options[:'local-bundle']
498
547
  host_config['Binds']
499
- .push([ vendor_dir, "/src/#{project_name}/vendor" ].join(':'))
500
- .push([ dot_bundle_dir, "/src/#{project_name}/.bundle" ].join(':'))
548
+ .push([vendor_dir, "/src/#{project_name}/vendor"].join(':'))
549
+ .push([dot_bundle_dir, "/src/#{project_name}/.bundle"].join(':'))
501
550
  end
502
551
 
503
- container = Docker::Container.create(options.tap {|o| DebugMixin.debug_write "creating container with options #{o.inspect}"})
552
+ container = Docker::Container.create(options.tap { |o| DebugMixin.debug_write "creating container with options #{o.inspect}" })
504
553
 
505
554
  begin
506
555
  DebugMixin.debug_write "Testing #{project_name} in container #{container.id}\n"
507
556
 
508
- spawn("docker logs -f #{container.id}", [ :out, :err ] => $stderr).tap do |pid|
557
+ spawn("docker logs -f #{container.id}", [:out, :err] => $stderr).tap do |pid|
509
558
  Process.detach pid
510
559
  end
511
560
  container.start!
@@ -556,29 +605,29 @@ Once in the container, use "/opt/conjur/evoke/bin/dev-install" to install the de
556
605
  DESC
557
606
  command "sandbox" do |c|
558
607
  c.desc "Set the current working directory"
559
- c.flag [ :d, :dir ]
608
+ c.flag [:d, :dir]
560
609
 
561
610
  c.desc "Image name"
562
611
  c.default_value "registry.tld/conjur-appliance-cuke-master"
563
- c.flag [ :i, :image ]
612
+ c.flag [:i, :image]
564
613
 
565
614
  c.desc "Image tag, e.g. 4.5-stable, 4.6-stable"
566
- c.flag [ :t, "image-tag"]
615
+ c.flag [:t, "image-tag"]
567
616
 
568
617
  c.desc "Bind another source directory into the container. Use <src>:<dest>, where both are full paths."
569
- c.flag [ :"bind" ], :multiple => true
618
+ c.flag [:"bind"], :multiple => true
570
619
 
571
620
  c.desc "'docker pull' the Conjur container image"
572
621
  c.default_value false
573
- c.switch [ :pull ]
622
+ c.switch [:pull]
574
623
 
575
624
  network_options(c)
576
625
 
577
626
  c.desc "Specify volume for container"
578
- c.flag [ :'volumes-from' ], :multiple => true
627
+ c.flag [:'volumes-from'], :multiple => true
579
628
 
580
629
  c.desc "Expose a port from the container to host. Use <host>:<container>."
581
- c.flag [ :p, :port ], :multiple => true
630
+ c.flag [:p, :port], :multiple => true
582
631
 
583
632
  c.desc 'Run dev-install in /src/<project-name>'
584
633
  c.default_value false
@@ -589,9 +638,9 @@ command "sandbox" do |c|
589
638
  c.switch [:kill]
590
639
 
591
640
  c.desc 'A command to run in the sandbox'
592
- c.flag [ :c, :command ]
593
-
594
- c.action do |global_options,cmd_options,args|
641
+ c.flag [:c, :command]
642
+
643
+ c.action do |global_options, cmd_options, args|
595
644
  raise "Received extra command-line arguments" if args.shift
596
645
 
597
646
  dir = cmd_options[:dir] || '.'
@@ -601,11 +650,11 @@ command "sandbox" do |c|
601
650
 
602
651
  Dir.chdir dir do
603
652
  image_tag = cmd_options["image-tag"] or raise "image-tag is required"
604
- appliance_image_id = [ cmd_options[:image], image_tag ].join(":")
653
+ appliance_image_id = [cmd_options[:image], image_tag].join(":")
605
654
 
606
655
  appliance_image = if cmd_options[:pull]
607
656
  begin
608
- tries ||=2
657
+ tries ||= 2
609
658
  Docker::Image.create 'fromImage' => appliance_image_id, &DebugMixin::DOCKER if cmd_options[:pull]
610
659
  rescue
611
660
  login_to_registry appliance_image_id
@@ -628,33 +677,33 @@ command "sandbox" do |c|
628
677
  'Env' => [
629
678
  "CONJUR_AUTHN_LOGIN=admin",
630
679
  "CONJUR_ENV=appliance",
631
- "CONJUR_AUTHN_API_KEY=secret",
632
- "CONJUR_ADMIN_PASSWORD=secret",
680
+ "CONJUR_AUTHN_API_KEY=SEcret12!!!!",
681
+ "CONJUR_ADMIN_PASSWORD=SEcret12!!!!",
633
682
  ] + global_options[:env]
634
683
  }
635
684
 
636
685
  options['HostConfig'] = host_config = {}
637
686
  host_config['Binds'] = [
638
- [ File.expand_path(".ssh/id_rsa", ENV['HOME']), "/root/.ssh/id_rsa", 'ro' ].join(':'),
639
- [ dir, "/src/#{project_name}" ].join(':'),
687
+ [File.expand_path(".ssh/id_rsa", ENV['HOME']), "/root/.ssh/id_rsa", 'ro'].join(':'),
688
+ [dir, "/src/#{project_name}"].join(':'),
640
689
  ] + Array(cmd_options[:bind])
641
690
 
642
691
  if global_options[:'local-bundle']
643
692
  host_config['Binds']
644
- .push([ vendor_dir, "/src/#{project_name}/vendor" ].join(':'))
645
- .push([ dot_bundle_dir, "/src/#{project_name}/.bundle" ].join(':'))
693
+ .push([vendor_dir, "/src/#{project_name}/vendor"].join(':'))
694
+ .push([dot_bundle_dir, "/src/#{project_name}/.bundle"].join(':'))
646
695
  end
647
696
 
648
697
  host_config['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
649
698
  host_config['VolumesFrom'] = cmd_options[:'volumes-from'] unless cmd_options[:'volumes-from'].empty?
650
-
699
+
651
700
  add_network_config(options, cmd_options)
652
701
 
653
702
  unless cmd_options[:port].empty?
654
703
  port_bindings = Hash.new({})
655
704
  cmd_options[:port].each do |mapping|
656
705
  hport, cport = mapping.split(':')
657
- port_bindings["#{cport}/tcp"] = [{ 'HostPort' => hport }]
706
+ port_bindings["#{cport}/tcp"] = [{'HostPort' => hport}]
658
707
  end
659
708
  host_config['PortBindings'] = port_bindings
660
709
  end
@@ -664,7 +713,7 @@ command "sandbox" do |c|
664
713
  previous.delete(:force => true) if previous
665
714
  end
666
715
 
667
- container = Docker::Container.create(options.tap {|o| DebugMixin.debug_write "creating container with options #{o.inspect}"})
716
+ container = Docker::Container.create(options.tap { |o| DebugMixin.debug_write "creating container with options #{o.inspect}" })
668
717
  $stdout.puts container.id
669
718
  container.start!
670
719
 
@@ -700,23 +749,27 @@ DESC
700
749
  arg_name "distribution project-name"
701
750
  command "publish" do |c|
702
751
  c.desc "Set the current working directory"
703
- c.flag [ :d, :dir ]
752
+ c.flag [:d, :dir]
704
753
 
705
754
  c.desc "Specify the deb package version; by default, it's computed automatically"
706
- c.flag [ :v, :version ]
755
+ c.flag [:v, :version]
707
756
 
708
757
  c.desc "Component to publish to, either 'stable' or the name of the git branch"
709
- c.flag [ :c, :component ]
758
+ c.flag [:c, :component]
710
759
 
711
760
  c.desc "Artifactory URL to publish to"
712
761
  c.default_value "https://conjurinc.jfrog.io/conjurinc"
713
- c.flag [ :u, :url]
762
+ c.flag [:u, :url]
714
763
 
715
764
  c.desc "Artifactory Debian repo to publish package to"
716
765
  c.default_value "debian-private"
717
- c.flag [ :r, :repo]
766
+ c.flag [:r, :repo]
767
+
768
+ c.desc "Artifactory RPM repo to publish package to"
769
+ c.default_value "redhat-private"
770
+ c.flag ['rpm-repo']
718
771
 
719
- c.action do |global_options,cmd_options,args|
772
+ c.action do |global_options, cmd_options, args|
720
773
  require 'conjur/debify/action/publish'
721
774
  raise "distribution is required" unless distribution = args.shift
722
775
  raise "project-name is required" unless project_name = args.shift
@@ -729,8 +782,8 @@ end
729
782
  desc "Auto-detect and print the repository version"
730
783
  command "detect-version" do |c|
731
784
  c.desc "Set the current working directory"
732
- c.flag [ :d, :dir ]
733
- c.action do |global_options,cmd_options,args|
785
+ c.flag [:d, :dir]
786
+ c.action do |global_options, cmd_options, args|
734
787
  raise "Received extra command-line arguments" if args.shift
735
788
 
736
789
  dir = cmd_options[:dir] || '.'
@@ -747,7 +800,7 @@ end
747
800
  desc 'Show the given configuration'
748
801
  arg_name 'configuration'
749
802
  command 'config' do |c|
750
- c.action do |_,_,args|
803
+ c.action do |_, _, args|
751
804
  raise 'no configuration provided' unless config = args.shift
752
805
  raise "Received extra command-line arguments" if args.shift
753
806
 
@@ -758,7 +811,7 @@ command 'config' do |c|
758
811
  end
759
812
 
760
813
 
761
- pre do |global,command,options,args|
814
+ pre do |global, command, options, args|
762
815
  # Pre logic here
763
816
  # Return true to proceed; false to abort and not call the
764
817
  # chosen command
@@ -767,7 +820,7 @@ pre do |global,command,options,args|
767
820
  true
768
821
  end
769
822
 
770
- post do |global,command,options,args|
823
+ post do |global, command, options, args|
771
824
  # Post logic here
772
825
  # Use skips_post before a command to skip this
773
826
  # block on that command only
@@ -25,14 +25,12 @@ module Conjur::Debify
25
25
 
26
26
  Dir.chdir dir do
27
27
  version = cmd_options[:version] || detect_version
28
- component = cmd_options[:component] || detect_component
29
- package_name = "conjur-#{project_name}_#{version}_amd64.deb"
30
28
 
31
29
  publish_image = create_image
32
30
  DebugMixin.debug_write "Built base publish image '#{publish_image.id}'\n"
33
31
 
34
32
  art_url = cmd_options[:url]
35
- art_repo = cmd_options[:repo]
33
+ deb_art_repo = cmd_options[:repo]
36
34
 
37
35
  art_user = ENV['ARTIFACTORY_USER']
38
36
  art_password = ENV['ARTIFACTORY_PASSWORD']
@@ -40,23 +38,35 @@ module Conjur::Debify
40
38
  art_user, art_password = fetch_art_creds
41
39
  end
42
40
 
43
- options = {
44
- 'Image' => publish_image.id,
45
- 'Cmd' => [
46
- "jfrog", "rt", "upload",
47
- "--url", art_url,
48
- "--user", art_user,
49
- "--password", art_password,
50
- "--deb", "#{distribution}/#{component}/amd64",
51
- package_name, "#{art_repo}/"
52
- ],
53
- 'Binds' => [
54
- [ dir, "/src" ].join(':')
55
- ]
56
- }
57
- options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
58
-
59
- publish(options)
41
+ # Publish deb package
42
+ component = cmd_options[:component] || detect_component
43
+ deb_info = "#{distribution}/#{component}/amd64"
44
+ package_name = "conjur-#{project_name}_#{version}_amd64.deb"
45
+ publish_package(
46
+ publish_image: publish_image,
47
+ art_url: art_url,
48
+ art_user: art_user,
49
+ art_password: art_password,
50
+ art_repo: deb_art_repo,
51
+ package_name: package_name,
52
+ dir: dir,
53
+ deb_info: deb_info
54
+ )
55
+
56
+ # Publish RPM package
57
+ # The rpm builder replaces dashes with underscores in the version
58
+ rpm_version = version.tr('-', '_')
59
+ package_name = "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm"
60
+ rpm_art_repo = cmd_options['rpm-repo']
61
+ publish_package(
62
+ publish_image: publish_image,
63
+ art_url: art_url,
64
+ art_user: art_user,
65
+ art_password: art_password,
66
+ art_repo: rpm_art_repo,
67
+ package_name: package_name,
68
+ dir: dir
69
+ )
60
70
  end
61
71
  end
62
72
 
@@ -77,6 +87,39 @@ module Conjur::Debify
77
87
  [conjur.resource(username_var).value, conjur.resource(password_var).value]
78
88
  end
79
89
 
90
+ def publish_package(
91
+ publish_image:,
92
+ art_url:,
93
+ art_user:,
94
+ art_password:,
95
+ art_repo:,
96
+ package_name:,
97
+ dir:,
98
+ deb_info: nil
99
+ )
100
+
101
+ cmd_args = [
102
+ "jfrog", "rt", "upload",
103
+ "--url", art_url,
104
+ "--user", art_user,
105
+ "--password", art_password,
106
+ ]
107
+
108
+ cmd_args += ["--deb", deb_info] if deb_info
109
+ cmd_args += [package_name, "#{art_repo}/"]
110
+
111
+ options = {
112
+ 'Image' => publish_image.id,
113
+ 'Cmd' => cmd_args,
114
+ 'Binds' => [
115
+ [ dir, "/src" ].join(':')
116
+ ]
117
+ }
118
+ options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
119
+
120
+ publish(options)
121
+ end
122
+
80
123
  def publish(options)
81
124
  container = Docker::Container.create(options)
82
125
  begin
@@ -1,22 +1,24 @@
1
1
  # Build from the same version of ubuntu as phusion/baseimage
2
- FROM ubuntu:18.04
2
+ FROM cyberark/phusion-ruby-fips:0.11-latest
3
3
 
4
4
  RUN apt-get update -y && \
5
- apt-get install -y software-properties-common && \
6
- apt-add-repository -y ppa:brightbox/ruby-ng && \
7
- apt-get update -y && \
8
- apt-get install -y build-essential git libpq5 libpq-dev ruby2.6 ruby2.6-dev libffi-dev
5
+ apt-get dist-upgrade -y && \
6
+ apt-get install -y build-essential \
7
+ git \
8
+ libffi-dev \
9
+ rpm
9
10
 
10
- RUN gem install --no-document bundler:2.0.2 fpm
11
+ RUN gem install --no-document bundler:1.17.3 \
12
+ fpm
11
13
 
12
14
  ENV GEM_HOME /usr/local/bundle
13
15
  ENV BUNDLE_PATH="$GEM_HOME" \
14
- BUNDLE_BIN="$GEM_HOME/bin" \
15
- BUNDLE_SILENCE_ROOT_WARNING=1 \
16
- BUNDLE_APP_CONFIG="$GEM_HOME"
16
+ BUNDLE_BIN="$GEM_HOME/bin" \
17
+ BUNDLE_SILENCE_ROOT_WARNING=1 \
18
+ BUNDLE_APP_CONFIG="$GEM_HOME"
17
19
  ENV PATH $BUNDLE_BIN:$PATH
18
- RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
19
- && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
20
+ RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && \
21
+ chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
20
22
 
21
23
  RUN mkdir /src
22
24
 
@@ -8,19 +8,34 @@ version=$1
8
8
  shift
9
9
 
10
10
  if [ -z "$project_name" ]; then
11
- echo Project name argument is required
12
- exit 1
11
+ echo Project name argument is required
12
+ exit 1
13
13
  fi
14
14
  if [ -z "$version" ]; then
15
- echo Version argument is required
16
- exit 1
15
+ echo Version argument is required
16
+ exit 1
17
17
  fi
18
18
 
19
- package_name=conjur-"$project_name"_"$version"_amd64.deb
20
- dev_package_name=conjur-"$project_name"-dev_"$version"_amd64.deb
19
+ for i in "$@"; do
20
+ case $i in
21
+ -ft=* | --file-type=*)
22
+ file_type="${i#*=}"
23
+ shift
24
+ ;;
25
+ esac
26
+ done
27
+
28
+ if [ -z "$file_type" ]; then
29
+ echo "No file type given. Using deb"
30
+ file_type=deb
31
+ fi
32
+
33
+ echo Project Name is $project_name
34
+ echo Version is $version
35
+ echo file_type is $file_type
36
+ echo params at the end are $@
21
37
 
22
38
  # Build dev package first
23
- echo Building $dev_package_name
24
39
  prefix=/src/opt/conjur/project
25
40
  cp -al $prefix /dev-pkg
26
41
  cd $prefix
@@ -31,24 +46,29 @@ cd /dev-pkg
31
46
  remove_matching $prefix
32
47
  bundle_clean
33
48
 
34
- if [ `ls | wc -l` -eq 0 ]; then
49
+ if [ $(ls | wc -l) -eq 0 ]; then
35
50
  echo No dev dependencies, skipping dev package
36
51
  else
37
- fpm -s dir -t deb -n conjur-$project_name-dev -v $version -C . \
38
- --maintainer "Conjur Inc." \
39
- --vendor "Conjur Inc." \
52
+ echo "Building conjur-$project_name-dev $file_type package"
53
+
54
+ fpm \
55
+ -s dir \
56
+ -t $file_type \
57
+ -n conjur-$project_name-dev \
58
+ -v $version \
59
+ -C . \
60
+ --maintainer "CyberArk Software, Inc." \
61
+ --vendor "CyberArk Software, Inc." \
40
62
  --license "Proprietary" \
41
- --url "https://www.conjur.net" \
63
+ --url "https://www.cyberark.com" \
42
64
  --deb-no-default-config-files \
43
- --deb-user conjur \
44
- --deb-group conjur \
65
+ --$file_type-user conjur \
66
+ --$file_type-group conjur \
45
67
  --depends "conjur-$project_name = $version" \
46
68
  --prefix /opt/conjur/$project_name \
47
69
  --description "Conjur $project_name service - development files"
48
70
  fi
49
71
 
50
- echo Building $package_name
51
-
52
72
  mv /src/opt/conjur/project /src/opt/conjur/$project_name
53
73
 
54
74
  cd /src/opt/conjur/$project_name
@@ -63,16 +83,23 @@ mkdir -p opt/conjur/etc
63
83
 
64
84
  [ -d opt/conjur/"$project_name"/distrib ] && mv opt/conjur/"$project_name"/distrib /
65
85
 
66
- fpm -s dir -t deb -n conjur-$project_name -v $version -C . \
67
- --maintainer "Conjur Inc." \
68
- --vendor "Conjur Inc." \
69
- --license "Proprietary" \
70
- --url "https://www.conjur.net" \
71
- --deb-no-default-config-files \
72
- --config-files opt/conjur/etc \
73
- --deb-user conjur \
74
- --deb-group conjur \
75
- --description "Conjur $project_name service" \
76
- "$@"
77
-
78
- ls -al *.deb
86
+ echo "Building conjur-$project_name-dev $file_type package"
87
+
88
+ fpm \
89
+ -s dir \
90
+ -t $file_type \
91
+ -n conjur-$project_name \
92
+ -v $version \
93
+ -C . \
94
+ --maintainer "CyberArk Software, Inc." \
95
+ --vendor "CyberArk Software, Inc." \
96
+ --license "Proprietary" \
97
+ --url "https://www.cyberark.com" \
98
+ --config-files opt/conjur/etc \
99
+ --deb-no-default-config-files \
100
+ --$file_type-user conjur \
101
+ --$file_type-group conjur \
102
+ --description "Conjur $project_name service" \
103
+ "$@"
104
+
105
+ ls -l
@@ -31,8 +31,8 @@ describe Conjur::Debify::Action::Publish do
31
31
  end
32
32
 
33
33
  it 'runs' do
34
- expect(action).to receive(:publish)
35
-
34
+ expect(action).to receive(:publish).twice
35
+
36
36
  action.run
37
37
  end
38
38
 
@@ -42,8 +42,8 @@ describe Conjur::Debify::Action::Publish do
42
42
 
43
43
  it 'runs' do
44
44
  expect(action).to receive(:fetch_art_creds)
45
- expect(action).to receive(:publish)
46
-
45
+ expect(action).to receive(:publish).twice
46
+
47
47
  action.run
48
48
  end
49
49
  end
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.11.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Kevin Gilpin
7
+ - CyberArk Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-03 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '10.0'
103
+ version: 12.3.3
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '10.0'
110
+ version: 12.3.3
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: cucumber
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: aruba
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '0.14'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '0.14'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +166,7 @@ dependencies:
166
166
  version: '1.0'
167
167
  description:
168
168
  email:
169
- - kgilpin@conjur.net
169
+ - conj_maintainers@cyberark.com
170
170
  executables:
171
171
  - debify
172
172
  extensions: []
@@ -177,6 +177,7 @@ files:
177
177
  - ".project"
178
178
  - ".rvmrc"
179
179
  - CHANGELOG.md
180
+ - CONTRIBUTING.md
180
181
  - Dockerfile
181
182
  - Gemfile
182
183
  - Jenkinsfile
@@ -249,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
250
  - !ruby/object:Gem::Version
250
251
  version: '0'
251
252
  requirements: []
252
- rubygems_version: 3.0.3
253
+ rubygems_version: 3.1.2
253
254
  signing_key:
254
255
  specification_version: 4
255
256
  summary: Utility commands to build and package Conjur services as Debian packages