Skip to content

Commit

Permalink
ansible: refresh cross compiler, include new 4.9.4 toolchain & new se…
Browse files Browse the repository at this point in the history
…lector script
  • Loading branch information
rvagg committed Apr 16, 2018
1 parent f4cd335 commit 4e68a60
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 83 deletions.
3 changes: 2 additions & 1 deletion ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ hosts:
centos6-x86-1: {ip: 162.243.248.28}

- joyent:
smartos13-x64-1: {ip: 72.2.114.225}
smartos14-x64-1: {ip: 72.2.113.193}
smartos15-x64-1: {ip: 165.225.131.14}
smartos17-x64-1: {ip: 72.2.114.225}
ubuntu1604_arm_cross-x64-1: {ip: 72.2.114.100, user: ubuntu}

- requireio:
rvagg-debian9-armv6l_pi1p-1: {ip: 192.168.2.40, user: pi}
Expand Down Expand Up @@ -118,6 +118,7 @@ hosts:
ubuntu1604_docker-x64-1: {ip: 165.225.138.30, user: ubuntu}
ubuntu1710-x64-1: {ip: 37.153.110.33, user: ubuntu}
ubuntu1710-x64-2: {ip: 8.19.32.121, user: ubuntu}
ubuntu1604_arm_cross-x64-1: {ip: 165.225.136.6, user: ubuntu}

- marist:
zos13-s390x-1: {ip: 148.100.36.133, user: Unix1}
Expand Down
15 changes: 0 additions & 15 deletions ansible/playbooks/create-cross-compiler.yml

This file was deleted.

12 changes: 12 additions & 0 deletions ansible/playbooks/jenkins/worker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,15 @@

roles:
- jenkins-workspace

#
# Set up ARM cross compiler servers
#

- hosts:
- test-azure_msft-ubuntu1404-x64-1
- test-joyent-ubuntu1604_arm_cross-x64-1
- release-joyent-ubuntu1604_arm_cross-x64-1

roles:
- cross-compiler
4 changes: 0 additions & 4 deletions ansible/roles/cross-compiler/files/cc-armv6-4.8.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ansible/roles/cross-compiler/files/cc-armv6-4.9.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ansible/roles/cross-compiler/files/cc-armv7-4.8.sh

This file was deleted.

4 changes: 0 additions & 4 deletions ansible/roles/cross-compiler/files/cc-armv7-4.9.sh

This file was deleted.

42 changes: 42 additions & 0 deletions ansible/roles/cross-compiler/files/cc-selector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# create CC, CXX, CC_host and CXX_host environment variables appropriate for the
# worker label in use. Of the form: cross-compiler-(armv[67])-gcc-(4.[89](\.4)?)
# e.g. cross-compiler-armv6-gcc-4.8, or cross-compiler-armv7-gcc-4.9.4

rpi_tools_base="/opt/raspberrypi/tools/"
rpi_newer_tools_base="/opt/raspberrypi/rpi-newer-crosstools/"
base_4_8_armv6="${rpi_tools_base}arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-"
base_4_8_armv7="${rpi_tools_base}arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-"
base_4_9_armv6="${rpi_tools_base}arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-"
base_4_9_armv7="${rpi_tools_base}arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-"
base_4_9_4_armv6="${rpi_newer_tools_base}x64-gcc-4.9.4-binutils-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
base_4_9_4_armv7="${rpi_newer_tools_base}x64-gcc-4.9.4-binutils-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-"
flags_armv6="-march=armv6zk"
flags_armv7="-march=armv7-a"

export arm_type=$(echo $1 | sed -E 's/^cross-compiler-(armv[67])-gcc-(4.[89](\.4)?)/\1/')
export gcc_version=$(echo $1 | sed -E 's/^cross-compiler-(armv[67])-gcc-4\.([89](\.4)?)/4.\2/')
export git_branch="cc-${arm_type}"

if [[ ! "$arm_type" =~ ^armv[67]$ ]]; then
echo "Could not determine ARM type from '$1'"
exit 1
fi
if [[ ! "$gcc_version" =~ ^4\.[89](\.4)?$ ]]; then
echo "Could not determine ARM type from '$1'"
exit 1
fi

