From 6f9b2c8652ab2b97232a0d98cad15dd724b7fc57 Mon Sep 17 00:00:00 2001 From: amanda Date: Thu, 2 Jul 2020 13:39:36 +0100 Subject: [PATCH 1/2] Remove EL6 from chatops --- .circleci/config.yml | 6 +++--- docker-compose.yml | 12 ----------- packagingenv/Dockerfile.template | 11 ---------- packagingenv/centos6/Dockerfile | 19 ----------------- packagingenv/centos6/docker-entrypoint.sh | 15 -------------- testingenv/centos6/Dockerfile | 10 --------- testingenv/centos6/docker-entrypoint.sh | 25 ----------------------- 7 files changed, 3 insertions(+), 95 deletions(-) delete mode 100755 packagingenv/centos6/Dockerfile delete mode 100755 packagingenv/centos6/docker-entrypoint.sh delete mode 100755 testingenv/centos6/Dockerfile delete mode 100755 testingenv/centos6/docker-entrypoint.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index c4ef166..63a0289 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,10 +9,10 @@ jobs: build: machine: true working_directory: ~/StackStorm/st2chatops - parallelism: 5 + parallelism: 4 shell: /bin/bash --login environment: - DISTROS: xenial bionic el6 el7 el8 + DISTROS: xenial bionic el7 el8 ST2_PACKAGES_REPO: https://github.com/StackStorm/st2-packages ST2_TEST_ENVIRONMENT: https://github.com/StackStorm/st2-docker DEPLOY_PACKAGES: 1 @@ -107,7 +107,7 @@ jobs: - image: circleci/ruby:2.4 working_directory: ~/packages environment: - DISTROS: "xenial bionic el6 el7 el8" + DISTROS: "xenial bionic el7 el8" steps: - attach_workspace: at: /home/circleci diff --git a/docker-compose.yml b/docker-compose.yml index 52ab322..674b1b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,12 +23,6 @@ el7: file: docker-compose.override.yml service: suite -el6: - build: ./packagingenv/centos6 - extends: - file: docker-compose.override.yml - service: suite - # Testing environments xenial-test: build: ./testingenv/xenial @@ -53,9 +47,3 @@ el7-test: extends: file: docker-compose.override.yml service: suite-test - -el6-test: - build: ./testingenv/centos6 - extends: - file: docker-compose.override.yml - service: suite-test diff --git a/packagingenv/Dockerfile.template b/packagingenv/Dockerfile.template index 21f120b..f2a1a61 100755 --- a/packagingenv/Dockerfile.template +++ b/packagingenv/Dockerfile.template @@ -4,17 +4,6 @@ FROM {{ dist }}:{{ version }} RUN yum -y install gcc-c++ make git libicu-devel rpmdevtools -{%- if version in ('centos6') %} - -RUN wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo && \ - yum -y install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ - -ENV CC /opt/rh/devtoolset-2/root/usr/bin/gcc -ENV CPP /opt/rh/devtoolset-2/root/usr/bin/cpp -ENV CXX /opt/rh/devtoolset-2/root/usr/bin/c++ - -{%- endif %} - # Add NodeSource repo RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - diff --git a/packagingenv/centos6/Dockerfile b/packagingenv/centos6/Dockerfile deleted file mode 100755 index 03d0984..0000000 --- a/packagingenv/centos6/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM centos:6 - -RUN yum -y install gcc-c++ make git libicu-devel rpmdevtools - -RUN wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo && \ - yum -y install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ - -ENV CC /opt/rh/devtoolset-2/root/usr/bin/gcc -ENV CPP /opt/rh/devtoolset-2/root/usr/bin/cpp -ENV CXX /opt/rh/devtoolset-2/root/usr/bin/c++ - -# Add NodeSource repo -RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - - -# Install development tools -RUN yum -y install nodejs - -COPY docker-entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/packagingenv/centos6/docker-entrypoint.sh b/packagingenv/centos6/docker-entrypoint.sh deleted file mode 100755 index 1115ce5..0000000 --- a/packagingenv/centos6/docker-entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -operation="${1:-build}" - -case "$operation" in -pull) - ;; -build) - rpmbuild -bb rpm/st2chatops.spec - cp ../*.rpm $ARTIFACT_DIR - ;; -*) - [[ $# -gt 0 ]] && exec "$@" - ;; -esac diff --git a/testingenv/centos6/Dockerfile b/testingenv/centos6/Dockerfile deleted file mode 100755 index 2c0277c..0000000 --- a/testingenv/centos6/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM centos:6 - -# Add NodeSource repo -RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - - -# Install development tools -RUN yum -y install nodejs - -COPY docker-entrypoint.sh /entrypoint.sh -ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/testingenv/centos6/docker-entrypoint.sh b/testingenv/centos6/docker-entrypoint.sh deleted file mode 100755 index 2b6453e..0000000 --- a/testingenv/centos6/docker-entrypoint.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -operation="${1:-test}" - -case "$operation" in -pull) - ;; -test) - yum install -y $ARTIFACT_DIR/*.rpm - cd /opt/stackstorm/chatops - sed -i.bak -r "s/^# (export HUBOT_ADAPTER=slack)/\1/" st2chatops.env - sed -i.bak -r "s/^# (export HUBOT_SLACK_TOKEN.).*/\1$SLACK_TOKEN/" st2chatops.env - sed -i.bak -r "s/^(export ST2_AUTH_USERNAME.).*/\1$ST2_USERNAME/" st2chatops.env - sed -i.bak -r "s/^(export ST2_AUTH_PASSWORD.).*/\1$ST2_PASSWORD/" st2chatops.env - bin/hubot &> /tmp/hubot.log & - sleep 15 - cat /tmp/hubot.log - grep -rq "INFO Connected to Slack RTM" /tmp/hubot.log && \ - grep -rq "INFO [[:digit:]]\+ commands are loaded" /tmp/hubot.log - exit $? - ;; -*) - [[ $# -gt 0 ]] && exec "$@" - ;; -esac From fa22b1f96f5c68104ff269699f3660bb16db562f Mon Sep 17 00:00:00 2001 From: amanda Date: Thu, 2 Jul 2020 17:48:47 +0100 Subject: [PATCH 2/2] Address review comments --- rpm/st2chatops.init | 160 -------------------------------------------- rpm/st2chatops.spec | 12 ---- 2 files changed, 172 deletions(-) delete mode 100644 rpm/st2chatops.init diff --git a/rpm/st2chatops.init b/rpm/st2chatops.init deleted file mode 100644 index 456655a..0000000 --- a/rpm/st2chatops.init +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: st2chatops -# Required-Start: $local_fs $network $named $remote_fs $syslog -# Required-Stop: $local_fs $network $named $remote_fs $syslog -# Short-Description: st2chatops component -# Description: st2chatops - StackStorm service st2chatops -### END INIT INFO - -# st2chatops This shell script takes care of starting and stopping -# st2chatops daemon. -# chkconfig: - 85 15 -# description: st2chatops - StackStorm service st2chatops -# processname: st2chatops - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -DESC="st2chatops" -NAME=st2chatops -DAEMON=/opt/stackstorm/chatops/bin/hubot -DAEMON_ARGS="" -WORKING_DIRECTORY=/opt/stackstorm/chatops -PIDFILE=/var/run/$NAME.pid -LOGFILE=/var/log/st2/$NAME.log -RUNAS_USER="st2" -RUNAS_GROUP="st2" - -lockfile=/var/lock/subsys/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 5 - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME -set +o allexport -DAEMON_ARGS="" - - -# Resemble redhatish daemon behaviour but with group and user available -# -nohup_start() { - local nicelevel corelimit - local pid base= nice= bg= - local runas_user="${RUNAS_USER:-root}" - local runas_group="${RUNAS_GROUP:-root}" - nicelevel=0 - - base=${1##*/} - __pids_var_run "$base" - - [ -n "$pid" ] && return - - # make sure it doesn't core dump anywhere unless requested - corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}" - # if they set NICELEVEL in /etc/sysconfig/foo, honor it - [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL" - - # Echo daemon - [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base" - - # make sure log file exists and owned by the same user - touch $LOGFILE && chown $runas_user:$runas_group $LOGFILE - - # And start it up. - $nice runuser -s /bin/bash -g $runas_group $runas_user -c "$corelimit >/dev/null 2>&1 ; cd $WORKING_DIRECTORY && nohup >$LOGFILE 2>&1 $* &" -} - -# Write pid of a running daemon into the pidfile -# -write_pidfile() { - local currentpid daemon=$1 pidfile=$2 base - base=${daemon##*/} - pidfile=${pidfile:-/var/run/$base.pid} - - sleep 0.1 - currentpid=$(ps -A xo pid,cmd | grep "\bbin/$base\b" | tail -n1 | awk '{print $1}') - [ -n "$currentpid" ] && echo $currentpid > $pidfile -} - -start() { - echo -n $"Starting $NAME: " - nohup_start $DAEMON $DAEMON_ARGS - write_pidfile $DAEMON $PIDFILE - rh_status_q - retval=$? - [ $retval -eq 0 ] && success $"$NAME startup" || failure $"$NAME startup" - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $NAME: " - killproc -p $PIDFILE $DAEMON - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status $NAME -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? diff --git a/rpm/st2chatops.spec b/rpm/st2chatops.spec index ec2f4c1..53961dc 100644 --- a/rpm/st2chatops.spec +++ b/rpm/st2chatops.spec @@ -38,10 +38,6 @@ Requires: /usr/bin/env done \ %{nil} -%if 0%{?_unitdir:1} - %define use_systemd 1 -%endif - %description Package providing StackStorm ChatOps functionality: bundled, tested and ready to use Hubot @@ -57,11 +53,7 @@ Requires: /usr/bin/env %install %debian_dirs %make_install -%if 0%{?use_systemd} install -D -p -m0644 %{_builddir}/rpm/st2chatops.service %{buildroot}%{_unitdir}/st2chatops.service -%else - install -D -p -m0755 %{_builddir}/rpm/st2chatops.init %{buildroot}%{_sysconfdir}/rc.d/init.d/st2chatops -%endif %clean rm -rf %{buildroot} @@ -73,11 +65,7 @@ Requires: /usr/bin/env /opt/stackstorm/chatops/* %attr(755, st2, root) %{_localstatedir}/log/st2 %config(noreplace) %{_sysconfdir}/logrotate.d/st2chatops -%if 0%{?use_systemd} %{_unitdir}/st2chatops.service -%else - %{_sysconfdir}/rc.d/init.d/st2chatops -%endif %config(noreplace) /opt/stackstorm/chatops/st2chatops.env %config(noreplace) /opt/stackstorm/chatops/external-scripts.json