zuul-jobs/roles/upload-puppetforge/tasks/main.yaml
Tobias Urdin fd8ffc6711 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
2019-01-17 10:16:22 +01:00

50 lines
1.2 KiB
YAML

- 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: |
namespace 'module' do
task 'build' do
end
end
require 'puppet_blacksmith/rake_tasks'
dest: "{{ puppet_module_dir }}/Rakefile"
- name: Publish puppet module
command: "rake module:push"
args:
chdir: "{{ puppet_module_dir }}"
environment:
BLACKSMITH_FORGE_URL: "{{ blacksmith_forge_url }}"
BLACKSMITH_FORGE_USERNAME: "{{ blacksmith_forge_username }}"
BLACKSMITH_FORGE_PASSWORD: "{{ blacksmith_forge_password }}"