From 149e8913e17f3a04e0efe247f6778ee5a1107fd7 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 8 Jan 2025 15:39:07 -0600 Subject: [PATCH 1/3] Packaging: Build st2 virtualenv in post-install.sh scripts --- packaging/deb/scripts/post-install.sh | 7 +++++++ packaging/rpm/scripts/post-install.sh | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/packaging/deb/scripts/post-install.sh b/packaging/deb/scripts/post-install.sh index 539fe027ef..283908ae9e 100644 --- a/packaging/deb/scripts/post-install.sh +++ b/packaging/deb/scripts/post-install.sh @@ -83,8 +83,15 @@ systemd_enable_and_restart() { fi } +rebuild_st2_venv() { + /opt/stackstorm/install/st2.pex +} + case "$1" in configure) + # Fail install if venv build fails + rebuild_st2_venv || exit $? + # shellcheck disable=SC2086 systemd_enable_and_restart ${_ST2_SERVICES} ;; diff --git a/packaging/rpm/scripts/post-install.sh b/packaging/rpm/scripts/post-install.sh index 264dd0616f..504288e98e 100644 --- a/packaging/rpm/scripts/post-install.sh +++ b/packaging/rpm/scripts/post-install.sh @@ -21,6 +21,13 @@ st2timersengine st2workflowengine " +rebuild_st2_venv() { + /opt/stackstorm/install/st2.pex +} + +# Fail install if venv build fails +rebuild_st2_venv || exit $? + # Native .rpm specs use macros that get expanded into shell snippets. # We are using nfpm, so we inline the macro expansion here. # %systemd_post From b9a1fdf00358474fd6ee7ccaaecbe1f17534ad68 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 8 Jan 2025 15:40:12 -0600 Subject: [PATCH 2/3] Packaging: Extract st2 packs in post-install.sh scripts --- packaging/deb/scripts/post-install.sh | 22 +++++++++++++++++++++- packaging/rpm/scripts/post-install.sh | 22 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/packaging/deb/scripts/post-install.sh b/packaging/deb/scripts/post-install.sh index 283908ae9e..27bb66a7e0 100644 --- a/packaging/deb/scripts/post-install.sh +++ b/packaging/deb/scripts/post-install.sh @@ -29,6 +29,15 @@ set -e # https://www.mankier.com/5/deb-triggers # https://stackoverflow.com/questions/15276535/dpkg-how-to-use-trigger +# The default set of packs installed with st2. +_ST2_PACKS=" +chatops +core +default +linux +packs +" + # This must include ".service" to satisfy deb-systemd-{helper,invoke} _ST2_SERVICES=" st2actionrunner.service @@ -87,10 +96,21 @@ rebuild_st2_venv() { /opt/stackstorm/install/st2.pex } +extract_st2_pack() { + pack=${1} + shift + # shellcheck disable=SC2209 + PAGER=cat /opt/stackstorm/install/packs/"${pack}".tgz.run --quiet --accept "${@}" +} + case "$1" in configure) - # Fail install if venv build fails + # Fail install if venv build or pack extraction fails rebuild_st2_venv || exit $? + for pack in ${_ST2_PACKS}; do + extract_st2_pack "${pack}" || exit $? + done + extract_st2_pack examples --target /usr/share/doc/st2/examples || : # shellcheck disable=SC2086 systemd_enable_and_restart ${_ST2_SERVICES} diff --git a/packaging/rpm/scripts/post-install.sh b/packaging/rpm/scripts/post-install.sh index 504288e98e..a7909c3f18 100644 --- a/packaging/rpm/scripts/post-install.sh +++ b/packaging/rpm/scripts/post-install.sh @@ -7,6 +7,15 @@ set -e # * on upgrade: $1 > 1 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax +# The default set of packs installed with st2. +_ST2_PACKS=" +chatops +core +default +linux +packs +" + _ST2_SERVICES=" st2actionrunner st2api @@ -25,8 +34,19 @@ rebuild_st2_venv() { /opt/stackstorm/install/st2.pex } -# Fail install if venv build fails +extract_st2_pack() { + pack=${1} + shift + # shellcheck disable=SC2209 + PAGER=cat /opt/stackstorm/install/packs/"${pack}".tgz.run --quiet --accept "${@}" +} + +# Fail install if venv build or pack extraction fails rebuild_st2_venv || exit $? +for pack in ${_ST2_PACKS}; do + extract_st2_pack "${pack}" || exit $? +done +extract_st2_pack examples --target /usr/share/doc/st2/examples || : # Native .rpm specs use macros that get expanded into shell snippets. # We are using nfpm, so we inline the macro expansion here. From 9a2b69d8458d32cd9dda59d2772ae5ddb26d42e0 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 19 Mar 2025 17:13:02 -0500 Subject: [PATCH 3/3] add merge conflict magnet --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 49ecc1744c..b2e24e4508 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -79,7 +79,7 @@ Added to pants' use of PEX lockfiles. This is not a user-facing addition. #6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253 #6254 #6258 #6259 #6260 #6269 #6275 #6279 #6278 #6282 #6283 #6273 #6287 #6306 #6307 - #6311 #6314 #6315 #6317 #6319 #6312 + #6311 #6314 #6315 #6317 #6319 #6312 #6320 Contributed by @cognifloyd * Build of ST2 EL9 packages #6153 Contributed by @amanda11