Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion ansible/MANUAL_STEPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* [SmartOS](#smartos)
* [Raspberry Pi](#raspberry-pi)
* [NFS boot](#nfs-boot)

* [IBM i](#ibm-i)

## Adding firewall entries for Jenkins workers

Expand Down Expand Up @@ -479,3 +479,41 @@ 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

## IBM i

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`. This will submit the job under the iojs user. If the
job is already running, the `jenkins-start.sh` script will not start
another job.


### Install open source ecosystem
See http://ibm.biz/ibmi-rpms (see "Installation" section)

### Create Nodejs user's home directory
```
mkdir -p /home/NODEJS
chown -R nodejs /home/NODEJS
```

### Set global PATH and .bashrc to use Open Source Ecosystem
Edit `/QOpenSys/etc/profile` to contain:
```
PATH=/QOpenSys/pkgs/bin:$PATH
export PATH
```
This can be done by running the following commands from a shell:
```
echo 'PATH=/QOpenSys/pkgs/bin:$PATH' >> /QOpenSys/etc/profile
echo 'export PATH' >> /QOpenSys/etc/profile
```
After that is completed, copy to the `.bashrc` file for the nodejs user
`cp /QOpenSys/etc/profile /home/NODEJS/.bashrc`

### Use bash as the default shell (maintainer convenience only)
```
yum install chsh
chsh -s /QOpenSys/pkgs/bin/bash
```
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
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
15 changes: 13 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,17 @@
- "{{ 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
4 changes: 4 additions & 0 deletions ansible/roles/baselayout/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ packages: {
'bash,cmake,gcc-c++,gcc6-c++,tar,unzip,git,make,sudo',
],

ibmi: [
'autoconf,automake,ca-certificates-mozilla,ccache,cmake,coreutils-gnu,gcc,gcc-cplusplus,gcc-cpp,git,libstdcplusplus-devel,m4-gnu,openssl-devel,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
27 changes: 23 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,24 @@
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)'"
args:
creates: "/QSYS.LIB/IOJS.USRPRF"

- 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 +52,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 @@ -313,7 +328,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
11 changes: 11 additions & 0 deletions ansible/roles/jenkins-worker/tasks/partials/tap2junit/ibmi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

#
# install tap2junit ibmi
#

- name: install tap2junit
pip:
name: tap2junit
state: present
executable: /QOpenSys/pkgs/bin/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
26 changes: 26 additions & 0 deletions ansible/roles/jenkins-worker/templates/ibmi_start.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/QOpenSys/pkgs/bin/bash
CIJOBNAME="JENKINS_CI"
SBMJOB_OPTS="JOB($CIJOBNAME) 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 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=Y

unset LC_ALL

if [[ $(/QOpenSys/usr/bin/system "WRKACTJOB JOB($CIJOBNAME)" | grep -i $CIJOBNAME | wc -l) != "1" ]]
then
echo "Job already running"
exit 1
fi

export START_CMD="{{ java_path[os] }} -Xmx{{ server_ram|default('128m') }} -Dos400.stdio.convert=N -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 -v -kpiveO "SBMJOB CMD(QSH CMD('echo starting Jenkins slave && cd $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
4 changes: 3 additions & 1 deletion ansible/roles/package-upgrade/tasks/partials/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
#

- name: upgrade installed packages
yum: name=* state=latest
yum: name=* state=latest use_backend=yum
# If difficulty recognizing yum is encountered, see https://github.com/ansible/ansible/pull/69484, it is possible
# to apply that patch manually to a local install of ansible (if necessary).
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