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

Node 20 and EL9 #189

Merged
merged 17 commits into from
Apr 23, 2024
Merged
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
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,14 +29,15 @@ 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
rm -rf node_modules
# print versions
docker-compose version
nodejs -v
npm --version
jq --version
- run:
name: Ensure Docker running
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Added
* A changelog file.

Contributed by @nzlosh
* EL9 support and node20 support

Contributed by @amanda11

Fixed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.15-slim
FROM node:20.11.1-slim

RUN apt-get update && apt-get install -y \
python \
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -25,6 +26,6 @@
"hubot-xmpp": "^0.2.6"
},
"engines": {
"node": ">=10.0 <=14.0"
"node": ">=20.0"
}
}
27 changes: 16 additions & 11 deletions packagingenv/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,48 @@ 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

# 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 -%}

Expand Down
7 changes: 4 additions & 3 deletions packagingenv/focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
11 changes: 4 additions & 7 deletions packagingenv/rockylinux8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ 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

# 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" ]
24 changes: 24 additions & 0 deletions packagingenv/rockylinux9/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
18 changes: 18 additions & 0 deletions packagingenv/rockylinux9/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion rpm/st2chatops.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}/~' | \
Expand Down
5 changes: 1 addition & 4 deletions testingenv/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}

Expand Down
2 changes: 1 addition & 1 deletion testingenv/focal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
5 changes: 1 addition & 4 deletions testingenv/rockylinux8/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
7 changes: 7 additions & 0 deletions testingenv/rockylinux9/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
28 changes: 28 additions & 0 deletions testingenv/rockylinux9/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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