Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CentOS 6 Update + devtoolset-6 option #1223

Closed
wants to merge 7 commits into from
Closed
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
2 changes: 1 addition & 1 deletion ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ hosts:

- softlayer:
centos5-x86-1: {ip: 50.23.85.253}
centos6-x64-1: {ip: 50.97.245.10}
centos6-x64-1: {ip: 169.62.77.228}

- linuxonecc:
rhel72-s390x-1: {ip: 148.100.110.65}
Expand Down
5 changes: 5 additions & 0 deletions ansible/roles/baselayout/files/centos-aarch-sclo.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[sclo-aarch64]
name=CentOS-$releasever - AArch64 SCLo
baseurl=http://mirror.centos.org/altarch/$releasever/sclo/aarch64/rh/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
14 changes: 14 additions & 0 deletions ansible/roles/baselayout/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,20 @@
stat: path="{{ binary_dest }}"
register: has_git

- name: centos | remove existing git package
when: "(os == 'centos6' or os == 'centos7') and arch != 'arm64'"
yum:
name: "git"
state: absent

- name: install packages
when: not os|startswith("zos")
package: name="{{ package }}" state=present
loop_control:
loop_var: package
with_items:
# ansible doesn't like empty lists
- "{{ packages[os+'_'+arch]|default('[]') }}"
- "{{ packages[os]|default('[]') }}"
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"
Expand All @@ -73,6 +80,13 @@
- gcc
- g++

- name: centos6 | install devtoolset-2
when: "os == 'centos6'"
yum:
disable_gpg_check: true
name: "devtoolset-2-gcc,devtoolset-2-gcc-c++"
state: present

- name: remove fortune from login shells
when: os|stripversion == 'freebsd'
lineinfile:
Expand Down
36 changes: 19 additions & 17 deletions ansible/roles/baselayout/tasks/partials/repo/centos6.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
---

#
# centos6 - almost getting there
#

- name: "repo : add scl devtoolset"
yum_repository:
baseurl: http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
gpgkey: http://ftp.scientificlinux.org/linux/scientific/5x/{{ ansible_architecture }}/RPM-GPG-KEYs/RPM-GPG-KEY-cern
gpgcheck: yes

- name: "repo : add scl"
yum_repository:
baseurl: http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo
gpgkey: http://ftp.scientificlinux.org/linux/scientific/5x/{{ ansible_architecture }}/RPM-GPG-KEYs/RPM-GPG-KEY-cern
gpgcheck: yes
- name: centos6 | install epel
yum:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
state: present

- name: install epel
- name: centos6 | install ius
yum:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm"
name: "https://centos{{ ansible_distribution_major_version }}.iuscommunity.org/ius-release.rpm"
state: present

- name: centos6 | install devtoolset-2 repo
get_url:
url: http://people.centos.org/tru/devtools-2/devtools-2.repo
dest: /etc/yum.repos.d/devtools-2.repo
mode: 0644

- name: centos6 | install devtoolset-6 for i686
when: "arch == 'x86'"
get_url:
url: "https://copr.fedorainfracloud.org/coprs/mlampe/devtoolset-6.1/repo/epel-6/mlampe-devtoolset-6.1-epel-6.repo"
dest: "/etc/yum.repos.d/mlampe-devtoolset-6.1-epel-6.repo"
mode: 0644
24 changes: 22 additions & 2 deletions ansible/roles/baselayout/tasks/partials/repo/centos7.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
---

- name: install epel
- name: centos7 | install epel
yum:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
state: present

- name: centos7 | install ius
when: "arch != 'arm64'"
yum:
name: "https://centos{{ ansible_distribution_major_version }}.iuscommunity.org/ius-release.rpm"
state: present

- name: centos7 | aarch64 | install sclo repo
when: "arch == 'arm64'"
copy:
src: "{{ role_path }}/files/centos-aarch-sclo.repo"
dest: "/etc/yum.repos.d/centos-aarch-sclo.repo"
mode: 0644

