Skip to content

Commit

Permalink
ansible: add RHEL 8
Browse files Browse the repository at this point in the history
Extend Ansible and Jenkins scripts for Red Hat Enterprise Linux 8.
  • Loading branch information
richardlau committed Feb 8, 2022
1 parent 606036e commit 882798d
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 9 deletions.
1 change: 1 addition & 0 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ hosts:
rhel7-s390x-2: {ip: 148.100.86.117, user: linux1, build_test_v8: yes}
rhel7-s390x-3: {ip: 148.100.86.28, user: linux1, build_test_v8: yes}
rhel7-s390x-4: {ip: 148.100.86.94, user: linux1, build_test_v8: yes}
rhel8-s390x-1: {ip: 148.100.84.12, user: linux1, build_test_v8: yes}
ubuntu1804-x64-1: {ip: 52.117.26.14, alias: jenkins-workspace-6}
ubuntu1804-x64-2: {ip: 50.97.245.9}

Expand Down
8 changes: 8 additions & 0 deletions ansible/roles/baselayout/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@
state: link
src: "/usr/local/bin/python2"

# Required for V8 builds
- name: rhel8 | update python package alternatives
alternatives:
link: /usr/bin/python
name: python
path: /usr/bin/python2
when: os == "rhel8"

- name: smartos17 | update gcc symlinks
when: os == "smartos17"
file:
Expand Down
5 changes: 5 additions & 0 deletions ansible/roles/baselayout/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ packages: {
'gcc-c++,sudo,git,zip,unzip,iptables-services,GConf2-devel,openssl-devel,python3',
],

rhel8: [
'cmake,gcc-c++,gcc-toolset-11,git,iptables-services,make,python3',
'GConf2-devel,python2' # Needed for V8 builds
],

