-
-
Notifications
You must be signed in to change notification settings - Fork 764
Packaging: Add venv and packs to deb/rpm packages #6328
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
Conversation
The Enterprise Linux versions are lagging behind python. I vote:
|
There was a multi-minute difference between el8 and el9. The compression algorithm is the only significant difference, so I timed building the same el8 package with different algorithms. - xz and lzma were the slowest at over 3 minutes. - gzip and zstd were the fastest at under 1 minute (at any level). The size differences were marginal, but zstd:best was the closest match in size to xz, so I used that to keep the package size as small as possible while speeding up the package build process.
I modified the package deps so that pexes for all supported python versions are included. I also modified the post-install.sh script to create a symlink at I included a bugfix for NOTE: when we start making releases with pants, we need to:
|
Reviewers: Please respond to the Open Questions section below.
This PR is working towards doing packaging via pantsbuild. Eventually, I hope to archive and stop using st2-packages.git.
Previous PRs in this series:
nfpm_deb_package
andnfpm_rpm_package
) was added in Packaging: Add basic BUILD metadata for rpm/deb packages #6325 along with the deb maintainer scripts and rpm scriptlets.This PR adds the virtualenv (by way of
st2.pex
added in #6307) and packs (by way of pack archives added in #6311). Both st2.pex and the pack archives get extracted by the post install deb maintainer script or rpm scriptlet (added in #6320).Virtualenv (
st2.pex
)For the virtualenv, we add an
nfpm_content_file
target forst2.pex
:st2/packaging/BUILD.venv
Lines 84 to 90 in 850cc78
This target is parametrized to produce a pex for each python minor version we support. Because the parametrization was very repetitive, I added this helper to simplify defining each of them:
st2/packaging/BUILD.venv
Lines 76 to 81 in 850cc78
Then, this is how we use that helper to actually parametrize the st2.pex target for each python minor version:
st2/packaging/BUILD.venv
Lines 91 to 94 in 850cc78
Then we add a dependency to the
nfpm_content_file
target on thenfpm_deb_package
target and thenfpm_rpm_package
target:st2/packaging/BUILD
Lines 25 to 31 in 1ebd199
st2/packaging/BUILD
Line 50 in 1ebd199
st2/packaging/BUILD
Line 85 in 1ebd199
I have an open question (below) about how tightly we should couple a python version to an OS. Based on feedback here and in the TSC meeting, we will not couple the OS with the python version. If someone wants to use pyenv or otherwise install a different (typically newer) version of python, they should be able to do that simply without fighting with the system package.
Packs (pack archives)
First, we add an
nfpm_content_file
target to thest2_pack_archive(...)
macro:st2/pants-plugins/macros.py
Lines 173 to 181 in 850cc78
Then we add some generic
target
s to make it easier for the deb/rpm packages to depend on all the pack archives.st2/packaging/BUILD.packs
Lines 17 to 25 in 850cc78
The post-install scripts only install the default packs, which are defined in 3 places:
st2/packaging/BUILD.packs
Lines 1 to 8 in 850cc78
st2/packaging/deb/scripts/post-install.sh
Lines 32 to 39 in 850cc78
st2/packaging/rpm/scripts/post-install.sh
Lines 10 to 17 in 850cc78
Plus the post-install scripts install the
examples
pack in/usr/share/doc/st2/examples
:st2/packaging/deb/scripts/post-install.sh
Line 113 in 850cc78
st2/packaging/rpm/scripts/post-install.sh
Line 49 in 850cc78
So, we need the packs that get installed by default, and the
examples
pack. The rest of the packs are optional, and have not been made available in older versions of st2. There is an open question (below) about these extra packs:st2/packaging/BUILD.packs
Lines 10 to 15 in 850cc78
Finally, we add a dependency on the
nfpm_content_file
targets to thenfpm_deb_package
andnfpm_rpm_package
targets:st2/packaging/BUILD
Lines 42 to 43 in 850cc78
st2/packaging/BUILD
Lines 77 to 78 in 850cc78
Open Questions
We could include only onest2.pex
on each OS based on which python version is packaged on that OS./opt/stackstorm/install/st2.pex
.:st2_venv@parametrize=py38
.st2.pex
file for each python version we support, on every OS, so that people can easily rebuild the venv when they update to a newer python version._venv_py3(minor)
helper function to definedst=f"/opt/stackstorm/install/st2-py3{minor}.pex"
modify the post-install script to pick which pex to use, or/opt/stackstorm/install/st2.pex -> /opt/stackstorm/install/st2-py38.pex
. Maybe we can record this symlink as aconfig|noreplace
file so that people can modify their preferred python version.pyenv
or appa
to install a newer version of python than the OS packages provide.examples
pack is not optional, as we install it in/usr/share/doc/st2/examples
.debug
pack easier to install would be great, so I'd like to include its pack archive.hello_st2
pack archive? This is the "answer key" for the "Creating your First Pack" tutorial.