Skip to content

Commit

Permalink
Add new IBM i system
Browse files Browse the repository at this point in the history
Add ccache dependency
Add libstdc++-devel
Add new IBM i system
Add PASE_PATH to ibmi_start SBMJOB
cleanup merge issue garbage
Co-Authored-By: Kevin Adler <[email protected]>
fix ProdDava spelling
FIXUP
fixup ansible misspelling
fixup CentOS conflict
fixup! merge issues
Get rid of IBM i manual steps for bootstrap
Initial IBMi playbook
Misc preparation for IBM i
Remove QSECOFR IBM i RPM Repo from bootstrap task
Restructure os condition for readability
Rewrite ibmi_start.j2 to use SBMJOB instead of su
set yum backend
Split ibmi packages into separate lines for readability
WIP - host vars
WIP - one machine should be release?
  • Loading branch information
George Adams authored and sam-github committed May 12, 2020
1 parent 59902dd commit a919fd4
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 10 deletions.
12 changes: 12 additions & 0 deletions ansible/MANUAL_STEPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,15 @@ After these steps are performed and the Pi's are running, Ansible can be run to
[Setting up a Windows Host]: https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html
[newer Ansible configuration]: https://github.com/nodejs/build/tree/master/ansible
[stand-alone]: https://github.com/nodejs/build/tree/master/setup/windows

## IBMi

Ansible 2.7.6 is required.

There isn't a system start service on IBMi -- the machine should not be
rebooted, and after ansible is run, jenkins needs to be started with
jenkins-start.sh, as the iojs user.

XXX how do people become the iojs user? Probably pre-ansible the
`nodejs_build_test` user's keys need installing as the nodejs and iojs user on
the target box.
4 changes: 4 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ ansible_python_interpreter = /usr/bin/python3
[hosts:ibm]
become_method = sudo

[hosts:iinthecloud]
ansible_become = false
ansible_python_interpreter = /QOpenSys/pkgs/bin/python2

[hosts:marist]
ansible_become = false
ansible_python_interpreter = /NODEJS2/python-2017-04-12-py27/python27/bin/python
Expand Down
3 changes: 3 additions & 0 deletions ansible/host_vars/test-iinthecloud-ibmi72-ppc64_be-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
secret: "SECRET"
server_jobs: "4"
7 changes: 7 additions & 0 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ hosts:
aix71-ppc64_be-1: {ip: 129.33.196.199, user: b9s010a}
rhel7-s390x-1: {ip: 148.100.86.101, user: linux1}

- iinthecloud:
ibmi72-ppc64_be-1: {ip: 65.183.160.62, user: nodejs}

- joyent:
smartos15-x64-2: {ip: 165.225.148.139}
smartos17-x64-2: {ip: 165.225.149.208}
Expand Down Expand Up @@ -181,6 +184,10 @@ hosts:
macos10.14-x64-1: {ip: 199.7.167.99, port: 8822, user: administrator}
macos10.14-x64-2: {ip: 199.7.167.100, port: 8824, user: administrator}

- iinthecloud:
ibmi72-ppc64_be-1: {ip: 65.183.160.52, user: nodejs}
ibmi72-ppc64_be-2: {ip: 65.183.160.59, user: nodejs}

- rackspace:
centos7-x64-1: {ip: 119.9.27.82}
debian8-x64-1: {ip: 23.253.109.216}
Expand Down
2 changes: 1 addition & 1 deletion ansible/playbooks/jenkins/worker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
- "!test-ibm-ubuntu1804-x64-1"
tasks:
- name: remove node and npm packages
when: not os|startswith("win") and not os|startswith("zos")
when: not os|startswith("win") and not os|startswith("zos") and not os|startswith("ibmi")
package:
name: "{{ package }}"
state: absent
Expand Down
2 changes: 1 addition & 1 deletion ansible/plugins/inventory/nodejs_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'type': ('infra', 'release', 'test'),