smartos: [
'gccmakedep',
'git',
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/gn/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- name: build gn
ansible.builtin.shell: |
python3 build/gen.py && \
. /opt/rh/devtoolset-8/enable && \
{{ gn_select_compiler }} && \
{{ gn_dest_dir }}/ninja -C out && \
out/gn_unittests
args:
Expand Down
9 changes: 9 additions & 0 deletions ansible/roles/gn/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

compiler: {
'centos7': '. /opt/rh/devtoolset-8/enable',
'rhel7': '. /opt/rh/devtoolset-8/enable',
'rhel8': '. /opt/rh/gcc-toolset-11/enable'
}

gn_select_compiler: "{{ compiler[os]|default(compiler[os|stripversion])|default('true') }}"
1 change: 1 addition & 0 deletions ansible/roles/java-base/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages: {
'ibmi': 'openjdk-11-ea',
'macos': 'adoptopenjdk8',
'rhel7': 'java-1.8.0-openjdk',
'rhel8': 'java-17-openjdk',
'smartos': 'openjdk8',
'ubuntu': 'openjdk-8-jre-headless',
'ubuntu1404': 'oracle-java8-installer',
Expand Down
31 changes: 25 additions & 6 deletions ansible/roles/jenkins-worker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,36 +80,36 @@

- name: Firewall | enable iptables
command: systemctl enable iptables
when: "'rhel7-s390x' in inventory_hostname"
when: os|startswith('rhel')

- name: Firewall | remove firewalld
raw: yum remove -y firewalld
when: "'rhel7-s390x' in inventory_hostname"
when: os|startswith('rhel')

- name: Firewall | add rule to allow accepting multicast
lineinfile:
dest: /etc/sysconfig/iptables
insertafter: ":OUTPUT ACCEPT.*]"
line: "-A INPUT -m pkttype --pkt-type multicast -j ACCEPT"
when: "'rhel7-s390x' in inventory_hostname"
when: os|startswith('rhel')

- name: Firewall | add basic rule to allow communication locally
lineinfile:
dest: /etc/sysconfig/iptables
insertafter: ":OUTPUT ACCEPT.*]"
line: "-A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT"
when: "'rhel7-s390x' in inventory_hostname"
when: os|startswith('rhel')

- name: Firewall | add additional rule to allow communication from 127.0.0.2
lineinfile:
dest: /etc/sysconfig/iptables
insertafter: ":OUTPUT ACCEPT.*]"
line: "-A INPUT -s 127.0.0.2/32 -d 127.0.0.1/32 -j ACCEPT"
when: "'rhel7-s390x' in inventory_hostname"
when: os|startswith('rhel')

- name: Firewall | make the new firewall rules take effect
command: systemctl restart iptables
when: "'rhel7-s390x' in inventory_hostname"
when: os|startswith('rhel')

- name: install root certificates
copy:
Expand Down Expand Up @@ -329,6 +329,25 @@
when: os|startswith("zos13")
command: "chown -R {{ server_user }} {{ home }}/{{ server_user }}/gyp"

# Referenced by CI jobs ("Path of the reference repo to use during clone").
# This should probably be done on all hosts but the mirrored clone is 1.2G
# so for now restricted to places we know have enough space.
- name: create git reference repository
file:
path: "{{ home }}/{{ server_user }}/git/io.js.reference"
state: directory
owner: "{{ server_user }}"
group: "{{ server_user }}"
mode: 0755
register: gitreference
when: os == 'rhel8'

- name: populate git reference repository
become: yes
become_user: "{{ server_user }}"
command: "git clone https://github.com/nodejs/node.git --mirror {{ home }}/{{ server_user }}/git/io.js.reference"
when: gitreference.changed

# This has to be done before the `service` (and similar) commands because
# java is needed to start the service

Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/jenkins-worker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ init: {
ibmi: 'ibmi73',
macos: 'macos',
rhel7: 'rhel7',
systemd: ['centos7', 'debian8', 'debian9', 'debian10', 'fedora', 'ubuntu1604', 'ubuntu1804'],
systemd: ['centos7', 'debian8', 'debian9', 'debian10', 'fedora', 'rhel8', 'ubuntu1604', 'ubuntu1804'],
svc: 'smartos',
upstart: ['ubuntu12', 'ubuntu1404'],
zos_start: 'zos'
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/package-upgrade/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
pm: {
'yum': ['centos', 'rhel7', 'aix', 'ibmi'],
'apt': ['debian', 'ubuntu'],
'dnf': 'fedora',
'dnf': ['fedora', 'rhel8'],
'pkg': 'freebsd',
'pkgin': 'smartos',
'chocolatey': 'win',
Expand Down
2 changes: 2 additions & 0 deletions jenkins/scripts/VersionSelectorScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def buildExclusions = [
[ /debian8-x86/, anyType, gte(10) ], // 32-bit linux for <10 only
[ /debian8/, anyType, gte(13) ],
[ /debian9/, anyType, gte(16) ],
[ /rhel7/, releaseType, gte(18) ],
[ /rhel8/, anyType, lt(18) ],
[ /^ubuntu1804/, anyType, lt(10) ], // probably temporary
[ /^ubuntu1404-32/, anyType, gte(10) ], // 32-bit linux for <10 only
[ /^ubuntu1404-64/, anyType, gte(12) ],
Expand Down
11 changes: 11 additions & 0 deletions jenkins/scripts/select-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ if [ -z ${NODEJS_MAJOR_VERSION+x} ]; then
NODEJS_MAJOR_VERSION="$(echo "$NODE_VERSION" | cut -d . -f 1)"
fi

# Linux distros should be arch agnostic
case $NODE_NAME in
*rhel8*)
# TODO: add LTO
echo "Setting compiler for Node.js $NODEJS_MAJOR_VERSION on " `cat /etc/redhat-release`
# Default gcc on RHEL 8 is gcc 8
echo "Compiler left as system default:" `g++ -dumpversion`
return
;;
esac

if [ "$SELECT_ARCH" = "PPC64LE" ]; then
# Set default
export COMPILER_LEVEL="4.8"
Expand Down

0 comments on commit 882798d

Please sign in to comment.