Skip to content

Commit a166af1

Browse files
committed
ansible: add RHEL 8
Extend Ansible and Jenkins scripts for Red Hat Enterprise Linux 8.
1 parent 4496f5b commit a166af1

File tree

18 files changed

+162
-4
lines changed

18 files changed

+162
-4
lines changed

ansible/inventory.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ hosts:
152152
rhel7-s390x-2: {ip: 148.100.86.117, user: linux1, build_test_v8: yes}
153153
rhel7-s390x-3: {ip: 148.100.86.28, user: linux1, build_test_v8: yes}
154154
rhel7-s390x-4: {ip: 148.100.86.94, user: linux1, build_test_v8: yes}
155+
rhel8-s390x-1: {ip: 148.100.84.112, user: linux1, build_test_v8: yes}
156+
rhel8-s390x-2: {ip: 148.100.84.240, user: linux1, build_test_v8: yes}
157+
rhel8-s390x-3: {ip: 148.100.84.56, user: linux1, build_test_v8: yes}
155158
ubuntu1804-x64-1: {ip: 52.117.26.14, alias: jenkins-workspace-6}
156159
ubuntu1804-x64-2: {ip: 50.97.245.9}
157160

ansible/roles/baselayout/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@
141141
state: link
142142
src: "/usr/local/bin/python2"
143143

144+
# Required for V8 builds
145+
- name: rhel8 | update python package alternatives
146+
community.general.alternatives:
147+
link: /usr/bin/python
148+
name: python
149+
path: /usr/bin/python2
150+
when:
151+
- os == "rhel8"
152+
- build_test_v8|default(False)
153+
144154
- name: smartos17 | update gcc symlinks
145155
when: os == "smartos17"
146156
file:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
3+
# Red Hat Enterprise Linux 8
4+
5+
- name: install GPG key for EPEL 8
6+
become: yes
7+
ansible.builtin.rpm_key:
8+
key: https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
9+
state: present
10+
11+
- name: install EPEL 8
12+
ansible.builtin.dnf:
13+
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
14+
state: present

ansible/roles/baselayout/vars/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ packages: {
144144
'gcc-c++,sudo,git,zip,unzip,iptables-services,GConf2-devel,openssl-devel,python3',
145145
],
146146

