conjur-debify 1.11.1 → 1.12.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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +48 -1
- data/CONTRIBUTING.md +16 -0
- data/Dockerfile +4 -2
- data/Jenkinsfile +23 -3
- data/LICENSE.txt +1 -1
- data/README.md +8 -5
- data/VERSION +1 -1
- data/debify.gemspec +4 -4
- data/features/package.feature +11 -6
- data/lib/conjur/debify.rb +71 -31
- data/lib/conjur/debify/action/publish.rb +63 -20
- data/lib/conjur/fpm/Dockerfile +13 -17
- data/lib/conjur/fpm/package.sh +34 -20
- data/spec/action/publish_spec.rb +4 -4
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b5fa10a6d866735c45f5edfd2a9defcc685ebe502c8950b219b6a8bc22ed232
|
4
|
+
data.tar.gz: 169e5c66e12fe3533c778255b337ad64b323f35cbc298f8e39c00e7abe765b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9326cdb7fd4efafc3db3dda92e6a313cfc504dc34a24450be1076078cc8124b93c8f8ab781f59434cf625c4a37e2a1e8e6b1ead7466a7df00c2de7e3c3cca30
|
7
|
+
data.tar.gz: 8aae92edeacc8a8ffecaa7bbe4bf09cbb0a0f797b40c4cc8e52e4b9999cd7f607a58a913334e5f82cdcabfe07cc94ab2803bce65b3e99e0b84a0ed23d56824d6
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,55 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
# 1.12.0
|
4
|
+
|
5
|
+
### Added
|
6
|
+
- Debify now packages and publishes an RPM file, alongside a debian file.
|
7
|
+
[conjurinc/debify#49](https://github.com/conjurinc/debify/pull/49)
|
8
|
+
- `debify package` now offers an `--additional-files` flag to provide a comma
|
9
|
+
separated list of files to include in the FPM build that are not provided
|
10
|
+
automatically by `git ls-files`.
|
11
|
+
[conjurinc/debify#52](https://github.com/conjurinc/debify/pull/52)
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
- Bug causing `all` files in the git repo to be added to the debian file.
|
15
|
+
[conjurinc/debify#50](https://github.com/conjurinc/debify/pull/50)
|
16
|
+
|
17
|
+
# 1.11.5
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
* Updated FPM and Test images to use a base image with FIPS-compliant Ruby and OpenSSL.
|
21
|
+
|
22
|
+
# 1.11.4
|
23
|
+
|
24
|
+
* Updated sandbox password to match Conjur password complexity requirements.
|
25
|
+
|
26
|
+
# 1.11.3
|
27
|
+
|
28
|
+
* Reverted to `bundler` v1. `bundler` v2 was creating incompatible paths for downstream
|
29
|
+
packages.
|
30
|
+
* Made FPM Ruby version use `ruby2.5` instead of `ruby2.6` since that is what
|
31
|
+
our appliance image uses otherwise the gems bundled in the packages are unusable.
|
32
|
+
|
33
|
+
# 1.11.2
|
34
|
+
|
35
|
+
* Upgraded to use Ruby 2.6 and latest version of FPM
|
36
|
+
* Update Conjur Dockerfile from Ubuntu 14.04 --> 18.04 as 14.04 repos
|
37
|
+
are now behind a [pay wall](https://ubuntu.com/blog/ubuntu-14-04-esm-support)
|
38
|
+
Ruby is installed from `ppa:brightbox/ruby-ng` however that PPA
|
39
|
+
[doesn't currently supply ruby2.2 for Ubuntu 18.04](https://launchpad.net/~brightbox/+archive/ubuntu/ruby-ng?field.series_filter=bionic). [The documentation](https://www.brightbox.com/docs/ruby/ubuntu/)
|
40
|
+
suggests this combination is available, so it may be a temporary problem.
|
41
|
+
To work around the problem, ruby is bumped from 2.2 to 2.3 as 2.3 is the oldest
|
42
|
+
version available for Ubuntu 18.04.
|
43
|
+
|
44
|
+
# 1.11.1
|
45
|
+
|
46
|
+
* Upgrade `docker-debify` to use Ruby 2.6.
|
47
|
+
|
1
48
|
# 1.11.0
|
2
49
|
|
3
50
|
* Use a Docker env-file (docker.env, by default) to pass environment
|
4
51
|
variables to the debify container.
|
5
|
-
|
52
|
+
|
6
53
|
* Make sure `--env` variables get passed along to the Conjur container when testing, too.
|
7
54
|
|
8
55
|
# 1.10.3
|
data/CONTRIBUTING.md
ADDED
@@ -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,4 +1,4 @@
|
|
1
|
-
FROM ruby:2.6
|
1
|
+
FROM ruby:2.6-stretch
|
2
2
|
|
3
3
|
### DockerInDocker support is take from
|
4
4
|
### https://github.com/jpetazzo/dind/blob/master/Dockerfile . I
|
@@ -7,7 +7,9 @@ FROM ruby:2.6
|
|
7
7
|
### docker:dind image much more complicated and didn't lend itself to
|
8
8
|
### also running ruby.
|
9
9
|
|
10
|
-
RUN apt-get update -qq &&
|
10
|
+
RUN apt-get update -qq && \
|
11
|
+
apt-get dist-upgrade -qqy && \
|
12
|
+
apt-get install -qqy \
|
11
13
|
apt-transport-https \
|
12
14
|
ca-certificates \
|
13
15
|
curl \
|
data/Jenkinsfile
CHANGED
@@ -9,6 +9,10 @@ pipeline {
|
|
9
9
|
skipDefaultCheckout()
|
10
10
|
}
|
11
11
|
|
12
|
+
triggers {
|
13
|
+
cron(getDailyCronString())
|
14
|
+
}
|
15
|
+
|
12
16
|
stages {
|
13
17
|
stage('Checkout') {
|
14
18
|
steps {
|
@@ -28,6 +32,23 @@ pipeline {
|
|
28
32
|
}
|
29
33
|
}
|
30
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
|
+
|
31
52
|
stage('Run feature tests') {
|
32
53
|
steps {
|
33
54
|
sh './test.sh'
|
@@ -45,11 +66,10 @@ pipeline {
|
|
45
66
|
}
|
46
67
|
|
47
68
|
stage('Publish to RubyGems') {
|
48
|
-
agent { label 'releaser-v2' }
|
49
69
|
when {
|
50
70
|
allOf {
|
51
71
|
branch 'master'
|
52
|
-
expression {
|
72
|
+
/* expression {
|
53
73
|
boolean publish = false
|
54
74
|
|
55
75
|
try {
|
@@ -62,7 +82,7 @@ pipeline {
|
|
62
82
|
}
|
63
83
|
|
64
84
|
return publish
|
65
|
-
}
|
85
|
+
}*/
|
66
86
|
}
|
67
87
|
}
|
68
88
|
|
data/LICENSE.txt
CHANGED
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
|
-
|
297
|
-
|
298
|
-
|
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.12.0
|
data/debify.gemspec
CHANGED
@@ -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 = ["
|
10
|
-
spec.email = ["
|
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", "~>
|
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
|
data/features/package.feature
CHANGED
@@ -2,16 +2,21 @@
|
|
2
2
|
Feature: Packaging
|
3
3
|
|
4
4
|
Background:
|
5
|
-
|
5
|
+
# We use version 0.0.1-suffix to verify that RPM converts dashes to underscores
|
6
|
+
# in the version as we expect
|
7
|
+
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
8
|
|
7
9
|
Scenario: 'example' project can be packaged successfully
|
8
|
-
Then the stdout should contain "conjur-example_0.0.
|
9
|
-
And the stdout should contain "conjur-example-dev_0.0.
|
10
|
+
Then the stdout should contain "conjur-example_0.0.1-suffix_amd64.deb"
|
11
|
+
And the stdout should contain "conjur-example-dev_0.0.1-suffix_amd64.deb"
|
12
|
+
And the stdout should contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
|
13
|
+
And the stdout should contain "conjur-example-dev-0.0.1_suffix-1.x86_64.rpm"
|
10
14
|
|
11
15
|
Scenario: 'clean' command will delete non-Git-managed files
|
12
16
|
When I successfully run `env DEBUG=true GLI_DEBUG=true debify clean -d ../../example --force`
|
13
17
|
And I successfully run `find ../../example`
|
14
|
-
Then the stdout from "find ../../example" should not contain "conjur-example_0.0.
|
15
|
-
|
18
|
+
Then the stdout from "find ../../example" should not contain "conjur-example_0.0.1-suffix_amd64.deb"
|
19
|
+
And the stdout from "find ../../example" should not contain "conjur-example-0.0.1_suffix-1.x86_64.rpm"
|
20
|
+
|
16
21
|
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`
|
22
|
+
When I successfully run `env DEBUG=true GLI_DEBUG=true debify publish -v 0.0.1-suffix -d ../../example 4.9 example`
|
data/lib/conjur/debify.rb
CHANGED
@@ -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
|
|
@@ -196,6 +197,17 @@ command "clean" do |c|
|
|
196
197
|
end
|
197
198
|
end
|
198
199
|
|
200
|
+
def copy_packages_from_container(container, package_name, dev_package_name)
|
201
|
+
Conjur::Debify::Utils.copy_from_container container, "/src/#{package_name}"
|
202
|
+
puts "#{package_name}"
|
203
|
+
begin
|
204
|
+
Conjur::Debify::Utils.copy_from_container container, "/dev-pkg/#{dev_package_name}"
|
205
|
+
puts "#{dev_package_name}"
|
206
|
+
rescue Docker::Error::NotFoundError
|
207
|
+
warn "#{dev_package_name} not found. The package might not have any development dependencies."
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
199
211
|
desc "Build a debian package for a project"
|
200
212
|
long_desc <<DESC
|
201
213
|
The package is built using fpm (https://github.com/jordansissel/fpm).
|
@@ -228,6 +240,9 @@ command "package" do |c|
|
|
228
240
|
c.desc "Specify a custom Dockerfile.fpm"
|
229
241
|
c.flag [ :dockerfile]
|
230
242
|
|
243
|
+
c.desc "Specify files to add to the FPM image that are not included from the git repo"
|
244
|
+
c.flag [ :'additional-files' ]
|
245
|
+
|
231
246
|
c.action do |global_options,cmd_options,args|
|
232
247
|
raise "project-name is required" unless project_name = args.shift
|
233
248
|
|
@@ -241,25 +256,41 @@ command "package" do |c|
|
|
241
256
|
dir = cmd_options[:dir] || '.'
|
242
257
|
pwd = File.dirname(__FILE__)
|
243
258
|
|
259
|
+
additional_files = []
|
260
|
+
if cmd_options[:'additional-files']
|
261
|
+
additional_files = cmd_options[:'additional-files'].split(',').map(&:strip)
|
262
|
+
end
|
263
|
+
|
244
264
|
fpm_image = Docker::Image.build_from_dir File.expand_path('fpm', File.dirname(__FILE__)), tag: "debify-fpm", &DebugMixin::DOCKER
|
245
265
|
DebugMixin.debug_write "Built base fpm image '#{fpm_image.id}'\n"
|
246
266
|
dir = File.expand_path(dir)
|
267
|
+
|
247
268
|
Dir.chdir dir do
|
248
269
|
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
270
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
271
|
+
# move git files and Dockerfile to temp dir to make deb from
|
272
|
+
# we do this to avoid adding "non-git" files
|
273
|
+
# that aren't mentioned in the dockerignore to the deb
|
274
|
+
temp_dir = Dir.mktmpdir
|
275
|
+
DebugMixin.debug_write "Copying git files to tmp dir '#{temp_dir}'\n"
|
276
|
+
(git_files + additional_files).each do |fname|
|
277
|
+
original_file = File.join(dir, fname)
|
278
|
+
destination_path = File.join(temp_dir, fname)
|
279
|
+
FileUtils.mkdir_p(File.dirname(destination_path))
|
280
|
+
FileUtils.cp(original_file, destination_path)
|
259
281
|
end
|
260
|
-
|
282
|
+
|
283
|
+
# rename specified dockerfile to 'Dockerfile' during copy, incase name is different
|
284
|
+
dockerfile_path = cmd_options[:dockerfile] || File.expand_path("debify/Dockerfile.fpm", pwd)
|
285
|
+
temp_dockerfile = File.join(temp_dir, "Dockerfile")
|
286
|
+
|
287
|
+
# change image variable in specified Dockerfile
|
288
|
+
dockerfile = File.read(dockerfile_path)
|
289
|
+
replace_image = dockerfile.gsub("@@image@@", fpm_image.id)
|
290
|
+
File.open(temp_dockerfile, "w") {|file| file.puts replace_image}
|
261
291
|
|
262
|
-
image
|
292
|
+
# build image from project being debified dir
|
293
|
+
image = Docker::Image.build_from_dir temp_dir, &DebugMixin::DOCKER
|
263
294
|
|
264
295
|
DebugMixin.debug_write "Built fpm image '#{image.id}' for project #{project_name}\n"
|
265
296
|
|
@@ -276,16 +307,21 @@ command "package" do |c|
|
|
276
307
|
status = container.wait
|
277
308
|
raise "Failed to package #{project_name}" unless status['StatusCode'] == 0
|
278
309
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
310
|
+
# Copy deb packages
|
311
|
+
copy_packages_from_container(
|
312
|
+
container,
|
313
|
+
"conjur-#{project_name}_#{version}_amd64.deb",
|
314
|
+
"conjur-#{project_name}-dev_#{version}_amd64.deb"
|
315
|
+
)
|
316
|
+
|
317
|
+
# Copy rpm packages
|
318
|
+
# The rpm builder replaces dashes with underscores in the version
|
319
|
+
rpm_version = version.tr('-', '_')
|
320
|
+
copy_packages_from_container(
|
321
|
+
container,
|
322
|
+
"conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm",
|
323
|
+
"conjur-#{project_name}-dev-#{rpm_version}-1.x86_64.rpm"
|
324
|
+
)
|
289
325
|
ensure
|
290
326
|
container.delete(force: true)
|
291
327
|
end
|
@@ -309,7 +345,7 @@ end
|
|
309
345
|
def network_options(cmd)
|
310
346
|
cmd.desc "Specify link for test container"
|
311
347
|
cmd.flag [ :l, :link ], :multiple => true
|
312
|
-
|
348
|
+
|
313
349
|
cmd.desc 'Attach to the specified network'
|
314
350
|
cmd.flag [ :n, :net ]
|
315
351
|
end
|
@@ -401,7 +437,7 @@ command "test" do |c|
|
|
401
437
|
c.flag [ :'volumes-from' ], :multiple => true
|
402
438
|
|
403
439
|
network_options(c)
|
404
|
-
|
440
|
+
|
405
441
|
c.action do |global_options,cmd_options,args|
|
406
442
|
raise "project-name is required" unless project_name = args.shift
|
407
443
|
raise "test-script is required" unless test_script = args.shift
|
@@ -478,8 +514,8 @@ RUN touch /etc/service/conjur/down
|
|
478
514
|
'Env' => [
|
479
515
|
"CONJUR_AUTHN_LOGIN=admin",
|
480
516
|
"CONJUR_ENV=appliance",
|
481
|
-
"CONJUR_AUTHN_API_KEY=
|
482
|
-
"CONJUR_ADMIN_PASSWORD=
|
517
|
+
"CONJUR_AUTHN_API_KEY=SEcret12!!!!",
|
518
|
+
"CONJUR_ADMIN_PASSWORD=SEcret12!!!!",
|
483
519
|
] + global_options[:env],
|
484
520
|
'HostConfig' => {
|
485
521
|
'Binds' => [
|
@@ -488,12 +524,12 @@ RUN touch /etc/service/conjur/down
|
|
488
524
|
}
|
489
525
|
}
|
490
526
|
host_config = options['HostConfig']
|
491
|
-
|
527
|
+
|
492
528
|
host_config['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
|
493
529
|
host_config['VolumesFrom'] = cmd_options[:'volumes-from'] if cmd_options[:'volumes-from'] && !cmd_options[:'volumes-from'].empty?
|
494
530
|
|
495
531
|
add_network_config(options, cmd_options)
|
496
|
-
|
532
|
+
|
497
533
|
if global_options[:'local-bundle']
|
498
534
|
host_config['Binds']
|
499
535
|
.push([ vendor_dir, "/src/#{project_name}/vendor" ].join(':'))
|
@@ -590,7 +626,7 @@ command "sandbox" do |c|
|
|
590
626
|
|
591
627
|
c.desc 'A command to run in the sandbox'
|
592
628
|
c.flag [ :c, :command ]
|
593
|
-
|
629
|
+
|
594
630
|
c.action do |global_options,cmd_options,args|
|
595
631
|
raise "Received extra command-line arguments" if args.shift
|
596
632
|
|
@@ -628,8 +664,8 @@ command "sandbox" do |c|
|
|
628
664
|
'Env' => [
|
629
665
|
"CONJUR_AUTHN_LOGIN=admin",
|
630
666
|
"CONJUR_ENV=appliance",
|
631
|
-
"CONJUR_AUTHN_API_KEY=
|
632
|
-
"CONJUR_ADMIN_PASSWORD=
|
667
|
+
"CONJUR_AUTHN_API_KEY=SEcret12!!!!",
|
668
|
+
"CONJUR_ADMIN_PASSWORD=SEcret12!!!!",
|
633
669
|
] + global_options[:env]
|
634
670
|
}
|
635
671
|
|
@@ -647,7 +683,7 @@ command "sandbox" do |c|
|
|
647
683
|
|
648
684
|
host_config['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
|
649
685
|
host_config['VolumesFrom'] = cmd_options[:'volumes-from'] unless cmd_options[:'volumes-from'].empty?
|
650
|
-
|
686
|
+
|
651
687
|
add_network_config(options, cmd_options)
|
652
688
|
|
653
689
|
unless cmd_options[:port].empty?
|
@@ -716,6 +752,10 @@ command "publish" do |c|
|
|
716
752
|
c.default_value "debian-private"
|
717
753
|
c.flag [ :r, :repo]
|
718
754
|
|
755
|
+
c.desc "Artifactory RPM repo to publish package to"
|
756
|
+
c.default_value "redhat-private"
|
757
|
+
c.flag ['rpm-repo']
|
758
|
+
|
719
759
|
c.action do |global_options,cmd_options,args|
|
720
760
|
require 'conjur/debify/action/publish'
|
721
761
|
raise "distribution is required" unless distribution = args.shift
|
@@ -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
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
data/lib/conjur/fpm/Dockerfile
CHANGED
@@ -1,27 +1,24 @@
|
|
1
1
|
# Build from the same version of ubuntu as phusion/baseimage
|
2
|
-
FROM
|
2
|
+
FROM cyberark/phusion-ruby-fips:0.11-latest
|
3
3
|
|
4
4
|
RUN apt-get update -y && \
|
5
|
-
apt-get
|
6
|
-
apt-
|
7
|
-
|
8
|
-
|
5
|
+
apt-get dist-upgrade -y && \
|
6
|
+
apt-get install -y build-essential \
|
7
|
+
git \
|
8
|
+
libffi-dev \
|
9
|
+
rpm
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
# https://github.com/docker-library/ruby/commit/c88f3a67da720bfa9fb1717960d90fd5db11c757
|
13
|
-
ENV BUNDLER_VERSION 1.11.2
|
14
|
-
|
15
|
-
RUN gem install --no-rdoc --no-ri bundler:$BUNDLER_VERSION ruby-xz:0.2.3 fpm
|
11
|
+
RUN gem install --no-document bundler:1.17.3 \
|
12
|
+
fpm
|
16
13
|
|
17
14
|
ENV GEM_HOME /usr/local/bundle
|
18
15
|
ENV BUNDLE_PATH="$GEM_HOME" \
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
BUNDLE_BIN="$GEM_HOME/bin" \
|
17
|
+
BUNDLE_SILENCE_ROOT_WARNING=1 \
|
18
|
+
BUNDLE_APP_CONFIG="$GEM_HOME"
|
22
19
|
ENV PATH $BUNDLE_BIN:$PATH
|
23
|
-
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
|
24
|
-
|
20
|
+
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && \
|
21
|
+
chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
|
25
22
|
|
26
23
|
RUN mkdir /src
|
27
24
|
|
@@ -29,4 +26,3 @@ ENTRYPOINT [ "/package.sh" ]
|
|
29
26
|
|
30
27
|
COPY debify_utils.sh /
|
31
28
|
COPY package.sh /
|
32
|
-
|
data/lib/conjur/fpm/package.sh
CHANGED
@@ -16,11 +16,7 @@ if [ -z "$version" ]; then
|
|
16
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
|
21
|
-
|
22
19
|
# Build dev package first
|
23
|
-
echo Building $dev_package_name
|
24
20
|
prefix=/src/opt/conjur/project
|
25
21
|
cp -al $prefix /dev-pkg
|
26
22
|
cd $prefix
|
@@ -34,21 +30,29 @@ bundle_clean
|
|
34
30
|
if [ `ls | wc -l` -eq 0 ]; then
|
35
31
|
echo No dev dependencies, skipping dev package
|
36
32
|
else
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
for file_type in deb rpm
|
34
|
+
do
|
35
|
+
echo "Building conjur-$project_name-dev $file_type package"
|
36
|
+
|
37
|
+
fpm \
|
38
|
+
-s dir \
|
39
|
+
-t $file_type \
|
40
|
+
-n conjur-$project_name-dev \
|
41
|
+
-v $version \
|
42
|
+
-C . \
|
43
|
+
--maintainer "CyberArk Software, Inc." \
|
44
|
+
--vendor "CyberArk Software, Inc." \
|
40
45
|
--license "Proprietary" \
|
41
|
-
--url "https://www.
|
46
|
+
--url "https://www.cyberark.com" \
|
42
47
|
--deb-no-default-config-files \
|
43
|
-
|
44
|
-
|
48
|
+
--$file_type-user conjur \
|
49
|
+
--$file_type-group conjur \
|
45
50
|
--depends "conjur-$project_name = $version" \
|
46
51
|
--prefix /opt/conjur/$project_name \
|
47
52
|
--description "Conjur $project_name service - development files"
|
53
|
+
done
|
48
54
|
fi
|
49
55
|
|
50
|
-
echo Building $package_name
|
51
|
-
|
52
56
|
mv /src/opt/conjur/project /src/opt/conjur/$project_name
|
53
57
|
|
54
58
|
cd /src/opt/conjur/$project_name
|
@@ -63,16 +67,26 @@ mkdir -p opt/conjur/etc
|
|
63
67
|
|
64
68
|
[ -d opt/conjur/"$project_name"/distrib ] && mv opt/conjur/"$project_name"/distrib /
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
for file_type in deb rpm
|
71
|
+
do
|
72
|
+
echo "Building conjur-$project_name-dev $file_type package"
|
73
|
+
|
74
|
+
fpm \
|
75
|
+
-s dir \
|
76
|
+
-t $file_type \
|
77
|
+
-n conjur-$project_name \
|
78
|
+
-v $version \
|
79
|
+
-C . \
|
80
|
+
--maintainer "CyberArk Software, Inc." \
|
81
|
+
--vendor "CyberArk Software, Inc." \
|
69
82
|
--license "Proprietary" \
|
70
|
-
--url "https://www.
|
71
|
-
--deb-no-default-config-files \
|
83
|
+
--url "https://www.cyberark.com" \
|
72
84
|
--config-files opt/conjur/etc \
|
73
|
-
--deb-
|
74
|
-
|
85
|
+
--deb-no-default-config-files \
|
86
|
+
--$file_type-user conjur \
|
87
|
+
--$file_type-group conjur \
|
75
88
|
--description "Conjur $project_name service" \
|
76
89
|
"$@"
|
90
|
+
done
|
77
91
|
|
78
|
-
ls -al *.deb
|
92
|
+
ls -al *.{deb,rpm}
|
data/spec/action/publish_spec.rb
CHANGED
@@ -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.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- CyberArk Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-17 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:
|
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:
|
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
|
-
-
|
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,8 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
250
|
- !ruby/object:Gem::Version
|
250
251
|
version: '0'
|
251
252
|
requirements: []
|
252
|
-
|
253
|
-
rubygems_version: 2.7.7
|
253
|
+
rubygems_version: 3.1.2
|
254
254
|
signing_key:
|
255
255
|
specification_version: 4
|
256
256
|
summary: Utility commands to build and package Conjur services as Debian packages
|