# providers - validated for consistency
'provider': ('azure', 'digitalocean', 'ibm', 'joyent', 'linuxonecc',
'provider': ('azure', 'digitalocean', 'ibm', 'iinthecloud', 'joyent', 'linuxonecc',
'macstadium', 'marist', 'mininodes', 'msft', 'osuosl',
'orka', 'rackspace', 'requireio', 'scaleway', 'softlayer', 'voxer',
'packetnet', 'nearform')
Expand Down
26 changes: 24 additions & 2 deletions ansible/roles/baselayout/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: set hostname
when: not os|startswith("smartos") and not os|startswith("zos")
and not os|startswith("macos") and not os|startswith("aix")
and not os|startswith("macos") and not os|startswith("aix") and not os|startswith("ibmi")
hostname: name="{{ safe_hostname }}"

- name: Set hostname to inventory_hostname macOS
Expand Down Expand Up @@ -73,7 +73,7 @@
state: absent

- name: install packages
when: not os|startswith("zos") and not os|startswith("macos")
when: not os|startswith("zos") and not os|startswith("macos") and not os|startswith("ibmi")
package: name="{{ package }}" state=present
loop_control:
loop_var: package
Expand All @@ -84,6 +84,28 @@
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"

- name: install packages IBMi
when: os|startswith("ibmi")
yum: name="{{ package }}" state=present use_backend=yum
loop_control:
loop_var: package
with_items:
# ansible doesn't like empty lists
- "{{ packages[os]|default('[]') }}"
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"

- name: install packages IBMi
when: os|startswith("ibmi")
yum: name="{{ package }}" state=present use_backend=yum
loop_control:
loop_var: package
with_items:
# ansible doesn't like empty lists
- "{{ packages[os]|default('[]') }}"
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"

- name: install packages (macos)
when: os|startswith("macos")
become_user: administrator
Expand Down
19 changes: 19 additions & 0 deletions ansible/roles/baselayout/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ packages: {
'bash,cmake,gcc-c++,gcc6-c++,tar,unzip,git,make,sudo',
],

# @jgorzins - this works, but @rvagg says doing it as a concatenated string
# as above is _significantly_ faster to execute
ibmi: [
'autoconf',
'automake',
'ca-certificates-mozilla',
'ccache',
'coreutils-gnu',
'gcc',
'gcc-cplusplus',
'gcc-cpp',
'git',
'libstdcplusplus-devel',
'openssl-devel >= 1.1.1',
'python2-pip',
'sed-gnu',
'zlib-devel',
],

debian7: [
'gcc-4.8,g++-4.8,sudo',
],
Expand Down
6 changes: 6 additions & 0 deletions ansible/roles/java-base/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
register: java_exists
when: os|startswith("aix")

- name: check if java is installed IBMi
stat:
path: /QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java
register: java_exists
when: os|startswith("ibmi")

- name: download java AIX
get_url:
url: https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u192-b12/OpenJDK8U-jre_ppc64_aix_hotspot_8u192b12.tar.gz
Expand Down
79 changes: 75 additions & 4 deletions ansible/roles/jenkins-worker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@
when: jobs_env is undefined

- name: create group
when: not os|startswith("zos")
when: not os|startswith("zos") and not os|startswith("ibmi")
group: name="{{ server_user }}"

- name: create user
when: "not os|startswith('zos')"
when: "not os|startswith('zos') and not os|startswith('ibmi')"
user:
name: "{{ server_user }}"
group: "{{ server_user }}"
shell: "{{ bash_path[os|stripversion]|default('/bin/bash') }}"

- name: create user for ibmi
when: os|startswith("ibmi")
command: "/QOpenSys/usr/bin/system 'CRTUSRPRF USRPRF({{ server_user }}) PASSWORD(*none)'"
ignore_errors: true

- name: add ::1 to /etc/hosts for ipv6 compat
when: not os|startswith("zos")
when: not os|startswith("zos") and not os|startswith("ibmi")
lineinfile:
dest: /etc/hosts
state: present
Expand All @@ -46,12 +51,21 @@
file: path="{{ home }}/{{ server_user }}/tmp" state=directory

- name: set NODE_TEST_DIR permission and owner
when: not os|startswith("ibmi")
file:
path: "{{ home }}/{{ server_user }}/tmp"
owner: "{{ server_user }}"
group: "{{ server_user }}"
mode: 0755

# group has very different meaning on IBMi, only set to the build user
- name: set NODE_TEST_DIR permission and owner IBMi
when: os|startswith("ibmi")
file:
path: "{{ home }}/{{ server_user }}/tmp"
owner: "{{ server_user }}"
mode: 0755

- name: run raspberry pi jenkins-worker setup
when: "inventory_hostname|regex_search('-arm(v6l|v7l|64)_pi')"
include: "{{ role_path }}/tasks/partials/raspberry-pi.yml"
Expand Down Expand Up @@ -133,6 +147,59 @@
command: systemctl restart iptables
when: "'rhel7-s390x' in inventory_hostname"

- name: Check if SU is installed on IBMi
when: os|startswith("ibmi")
stat:
path: /QOpenSys/pkgs/bin/su
register: su_exists

- name: git clone su on ibmi
git:
repo: https://github.com/ThePrez/IBMiOSS-utils.git
dest: /tmp/IBMiOSS-utils
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: copy su into /QOpenSys/pkgs/bin IBMi
copy:
src: /tmp/IBMiOSS-utils/su
dest: /QOpenSys/pkgs/bin/su
remote_src: true
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: copy su-setup into /QOpenSys/pkgs/bin IBMi
copy:
src: /tmp/IBMiOSS-utils/su-setup
dest: /QOpenSys/pkgs/bin/su-setup
remote_src: true
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: Check if SU is installed on IBMi
when: os|startswith("ibmi")
stat:
path: /QOpenSys/pkgs/bin/su
register: su_exists

# FIXME rewrite jenkins start to use ssh or SBMJOB, so su is not needed.
- name: git clone su on ibmi
git:
repo: https://github.com/ThePrez/IBMiOSS-utils.git
dest: /tmp/IBMiOSS-utils
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: copy su into /QOpenSys/pkgs/bin IBMi
copy:
src: /tmp/IBMiOSS-utils/su
dest: /QOpenSys/pkgs/bin/su
remote_src: true
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: copy su-setup into /QOpenSys/pkgs/bin IBMi
copy:
src: /tmp/IBMiOSS-utils/su-setup
dest: /QOpenSys/pkgs/bin/su-setup
remote_src: true
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: download slave.jar
when: not os|startswith("zos")
get_url:
Expand Down Expand Up @@ -313,7 +380,11 @@
name: java-base

- name: enable jenkins at startup - general
when: not os|startswith("zos") and not os|startswith("macos") and not os|startswith("aix")
when:
- not os|startswith("aix")
- not os|startswith("ibmi")
- not os|startswith("macos")
- not os|startswith("zos")
service: name=jenkins state=restarted enabled=yes

- name: Unload org.nodejs.osx.jenkins.plist from launchctl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

#
# install tap2junit ibmi
#

- name: install tap2junit
pip: name=tap2junit state=present
executable: pip2
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
#

- name: install tap2junit
pip: name=tap2junit state=present
pip: name=tap2junit state=present
19 changes: 19 additions & 0 deletions ansible/roles/jenkins-worker/templates/ibmi_start.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/QOpenSys/pkgs/bin/bash
SBMJOB_OPTS="JOB(JENKINS_CI) USER(IOJS)"

export PATH=/QOpenSys/pkgs/lib/ccache:/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin
export PASE_PATH=$PATH
export JENKS_HOME={{ home }}/{{ server_user }}
export NODE_COMMON_PIPE="$HOME/test.pipe"
export NODE_TEST_DIR="$HOME/tmp"
export JOBS=4
export OSTYPE=ibmi
export QIBM_USE_DESCRIPTOR_STDIO=N

unset LC_ALL

export START_CMD="{{ java_path[os] }} -Xmx{{ server_ram|default('128m') }} -jar {{ home }}/{{ server_user }}/slave.jar -secret {{ secret }} -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp >{{ home }}/{{ server_user }}/jenkins.log 2>&1 "

echo $START_CMD

exec /QOpenSys/usr/bin/system -kpiveO "SBMJOB CMD(CALL PGM(QP2SHELL2) PARM('/QOpenSys/usr/bin/sh' '-c' 'echo starting Jenkins slave && cd $JENKS_HOME && env && exec $START_CMD')) CPYENVVAR(*YES) PRTDEV(*USRPRF) ALWMLTTHD(*YES) $SBMJOB_OPTS"
6 changes: 6 additions & 0 deletions ansible/roles/jenkins-worker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ init: {
centos6: 'centos6',
debian: 'debian7',
freebsd: 'freebsd',
ibmi: 'ibmi72',
macos: 'macos',
rhel7: 'rhel7',
systemd: ['centos7', 'debian8', 'debian9', 'debian10', 'fedora', 'ubuntu1604', 'ubuntu1804'],
Expand Down Expand Up @@ -69,6 +70,10 @@ jenkins_init: {
dest: '{{ home }}/{{ server_user }}/start.sh',
src: 'zos_start.j2'
},
ibmi: {
dest: '{{ home }}/{{ server_user }}/jenkins-start.sh',
src: 'ibmi_start.j2'
},
}

# if you fail here, it means it cant map your os or os family to a init system
Expand All @@ -86,6 +91,7 @@ needs_monit: [
java_path: {
'aix71': '/home/iojs/jdk8u192-b12-jre/bin/java',
'aix72': '/home/iojs/jdk8u192-b12-jre/bin/java',
'ibmi72': '/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java',
'macos10.10': 'java',
'macos10.11': 'java',
'macos10.12': 'java',
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/package-upgrade/tasks/partials/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

- name: upgrade installed packages
yum: name=* state=latest
# XXX might have needed `use_backend=yum` at end of last line, but prob
# not, was a workaround for a fixed path problem
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 @@ -5,7 +5,7 @@
#

pm: {
'yum': ['centos', 'rhel7', 'aix'],
'yum': ['centos', 'rhel7', 'aix', 'ibmi'],
'apt': ['debian', 'ubuntu'],
'dnf': 'fedora',
'pkg': 'freebsd',
Expand Down
6 changes: 6 additions & 0 deletions jenkins/scripts/select-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if [ "$DONTSELECT_COMPILER" != "DONT" ]; then
*aix* ) SELECT_ARCH=AIXPPC ;;
*x64* ) SELECT_ARCH=X64 ;;
*arm64* ) SELECT_ARCH=ARM64 ;;
*ibmi72* ) SELECT_ARCH=IBMI72 ;;
esac
fi

Expand Down Expand Up @@ -89,6 +90,11 @@ elif [ "$SELECT_ARCH" = "S390X" ]; then
echo "Compiler set to $COMPILER_LEVEL"
fi

elif [ "$SELECT_ARCH" = "IBMI72" ]; then
echo "Setting compiler for Node version $NODEJS_MAJOR_VERSION on IBMI72"
export PATH="/QOpenSys/pkgs/lib/ccache:$PATH"
echo "Compiler left as system default (6.3)"

elif [ "$SELECT_ARCH" = "AIXPPC" ]; then
case $NODE_NAME in
*aix72* )
Expand Down

0 comments on commit a919fd4

Please sign in to comment.