- name: centos7 | aarch64 | install sclo repo key
when: "arch == 'arm64'"
get_url:
url: "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-SCLo"
dest: "/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo"
mode: 0644
50 changes: 16 additions & 34 deletions ansible/roles/baselayout/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@ ntp_service: {
}

common_packages: [
'automake',
'bash',
'libtool',
'sudo',
'automake,bash,libtool,sudo',
]

# you can either add os family or os to this list (see smartos)
# but the playbook chooses os over family - not both
packages: {
centos: [
'ccache',
'git',
'gcc-c++', # even need this on centos6 so ccache has symlinks
centos6_x64: ['centos-release-scl'], # only available on x86_64, 32-bit is from https://copr.fedorainfracloud.org/coprs/mlampe
centos6: [
'ccache,git2u,gcc-c++,devtoolset-6', # even need gcc on centos6 so ccache has symlinks
],

centos7_arm64: ['git'], # git2u not available for aarch64 (yet)
centos7_x64: ['git2u','centos-release-scl'], # centos-release-scl is required to enable SCLo
# but we do it manually in partials/repo/centos7.yml for arm64
centos7: [
'ccache,gcc-c++,devtoolset-6',
],

debian7: [
Expand All @@ -55,48 +58,27 @@ packages: {
],

fedora: [
'bzip2',
'ccache',
'gcc-c++',
'git',
'fontconfig',
'bzip2,ccache,gcc-c++,git,fontconfig',
],

freebsd: [
'ccache',
'git',
'gmake'
'ccache,git,gmake'
],

rhel72: [
'gcc-c++',
],

smartos14: [
'gcc48',
'gcc48-libs',
'gccmakedep',
'git',
'gmake',
'xz'
'gcc48,gcc48-libs,gccmakedep,git,gmake,xz'
],

smartos15: [
'gcc49',
'gcc49-libs',
'gccmakedep',
'git',
'gmake',
'xz'
'gcc49,gcc49-libs,gccmakedep,git,gmake,xz'
],

smartos16: [
'gcc49',
'gcc49-libs',
'gccmakedep',
'git',
'gmake',
'xz'
'gcc49,gcc49-libs,gccmakedep,git,gmake,xz'
],

ubuntu: [
Expand Down
21 changes: 21 additions & 0 deletions ansible/roles/bootstrap/tasks/partials/centos6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

#
# a centos6 bootstrap - copied from fedora
#

- name: check for python
raw: stat /usr/bin/python
register: has_python
failed_when: has_python.rc > 1

- name: check for libselinux-python bindings
raw: yum info libselinux-python | grep Installed
register: has_libselinux
failed_when: has_libselinux.rc > 1

- name: install libselinux-python bindings
raw: yum install -y libselinux-python

- name: disable selinux
selinux: state=disabled
7 changes: 7 additions & 0 deletions ansible/roles/jenkins-worker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@
dest: "{{ jenkins.dest }}"
mode: "{{ jenkins.mode|default('0644') }}"

- name: centos6 | render sysconfig into place
when: "os == 'centos6'"
template:
src: "{{ role_path }}/templates/centos6.sysconfig.j2"
dest: "/etc/sysconfig/jenkins"
mode: "0644"

- name: import manifest to svcadm
when: os|startswith("smartos")
raw: "svccfg import {{ jenkins.dest }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
- python-argparse

- name: install tap2junit
raw: easy_install tap2junit
raw: easy_install --index-url https://pypi.python.org/pypi tap2junit

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PIDFILE=/var/run/jenkins/$NAME.pid
JENKINS_SLAVE_USER="iojs"
JENKINS_SLAVE_JAR="/home/{{ server_user }}/slave.jar"
JENKINS_SLAVE_LOG="/home/{{ server_user }}/$NAME.log"
JENKINS_SLAVE_ARGS="-Xmx{{ server_ram|default('128m') }} -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp -secret {{ secret }}"
JENKINS_SLAVE_ARGS="-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp -secret {{ secret }}"
JENKINS_ENV="JOBS={{ ansible_processor_vcpus }} \
HOME=/home/{{ server_user }} \
DESTCPU={{ ansible_architecture }} \
Expand Down
93 changes: 93 additions & 0 deletions ansible/roles/jenkins-worker/templates/centos6.initd.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/sh
#
# /etc/init.d/jenkins
# init script for a jenkins slave.
#
# chkconfig: 345 90 60
# description: jenkins slave
#

RETVAL=0

NAME=`basename "$0"`
JENKINS_CONFIG=/etc/sysconfig/$NAME
LOCK_FILE=/var/lock/$NAME
JAVA=/usr/bin/java
PIDFILE=/var/run/jenkins/$NAME.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Read config
[ -f "$JENKINS_CONFIG" ] && . "$JENKINS_CONFIG"

# Add scl-specific path as well as regular path.
# We add /usr/local/bin since that's where ccache symlinks live
JENKINS_PATH="/usr/local/bin:$JENKINS_PATH:$PATH"

# Replace potentially double colons since they add cwd
JENKINS_PATH="${JENKINS_PATH//::/:}"

slave_start() {
echo Starting $NAME...

mkdir `dirname $PIDFILE` > /dev/null 2>&1 || true
chown $JENKINS_SLAVE_USER `dirname $PIDFILE`

runuser -m -l $JENKINS_SLAVE_USER -c "$JENKINS_ENV PATH=$JENKINS_PATH $JAVA \
-jar $JENKINS_SLAVE_JAR $JENKINS_SLAVE_ARGS > $JENKINS_SLAVE_LOG 2>&1 &"
pgrep -f -u $JENKINS_SLAVE_USER $JENKINS_SECRET > $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
}

slave_stop() {
echo Stopping $NAME...
pid=`cat $PIDFILE`

killproc -p $PIDFILE

# Wait until the monitor exits
while (checkpid $pid)
do
usleep 100000
done

RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}

slave_restart() {
echo Restarting $NAME...
slave_stop
slave_start

RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
}

slave_status() {
status -p $PIDFILE $NAME
RETVAL=$?
}

case "$1" in
start)
slave_start
;;
stop)
slave_stop
;;
restart)
slave_restart
;;
status)
slave_status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