147+
rhel8_s390x: [
148+
'GConf2-devel,python2' # Needed for V8 builds
149+
],
150+
151+
rhel8: [
152+
'ccache,cmake,gcc-c++,gcc-toolset-11,git,make,python3',
153+
],
154+
147155
smartos: [
148156
'gccmakedep',
149157
'git',
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: restart iptables
2+
ansible.builtin.service:
3+
name: iptables
4+
state: restarted

ansible/roles/bootstrap/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
loop_var: bootstrap_include
1111
with_first_found:
1212
- files:
13+
- "{{ role_path }}/tasks/partials/{{ os }}-{{ arch }}.yml"
1314
- "{{ role_path }}/tasks/partials/{{ os }}.yml"
1415
- "{{ role_path }}/tasks/partials/{{ os|stripversion }}.yml"
1516
skip: true
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
3+
# Red Hat Enterprise Linux 8 on s390x (LinuxONE)
4+
5+
- name: run common RHEL 8 tasks
6+
ansible.builtin.include_tasks: rhel8.yml
7+
8+
- name: Firewall | install iptables-services
9+
ansible.builtin.dnf:
10+
name: iptables-services
11+
state: present
12+
13+
- name: Firewall | enable iptables
14+
ansible.builtin.systemd:
15+
enabled: yes
16+
name: iptables
17+
18+
- name: Firewall | remove firewalld
19+
ansible.builtin.dnf:
20+
name: firewalld
21+
state: absent
22+
23+
- name: Firewall | add rule to allow accepting multicast
24+
lineinfile:
25+
dest: /etc/sysconfig/iptables
26+
insertafter: ":OUTPUT ACCEPT.*]"
27+
line: "-A INPUT -m pkttype --pkt-type multicast -j ACCEPT"
28+
notify: restart iptables
29+
30+
- name: Firewall | add basic rule to allow communication locally
31+
lineinfile:
32+
dest: /etc/sysconfig/iptables
33+
insertafter: ":OUTPUT ACCEPT.*]"
34+
line: "-A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT"
35+
notify: restart iptables
36+
37+
- name: Firewall | add additional rule to allow communication from 127.0.0.2
38+
lineinfile:
39+
dest: /etc/sysconfig/iptables
40+
insertafter: ":OUTPUT ACCEPT.*]"
41+
line: "-A INPUT -s 127.0.0.2/32 -d 127.0.0.1/32 -j ACCEPT"
42+
notify: restart iptables
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
3+
# Red Hat Enterprise Linux 8
4+
5+
- name: register Red Hat subscription
6+
community.general.redhat_subscription:
7+
activationkey: "{{ type }}"
8+
org_id: "{{ rh_org }}"
9+
state: present

ansible/roles/gn/tasks/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ansible.builtin.git:
99
dest: "{{ gn_git_dir }}"
1010
repo: "https://gn.googlesource.com/gn"
11+
version: "{{ gn_version|default(omit) }}"
1112
become: "{{ gn_user|default(omit)|bool }}"
1213
become_user: "{{ gn_user|default(omit) }}"
1314
register: gn_git
@@ -23,7 +24,7 @@
2324
- name: build gn
2425
ansible.builtin.shell: |
2526
python3 build/gen.py && \
26-
. /opt/rh/devtoolset-8/enable && \
27+
{{ gn_select_compiler }} && \
2728
{{ gn_dest_dir }}/ninja -C out && \
2829
out/gn_unittests
2930
args:

ansible/roles/gn/vars/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
3+
compiler: {
4+
'centos7': '. /opt/rh/devtoolset-8/enable',
5+
'rhel7': '. /opt/rh/devtoolset-8/enable',
6+
'rhel8': '. /opt/rh/gcc-toolset-11/enable'
7+
}
8+
9+
gn_select_compiler: "{{ compiler[os]|default(compiler[os|stripversion])|default('true') }}"
10+
# Pin gn for now so we can still build older versions of V8 in Node.js 14.
11+
# Refs: https://github.com/nodejs/node/pull/40689#issuecomment-956303875
12+
gn_version: 69ec4fc

ansible/roles/java-base/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# as appropriate -- try to use generic os family if available.
3232

3333
- name: Check if java is already installed
34+
changed_when: no
3435
check_mode: no
3536
raw: "{{ java_path[os] | default(\"java\") }} -version"
3637
register: java

ansible/roles/java-base/vars/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ packages: {
1515
'ibmi': 'openjdk-11-ea',
1616
'macos': 'adoptopenjdk8',
1717
'rhel7': 'java-1.8.0-openjdk',
18+
'rhel8': 'java-17-openjdk',
1819
'smartos': 'openjdk8',
1920
'ubuntu': 'openjdk-8-jre-headless',
2021
'ubuntu1404': 'oracle-java8-installer',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
3+
#
4+
# generic handlers for jenkins-worker
5+
#
6+
7+
- name: restart Jenkins
8+
ansible.builtin.service:
9+
name: jenkins
10+
state: restarted
11+
when:
12+
- not os|startswith("aix")
13+
- not os|startswith("ibmi")
14+
- not os|startswith("macos")
15+
- not os|startswith("zos")

ansible/roles/jenkins-worker/tasks/main.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
mode: 0644
132132
timeout: 60
133133
force: yes
134+
notify: restart Jenkins
134135

135136
- name: Resolver | ipnodes needs to be present on zos, similar to hosts file
136137
when: os|startswith("zos")
@@ -208,6 +209,7 @@
208209
shell: "sh {{ home }}/{{ server_user }}/gen_runAsciiBash.sh"
209210

210211
- name: render init script into place
212+
notify: restart Jenkins
211213
template:
212214
src: "{{ jenkins.src }}"
213215
dest: "{{ jenkins.dest }}"
@@ -329,17 +331,38 @@
329331
when: os|startswith("zos13")
330332
command: "chown -R {{ server_user }} {{ home }}/{{ server_user }}/gyp"
331333

334+
# Referenced by CI jobs ("Path of the reference repo to use during clone").
335+
# This should probably be done on all hosts but the mirrored clone is 1.2G
336+
# so for now restricted to places we know have enough space.
337+
- name: create git reference repository
338+
file:
339+
path: "{{ home }}/{{ server_user }}/git/io.js.reference"
340+
state: directory
341+
owner: "{{ server_user }}"
342+
group: "{{ server_user }}"
343+
mode: 0755
344+
register: gitreference
345+
when: os == 'rhel8'
346+
347+
- name: populate git reference repository
348+
become: yes
349+
become_user: "{{ server_user }}"
350+
command: "git clone https://github.com/nodejs/node.git --mirror {{ home }}/{{ server_user }}/git/io.js.reference"
351+
when: gitreference.changed
352+
332353
# This has to be done before the `service` (and similar) commands because
333354
# java is needed to start the service
334355

335356

336357
- name: enable jenkins at startup - general
358+
ansible.builtin.service:
359+
name: jenkins
360+
enabled: yes
337361
when:
338362
- not os|startswith("aix")
339363
- not os|startswith("ibmi")
340364
- not os|startswith("macos")
341365
- not os|startswith("zos")
342-
service: name=jenkins state=restarted enabled=yes
343366

344367
- name: Unload org.nodejs.osx.jenkins.plist from launchctl
345368
when: os|startswith("macos")

ansible/roles/jenkins-worker/vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ init: {
1212
ibmi: 'ibmi73',
1313
macos: 'macos',
1414
rhel7: 'rhel7',
15-
systemd: ['centos7', 'debian8', 'debian9', 'debian10', 'fedora', 'ubuntu1604', 'ubuntu1804'],
15+
systemd: ['centos7', 'debian8', 'debian9', 'debian10', 'fedora', 'rhel8', 'ubuntu1604', 'ubuntu1804'],
1616
svc: 'smartos',
1717
upstart: ['ubuntu12', 'ubuntu1404'],
1818
zos_start: 'zos'

ansible/roles/package-upgrade/vars/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
pm: {
88
'yum': ['centos', 'rhel7', 'aix', 'ibmi'],
99
'apt': ['debian', 'ubuntu'],
10-
'dnf': 'fedora',
10+
'dnf': ['fedora', 'rhel8'],
1111
'pkg': 'freebsd',
1212
'pkgin': 'smartos',
1313
'chocolatey': 'win',

jenkins/scripts/VersionSelectorScript.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def buildExclusions = [
3030
[ /debian8-x86/, anyType, gte(10) ], // 32-bit linux for <10 only
3131
[ /debian8/, anyType, gte(13) ],
3232
[ /debian9/, anyType, gte(16) ],
33+
[ /rhel7/, releaseType, gte(18) ],
34+
[ /rhel8/, releaseType, lt(18) ],
35+
[ /rhel8/, anyType, lt(14) ],
3336
[ /^ubuntu1804/, anyType, lt(10) ], // probably temporary
3437
[ /^ubuntu1404-32/, anyType, gte(10) ], // 32-bit linux for <10 only
3538
[ /^ubuntu1404-64/, anyType, gte(12) ],

jenkins/scripts/select-compiler.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ if [ -z ${NODEJS_MAJOR_VERSION+x} ]; then
3232
NODEJS_MAJOR_VERSION="$(echo "$NODE_VERSION" | cut -d . -f 1)"
3333
fi
3434

35+
# Linux distros should be arch agnostic
36+
case $NODE_NAME in
37+
*rhel8*)
38+
# TODO: add LTO
39+
echo "Setting compiler for Node.js $NODEJS_MAJOR_VERSION on " `cat /etc/redhat-release`
40+
# Default gcc on RHEL 8 is gcc 8
41+
echo "Compiler left as system default:" `g++ -dumpversion`
42+
return
43+
;;
44+
esac
45+
3546
if [ "$SELECT_ARCH" = "PPC64LE" ]; then
3647
# Set default
3748
export COMPILER_LEVEL="4.8"

0 commit comments

Comments
 (0)