diff --git a/.circleci/config.yml b/.circleci/config.yml index f186708..80019ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,10 +9,10 @@ jobs: machine: image: "ubuntu-2204:2023.04.2" working_directory: ~/StackStorm/st2chatops - parallelism: 2 + parallelism: 3 shell: /bin/bash --login environment: - DISTROS: focal el8 + DISTROS: focal el8 el9 ST2_PACKAGES_REPO: https://github.com/StackStorm/st2-packages ST2_TEST_ENVIRONMENT: https://github.com/StackStorm/st2-docker DEPLOY_PACKAGES: 1 @@ -29,7 +29,7 @@ jobs: echo "Cloning ${ST2_DOCKER_BRANCH:-DEPRECATED/all-in-one} branch of st2-docker" git clone --branch ${ST2_DOCKER_BRANCH:-DEPRECATED/all-in-one} --depth 1 ${ST2_TEST_ENVIRONMENT} ~/st2-docker make -C ~/st2-docker env - sudo apt-get update -qq && sudo apt-get install -y rpm jq nodejs net-tools + sudo apt-get update -qq && sudo apt-get install -y rpm jq nodejs net-tools npm gem install package_cloud sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose @@ -37,6 +37,7 @@ jobs: # print versions docker-compose version nodejs -v + npm --version jq --version - run: name: Ensure Docker running @@ -121,7 +122,7 @@ jobs: - image: circleci/ruby:2.7 working_directory: ~/packages environment: - DISTROS: "focal el8" + DISTROS: "focal el8 el9" steps: - attach_workspace: at: /home/circleci diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6e0c05e..e70d314 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,9 @@ Added * A changelog file. Contributed by @nzlosh +* EL9 support and node20 support + + Contributed by @amanda11 Fixed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/Dockerfile b/Dockerfile index bb5889d..0f7051e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ -FROM node:14.17-slim +FROM node:20.11.1-slim RUN apt update && apt install --yes \ - python \ + python3 \ + npm \ libicu-dev \ libxml2-dev \ libexpat1-dev \ @@ -11,6 +12,7 @@ RUN apt update && apt install --yes \ COPY . /app WORKDIR /app +RUN npm install npm@6 -g RUN npm install --production && npm cache verify RUN apt remove --yes \ diff --git a/debian/control b/debian/control index 878d453..ebe97b9 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Vcs-Browser: https://github.com/stackstorm/st2chatops Package: st2chatops Architecture: any Pre-Depends: dpkg (>= 1.16.16) -Depends: nodejs (>= 10.0.0), nodejs (< 15.0.0) +Depends: nodejs (>= 20.0.0) Description: St2Chatops - StackStorm ChatOps. Package providing StackStorm ChatOps functionality: bundled, tested and ready to use Hubot with hubot-stackstorm plugin and additional chat adapters diff --git a/dev/Dockerfile b/dev/Dockerfile index 2c40003..469f971 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -1,4 +1,4 @@ -FROM node:10.15-slim +FROM node:20.11.1-slim RUN apt-get update && apt-get install -y \ python \ diff --git a/docker-compose.yml b/docker-compose.yml index 6d9e5c3..3349bb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,12 @@ el8: file: docker-compose.override.yml service: suite +el9: + build: ./packagingenv/rockylinux9 + extends: + file: docker-compose.override.yml + service: suite + # Testing environments focal-test: build: ./testingenv/focal @@ -24,3 +30,9 @@ el8-test: file: docker-compose.override.yml service: suite-test +el9-test: + build: ./testingenv/rockylinux9 + extends: + file: docker-compose.override.yml + service: suite-test + diff --git a/package.json b/package.json index 0ad8d6d..6e43234 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "botbuilder": "^3.30.0", "coffee-register": "1.0.0", "coffee-script": "1.12.7", + "coffeescript": "1.12.7", "hubot": "^3.5.0", "hubot-botframework": "git+https://github.com/microsoft/BotFramework-Hubot.git#01d5be9", "hubot-diagnostics": "0.0.2", @@ -25,6 +26,6 @@ "hubot-xmpp": "^0.2.6" }, "engines": { - "node": ">=10.0 <=14.0" + "node": ">=20.0" } } diff --git a/packagingenv/Dockerfile.template b/packagingenv/Dockerfile.template index 96eb47b..7eeb212 100755 --- a/packagingenv/Dockerfile.template +++ b/packagingenv/Dockerfile.template @@ -4,13 +4,12 @@ FROM {{ dist }}:{{ version }} RUN yum -y install gcc-c++ make git libicu-devel rpmdevtools -# Add NodeSource repo -RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - - -{%- if version in ('centos8', 'rockylinux8') %} +{%- if version in ('centos9', 'rockylinux9') %} +RUN yum -y install systemd-rpm-macros +{% endif %} -# Install development tools -RUN yum -y module install nodejs:10 +# Install node +RUN yum -y module install nodejs:20 # Install python3 for gyp RUN yum -y install python3 @@ -18,29 +17,35 @@ RUN yum -y install python3 # Upgrade gyp to a python3 compatible version RUN npm install -g node-gyp@latest -{%- endif %} +# Downgrade npm +RUN npm install -g npm@6 -# Install development tools -RUN yum -y install nodejs +# Install node +RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash && \ + source ~/.bashrc && \ + nvm install 20.8.1 && \ + node -v && npm -v {% else -%} # Install prerequisites RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install \ - build-essential curl gnupg devscripts debhelper dh-make git libicu-dev + build-essential curl gnupg devscripts debhelper dh-make git libicu-dev curl {%- if version in ('focal') %} RUN DEBIAN_FRONTEND=noninteractive apt-get -y install dh-systemd {% endif %} # Add NodeSource repo -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - # Install node RUN DEBIAN_FRONTEND=noninteractive apt-get -y install nodejs RUN apt-get clean +RUN npm install -g npm@6 + {% endif -%} diff --git a/packagingenv/focal/Dockerfile b/packagingenv/focal/Dockerfile index 322bf20..c6b0c89 100644 --- a/packagingenv/focal/Dockerfile +++ b/packagingenv/focal/Dockerfile @@ -3,17 +3,18 @@ FROM ubuntu:focal # Install prerequisites RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install \ - build-essential curl gnupg devscripts debhelper dh-make git libicu-dev + build-essential curl gnupg devscripts debhelper dh-make git libicu-dev curl RUN DEBIAN_FRONTEND=noninteractive apt-get -y install dh-systemd - # Add NodeSource repo -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - # Install node RUN DEBIAN_FRONTEND=noninteractive apt-get -y install nodejs RUN apt-get clean +RUN npm install -g npm@6 + COPY docker-entrypoint.sh /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/packagingenv/rockylinux8/Dockerfile b/packagingenv/rockylinux8/Dockerfile index d96bfde..b972227 100644 --- a/packagingenv/rockylinux8/Dockerfile +++ b/packagingenv/rockylinux8/Dockerfile @@ -2,11 +2,8 @@ FROM rockylinux:8 RUN yum -y install gcc-c++ make git libicu-devel rpmdevtools -# Add NodeSource repo -RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - - -# Install development tools -RUN yum -y module install nodejs:10 +# Install node +RUN yum -y module install nodejs:20 # Install python3 for gyp RUN yum -y install python3 @@ -14,8 +11,8 @@ RUN yum -y install python3 # Upgrade gyp to a python3 compatible version RUN npm install -g node-gyp@latest -# Install development tools -RUN yum -y install nodejs +# Downgrade npm +RUN npm install -g npm@6 COPY docker-entrypoint.sh /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/packagingenv/rockylinux9/Dockerfile b/packagingenv/rockylinux9/Dockerfile new file mode 100644 index 0000000..499afb0 --- /dev/null +++ b/packagingenv/rockylinux9/Dockerfile @@ -0,0 +1,24 @@ +FROM rockylinux:9 + +RUN yum -y install gcc-c++ make git libicu-devel rpmdevtools + +RUN yum -y install systemd-rpm-macros + +# Install node +RUN yum -y module install nodejs:20 +RUN node --version + +# Install python3 for gyp +RUN yum -y install python3 + +# Upgrade gyp to a python3 compatible version +RUN npm install -g node-gyp@latest + +# Install development tools +#RUN yum -y install nodejs:20.1.1 + +# Downgrade npm +RUN npm install -g npm@6 + +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/packagingenv/rockylinux9/docker-entrypoint.sh b/packagingenv/rockylinux9/docker-entrypoint.sh new file mode 100755 index 0000000..7745d54 --- /dev/null +++ b/packagingenv/rockylinux9/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eu +set -o pipefail + +operation="${1:-build}" + +case "$operation" in +pull) + ;; +build) + rpmbuild -bb rpm/st2chatops.spec + cp ../*.rpm $ARTIFACT_DIR + ;; +*) + [[ $# -gt 0 ]] && exec "$@" + ;; +esac diff --git a/rpm/st2chatops.spec b/rpm/st2chatops.spec index f92ca50..a35ac92 100644 --- a/rpm/st2chatops.spec +++ b/rpm/st2chatops.spec @@ -8,7 +8,7 @@ Name: st2chatops Version: %{version} Release: %{release} -Requires: nodejs >= 2:10.0, nodejs < 2:15.0 +Requires: nodejs >= 20.0 Summary: St2Chatops - StackStorm ChatOps @@ -30,6 +30,9 @@ Requires: /bin/bash Requires: /bin/sh Requires: /usr/bin/env %endif +%if 0%{?rhel} >= 9 +BuildRequires: systemd-rpm-macros +%endif # Cat debian/package.dirs, set buildroot prefix and create directories. %define debian_dirs cat debian/%{name}.dirs | grep -v '^\\s*#' | sed 's~^~%{buildroot}/~' | \ diff --git a/testingenv/Dockerfile.template b/testingenv/Dockerfile.template index cfe14da..c21aaf3 100644 --- a/testingenv/Dockerfile.template +++ b/testingenv/Dockerfile.template @@ -2,11 +2,8 @@ FROM {{ dist }}:{{ version }} {% if dist in ('centos', 'fedora', 'rockylinux') -%} -# Add NodeSource repo -RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - - # Install development tools -RUN yum -y install nodejs +RUN yum -y module install nodejs:20 {% else -%} diff --git a/testingenv/focal/Dockerfile b/testingenv/focal/Dockerfile index 1567a0e..2fdafa4 100644 --- a/testingenv/focal/Dockerfile +++ b/testingenv/focal/Dockerfile @@ -5,7 +5,7 @@ RUN apt-get clean && apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install curl gnupg # Add NodeSource repo -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - # Install node RUN apt-get update && \ diff --git a/testingenv/rockylinux8/Dockerfile b/testingenv/rockylinux8/Dockerfile index 426db9a..a7a91ed 100755 --- a/testingenv/rockylinux8/Dockerfile +++ b/testingenv/rockylinux8/Dockerfile @@ -1,10 +1,7 @@ FROM rockylinux:8 -# Add NodeSource repo -RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash - - # Install development tools -RUN yum -y install nodejs +RUN yum -y module install nodejs:20 COPY docker-entrypoint.sh /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/testingenv/rockylinux9/Dockerfile b/testingenv/rockylinux9/Dockerfile new file mode 100755 index 0000000..8ca44a3 --- /dev/null +++ b/testingenv/rockylinux9/Dockerfile @@ -0,0 +1,7 @@ +FROM rockylinux:9 + +# Install development tools +RUN yum -y module install nodejs:20 + +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/testingenv/rockylinux9/docker-entrypoint.sh b/testingenv/rockylinux9/docker-entrypoint.sh new file mode 100755 index 0000000..a4fdaf1 --- /dev/null +++ b/testingenv/rockylinux9/docker-entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -eu +set -o pipefail + +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