exit $RETVAL
13 changes: 13 additions & 0 deletions ansible/roles/jenkins-worker/templates/centos6.sysconfig.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
JENKINS_SLAVE_USER="iojs"
JENKINS_SLAVE_JAR="/home/iojs/slave.jar"
JENKINS_SLAVE_LOG="/home/iojs/$NAME.log"
JENKINS_SECRET="{{ secret }}"
JENKINS_SLAVE_ARGS="-jnlpUrl {{ jenkins_url }}/computer/{{ ansible_hostname }}/slave-agent.jnlp -secret $JENKINS_SECRET"
JENKINS_PATH=""
JENKINS_ENV="JOBS={{ jobs_env }} \
HOME=/home/{{ server_user }} \
NODE_TEST_DIR=$HOME/tmp \
DESTCPU={{ server_arch | default(arch) }} \
ARCH={{ server_arch | default(arch) }} \
OSTYPE=linux-gnu \
NODE_COMMON_PIPE=/home/iojs/test.pipe"
12 changes: 9 additions & 3 deletions ansible/roles/jenkins-worker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#

init: {
centos: ['centos5', 'centos6','centos7'],
centos5: 'centos5',
centos6: 'centos6',
debian: ['debian7', 'ubuntu1204'],
freebsd: 'freebsd',
rhel72: 'rhel72',
Expand All @@ -16,9 +17,14 @@ init: {
}

jenkins_init: {
centos: {
centos5: {
dest: '/etc/init.d/jenkins',
src: 'centos.initd.j2',
src: 'centos5.initd.j2',
mode: '0755'
},
centos6: {
dest: '/etc/init.d/jenkins',
src: 'centos6.initd.j2',
mode: '0755'
},
debian: {
Expand Down