Browse Source

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
changes/94/631194/4
Tobias Urdin 6 months ago
parent
commit
fd8ffc6711
1 changed files with 29 additions and 1 deletions
  1. 29
    1
      roles/upload-puppetforge/tasks/main.yaml

+ 29
- 1
roles/upload-puppetforge/tasks/main.yaml View File

@@ -1,14 +1,42 @@
1
+- name: Install ruby dependencies on RedHat/Suse based
2
+  package:
3
+    name:
4
+      - ruby-devel
5
+      - gcc-c++
6
+      - make
7
+    state: present
8
+  when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
9
+
10
+- name: Install ruby dependencies on Debian based
11
+  package:
12
+    name:
13
+      - ruby-dev
14
+      - g++
15
+      - make
16
+    state: present
17
+  when: ansible_os_family == "Debian"
18
+
1 19
 - name: Install required gems
2 20
   gem:
3 21
     name: "{{ item }}"
22
+    user_install: no
4 23
   with_items:
5 24
     - rake
6 25
     - puppetlabs_spec_helper
7 26
     - puppet-blacksmith
8 27
 
28
+# NOTE(tobias.urdin): The build task is needed because puppet-blacksmith
29
+# doesn't provide a build task so it fails, we don't need one anyway since
30
+# we have already built the module before this role is called.
9 31
 - name: Install new Rakefile
10 32
   copy:
11
-    content: "require 'puppet_blacksmith/rake_tasks'"
33
+    content: |
34
+      namespace 'module' do
35
+        task 'build' do
36
+        end
37
+      end
38
+
39
+      require 'puppet_blacksmith/rake_tasks'
12 40
     dest: "{{ puppet_module_dir }}/Rakefile"
13 41
 
14 42
 - name: Publish puppet module

Loading…
Cancel
Save