Fix upload-puppetforge role

The role failed because the puppet-blacksmith gem required
ruby-dev, gcc/g++ compiler and make to compile the gems that
had native extensions.

Fixes the Rakefile since the puppet-blacksmith module
requires a "build" rake task, we can just empty that out
since this role assumed the pkg/ folder in the module
(zuul project dir) already contains the built module.

Setups the GEM_HOME and GEM_BIN folders correctly so that
we install gems in a predictable path which we can then
pass as an environment to the rake command so that it
knows where the actual commands are stored.

Change-Id: I2b39dd69ab56d51e169b7ac6b77c675646006f10
This commit is contained in:
Tobias Urdin 2019-01-16 12:29:36 +01:00
parent 20583c1e77
commit fd8ffc6711
1 changed files with 29 additions and 1 deletions

View File

@ -1,14 +1,42 @@
- name: Install ruby dependencies on RedHat/Suse based
package:
name:
- ruby-devel
- gcc-c++
- make
state: present
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
- name: Install ruby dependencies on Debian based
package:
name:
- ruby-dev
- g++
- make
state: present
when: ansible_os_family == "Debian"
- name: Install required gems
gem:
name: "{{ item }}"
user_install: no
with_items:
- rake
- puppetlabs_spec_helper
- puppet-blacksmith
# NOTE(tobias.urdin): The build task is needed because puppet-blacksmith
# doesn't provide a build task so it fails, we don't need one anyway since
# we have already built the module before this role is called.
- name: Install new Rakefile
copy:
content: "require 'puppet_blacksmith/rake_tasks'"
content: |
namespace 'module' do
task 'build' do
end
end
require 'puppet_blacksmith/rake_tasks'
dest: "{{ puppet_module_dir }}/Rakefile"
- name: Publish puppet module