gcc_version_safe="$(echo $gcc_version | sed -E 's/\./_/g')"
gcc_host_version="$(echo $gcc_version | sed -E 's/\.4//g')" # 4.9.4 -> 4.9

echo "ARM type: $arm_type, GCC version: $gcc_version"

base_varname="base_${gcc_version_safe}_${arm_type}"
flags_varname="flags_${arm_type}"

export ARCH=$arm_type
export DESTCPU=arm
export CC_host="ccache gcc-${gcc_host_version} -m32"
export CXX_host="ccache g++-${gcc_host_version} -m32"
export CC="ccache ${!base_varname}gcc ${!flags_varname}"
export CXX="ccache ${!base_varname}g++ ${!flags_varname}"
62 changes: 20 additions & 42 deletions ansible/roles/cross-compiler/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
# sets up cross compiler machine
#

- name: General | Install required packages
- name: add ubuntu toolchain ppa
apt_repository:
repo: ppa:ubuntu-toolchain-r/test

- name: upgrade installed packages
apt:
upgrade: dist
update_cache: yes

- name: install required packages
apt:
name: "{{ item }}"
name: "{{ packages }}"
update_cache: yes
state: latest
with_items: "{{ packages }}"

- name: General | Increase file descriptor limits
- name: increase file descriptor limits
lineinfile:
dest: /etc/security/limits.conf
line: "{{ item }}"
Expand All @@ -21,48 +29,18 @@
- "root hard nofile 500000"
- "root soft nofile 500000"

- name: User | Add "{{ server_user }}" user
user:
name: "{{ server_user }}"
shell: /bin/bash

- name: Raspberry | Clone raspberry tools repository
- name: clone raspberry tools repository
git:
repo: https://github.com/raspberrypi/tools.git
dest: /opt/raspberrypi/tools

- name: Raspberry | Copy cc-armv6-4.8.sh script
copy:
src: ./files/cc-armv6-4.8.sh
dest: /opt/raspberrypi/cc-armv6-4.8.sh
mode: 0755

- name: Raspberry | Copy cc-armv7-4.8.sh script
copy:
src: ./files/cc-armv7-4.8.sh
dest: /opt/raspberrypi/cc-armv7-4.8.sh
mode: 0755

- name: Raspberry | Copy cc-armv6-4.9.sh script
copy:
src: ./files/cc-armv6-4.9.sh
dest: /opt/raspberrypi/cc-armv6-4.9.sh
mode: 0755
- name: clone newer raspberry tools repository
git:
repo: https://github.com/rvagg/rpi-newer-crosstools.git
dest: /opt/raspberrypi/rpi-newer-crosstools

- name: Raspberry | Copy cc-armv7-4.9.sh script
- name: copy cc-selector.sh script
copy:
src: ./files/cc-armv7-4.9.sh
dest: /opt/raspberrypi/cc-armv7-4.9.sh
src: ./files/cc-selector.sh
dest: /opt/raspberrypi/cc-selector.sh
mode: 0755

- name: User | Download Jenkins pubkey
get_url:
url: https://gist.githubusercontent.com/nodejs-ci/cea606894437b45e99d0/raw/ci-iojs-org-id_rsa-slaves.pub
dest: /tmp/nodejs-ci.keys
delegate_to: 127.0.0.1
become: no

- name: General | Add Jenkins to authorized_keys for "{{ server_user }}"
authorized_key:
user: "{{ server_user }}"
key: "{{ lookup('file', '/tmp/nodejs-ci.keys') }}"
10 changes: 1 addition & 9 deletions ansible/roles/cross-compiler/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---

packages:
- gcc-4.8-multilib
- g++-4.8-multilib
- gcc-4.9-multilib
- g++-4.9-multilib
- python-all
- python-software-properties
- curl
- monit
packages: make,gcc-4.8-multilib,g++-4.8-multilib,gcc-4.9-multilib,g++-4.9-multilib,python2.7,python-all,python-software-properties,curl
server_user: iojs

0 comments on commit 4e68a60

Please sign in to comment.