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

Packaging: extract venv (from pex) and packs (from archives) during rpm/deb post-install #6320

Merged
merged 3 commits into from
Mar 24, 2025
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
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions packaging/deb/scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -83,8 +92,26 @@ systemd_enable_and_restart() {
fi
}

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 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}
;;
Expand Down
27 changes: 27 additions & 0 deletions packaging/rpm/scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,6 +30,24 @@ st2timersengine
st2workflowengine
"

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 "${@}"
}

# 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.
# %systemd_post
Expand Down
Loading