From 091849a5d2336205b1fa28e8a36186e75197e27e Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 17 Nov 2020 10:16:03 -0500 Subject: [PATCH 1/2] Add package flag to include additional files This allows us to include artifacts (such as compiled executables) that are not a part of the git repository. --- CHANGELOG.md | 4 ++++ lib/conjur/debify.rb | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b1ac1a..865c618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ### Added - Debify now packages and publishes an RPM file, alongside a debian file. [conjurinc/debify#49](https://github.com/conjurinc/debify/pull/49) +- `debify package` now offers an `--additional-files` flag to provide a comma + separated list of files to include in the FPM build that are not provided + automatically by `git ls-files`. + [conjurinc/debify#52](https://github.com/conjurinc/debify/pull/52) ### Fixed - Bug causing `all` files in the git repo to be added to the debian file. diff --git a/lib/conjur/debify.rb b/lib/conjur/debify.rb index e0da7bb..49652a8 100644 --- a/lib/conjur/debify.rb +++ b/lib/conjur/debify.rb @@ -240,6 +240,9 @@ def copy_packages_from_container(container, package_name, dev_package_name) c.desc "Specify a custom Dockerfile.fpm" c.flag [ :dockerfile] + c.desc "Specify files to add to the FPM image that are not included from the git repo" + c.flag [ :'additional-files' ] + c.action do |global_options,cmd_options,args| raise "project-name is required" unless project_name = args.shift @@ -253,6 +256,11 @@ def copy_packages_from_container(container, package_name, dev_package_name) dir = cmd_options[:dir] || '.' pwd = File.dirname(__FILE__) + additional_files = [] + if cmd_options[:'additional-files'] + additional_files = cmd_options[:'additional-files'].split(',').map(&:strip) + end + fpm_image = Docker::Image.build_from_dir File.expand_path('fpm', File.dirname(__FILE__)), tag: "debify-fpm", &DebugMixin::DOCKER DebugMixin.debug_write "Built base fpm image '#{fpm_image.id}'\n" dir = File.expand_path(dir) @@ -265,12 +273,13 @@ def copy_packages_from_container(container, package_name, dev_package_name) # that aren't mentioned in the dockerignore to the deb temp_dir = Dir.mktmpdir DebugMixin.debug_write "Copying git files to tmp dir '#{temp_dir}'\n" - git_files.each do |fname| + (git_files + additional_files).each do |fname| original_file = File.join(dir, fname) destination_path = File.join(temp_dir, fname) FileUtils.mkdir_p(File.dirname(destination_path)) FileUtils.cp(original_file, destination_path) end + # rename specified dockerfile to 'Dockerfile' during copy, incase name is different dockerfile_path = cmd_options[:dockerfile] || File.expand_path("debify/Dockerfile.fpm", pwd) temp_dockerfile = File.join(temp_dir, "Dockerfile") From 243967f3c4890cbb6b1f64c21357b40566453886 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Tue, 17 Nov 2020 10:18:15 -0500 Subject: [PATCH 2/2] Bump version to 1.12.0 --- CHANGELOG.md | 2 ++ VERSION | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 865c618..c28f2e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [Unreleased] +# 1.12.0 + ### Added - Debify now packages and publishes an RPM file, alongside a debian file. [conjurinc/debify#49](https://github.com/conjurinc/debify/pull/49) diff --git a/VERSION b/VERSION index e6dbb7c..0eed1a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.11.5 +1.12.0