diff --git a/ansible/MANUAL_STEPS.md b/ansible/MANUAL_STEPS.md index 402a5e8e1..bccceba29 100644 --- a/ansible/MANUAL_STEPS.md +++ b/ansible/MANUAL_STEPS.md @@ -24,7 +24,7 @@ * [SmartOS](#smartos) * [Raspberry Pi](#raspberry-pi) * [NFS boot](#nfs-boot) - +* [IBM i](#ibm-i) ## Adding firewall entries for Jenkins workers @@ -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 +``` diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 613c4c5e1..5736e9a8f 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -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 diff --git a/ansible/inventory.yml b/ansible/inventory.yml index 8ea9278d2..e81281446 100644 --- a/ansible/inventory.yml +++ b/ansible/inventory.yml @@ -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} @@ -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} diff --git a/ansible/playbooks/jenkins/worker/create.yml b/ansible/playbooks/jenkins/worker/create.yml index f226354c0..24302b455 100644 --- a/ansible/playbooks/jenkins/worker/create.yml +++ b/ansible/playbooks/jenkins/worker/create.yml @@ -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 diff --git a/ansible/roles/baselayout/tasks/main.yml b/ansible/roles/baselayout/tasks/main.yml index d18df07ba..418b38c08 100644 --- a/ansible/roles/baselayout/tasks/main.yml +++ b/ansible/roles/baselayout/tasks/main.yml @@ -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 @@ -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 @@ -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 diff --git a/ansible/roles/baselayout/vars/main.yml b/ansible/roles/baselayout/vars/main.yml index 969dde9ac..bf1f85564 100644 --- a/ansible/roles/baselayout/vars/main.yml +++ b/ansible/roles/baselayout/vars/main.yml @@ -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', ], diff --git a/ansible/roles/java-base/tasks/main.yml b/ansible/roles/java-base/tasks/main.yml index 6c2004208..831409b85 100644 --- a/ansible/roles/java-base/tasks/main.yml +++ b/ansible/roles/java-base/tasks/main.yml @@ -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 diff --git a/ansible/roles/jenkins-worker/tasks/main.yml b/ansible/roles/jenkins-worker/tasks/main.yml index 68dbf1f2e..e019cbd0f 100644 --- a/ansible/roles/jenkins-worker/tasks/main.yml +++ b/ansible/roles/jenkins-worker/tasks/main.yml @@ -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 @@ -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" @@ -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 diff --git a/ansible/roles/jenkins-worker/tasks/partials/tap2junit/ibmi.yml b/ansible/roles/jenkins-worker/tasks/partials/tap2junit/ibmi.yml new file mode 100644 index 000000000..edab7e25c --- /dev/null +++ b/ansible/roles/jenkins-worker/tasks/partials/tap2junit/ibmi.yml @@ -0,0 +1,11 @@ +--- + +# +# install tap2junit ibmi +# + +- name: install tap2junit + pip: + name: tap2junit + state: present + executable: /QOpenSys/pkgs/bin/pip2 diff --git a/ansible/roles/jenkins-worker/tasks/partials/tap2junit/pip.yml b/ansible/roles/jenkins-worker/tasks/partials/tap2junit/pip.yml index 58d907a87..d9d9c60cf 100644 --- a/ansible/roles/jenkins-worker/tasks/partials/tap2junit/pip.yml +++ b/ansible/roles/jenkins-worker/tasks/partials/tap2junit/pip.yml @@ -5,4 +5,4 @@ # - name: install tap2junit - pip: name=tap2junit state=present \ No newline at end of file + pip: name=tap2junit state=present diff --git a/ansible/roles/jenkins-worker/templates/ibmi_start.j2 b/ansible/roles/jenkins-worker/templates/ibmi_start.j2 new file mode 100644 index 000000000..08df232e2 --- /dev/null +++ b/ansible/roles/jenkins-worker/templates/ibmi_start.j2 @@ -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" diff --git a/ansible/roles/jenkins-worker/vars/main.yml b/ansible/roles/jenkins-worker/vars/main.yml index 76844c6d1..5d744cbed 100644 --- a/ansible/roles/jenkins-worker/vars/main.yml +++ b/ansible/roles/jenkins-worker/vars/main.yml @@ -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'], @@ -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 @@ -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', diff --git a/ansible/roles/package-upgrade/tasks/partials/yum.yml b/ansible/roles/package-upgrade/tasks/partials/yum.yml index 5556d23fa..712c03b9c 100644 --- a/ansible/roles/package-upgrade/tasks/partials/yum.yml +++ b/ansible/roles/package-upgrade/tasks/partials/yum.yml @@ -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). diff --git a/ansible/roles/package-upgrade/vars/main.yml b/ansible/roles/package-upgrade/vars/main.yml index c2efea3a1..186cfcb34 100644 --- a/ansible/roles/package-upgrade/vars/main.yml +++ b/ansible/roles/package-upgrade/vars/main.yml @@ -5,7 +5,7 @@ # pm: { - 'yum': ['centos', 'rhel7', 'aix'], + 'yum': ['centos', 'rhel7', 'aix', 'ibmi'], 'apt': ['debian', 'ubuntu'], 'dnf': 'fedora', 'pkg': 'freebsd', diff --git a/jenkins/scripts/select-compiler.sh b/jenkins/scripts/select-compiler.sh index b221ca776..203592562 100644 --- a/jenkins/scripts/select-compiler.sh +++ b/jenkins/scripts/select-compiler.sh @@ -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 @@ -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* )