Skip to content
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 #6320 #6321 #6323 #6324
#6311 #6314 #6315 #6317 #6319 #6312 #6320 #6321 #6323 #6324 #6325
Contributed by @cognifloyd
* Build of ST2 EL9 packages #6153
Contributed by @amanda11
Expand Down
81 changes: 81 additions & 0 deletions packaging/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Relevant nFPM docs:
# - https://www.pantsbuild.org/stable/reference/targets/nfpm_deb_package
# - https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package
# - arch: https://nfpm.goreleaser.com/goarch-to-pkg/

_pkg_description = """
StackStorm Event-driven automation
Package is full standalone st2 installation including all components
in a pre-built venv.
"""
_common_pkg_metadata = dict(
package_name="st2",
description=_pkg_description,
homepage="https://stackstorm.com",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# https://jfearn.fedorapeople.org/en-US/RPM/4/html-single/RPM_Guide/index.html#idp3030720
license="Apache-2.0", # TODO: nFPM is putting this under Copyright tag instead of License
Comment on lines +15 to +16
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version="", # injected by pants-plugins/release
# arch used to be "any", but that was not correct as the venv has compiled packages.
arch="amd64", # NOTE: parametrize this if adding support for arm64 or other arch.
Comment on lines +18 to +19
Copy link
Member Author

@cognifloyd cognifloyd Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From:

Also, this uses the ARCH defined in golang which gets translated to the package-specific architecture. So, amd64 becomes x86_64 for rpm, but remains amd64 for deb. This page shows how that translation happens (though the doc is slightly incorrect here as amd64 does not get translated to x86_64 for deb files): https://nfpm.goreleaser.com/goarch-to-pkg/

See:

platform="linux",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just needed for nfpm. I included it here to be explicit instead of relying on the default value linux. 🤷 We can drop this line if anyone doesn't like it here.

See:

)
_maintainer = "StackStorm Engineering <opsadmin@stackstorm.com>" # TODO: update this
Copy link
Member Author

@cognifloyd cognifloyd Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From:

I don't think that is the best name/email to use here, but I just copied it for now. Maybe it should be:

Suggested change
_maintainer = "StackStorm Engineering <opsadmin@stackstorm.com>" # TODO: update this
_maintainer = "The StackStorm Project <info@stackstorm.com>"

See:



def _distro(distro_id: str, **kwargs):
return parametrize(
distro_id,
distro_id=distro_id,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the distro_id field added in #6324.

**kwargs,
)


nfpm_deb_package(
name="st2.deb",
dependencies=[
"./deb/scripts",
],
scripts=dict(
preinstall="deb/scripts/pre-install.sh",
postinstall="deb/scripts/post-install.sh",
preremove="deb/scripts/pre-remove.sh",
postremove="deb/scripts/post-remove.sh",
# config="",
# templates="",
# rules="",
),
maintainer=_maintainer,
fields={
# https://www.debian.org/doc/debian-policy/ch-controlfields.html#source
# We do not have an "st2" source package, so do not include "Source".
Comment on lines +49 to +50
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From (deb): https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/packages/st2/debian/control#L1
As the comment mentions, I did not copy the Source field because its purpose is to identify which package has the sources. We're not producing a source package, so we should not include this. If someone needs sources, they can use the git repo(s).

# https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-vcs-fields
"Vcs-Git": "git://github.com/stackstorm/st2.git",
"Vcs-Browser": "https://github.com/stackstorm/st2",
Comment on lines +51 to +53
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
section="python",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priority="optional",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**_common_pkg_metadata,
**_distro("focal"),
)

nfpm_rpm_package(
name="st2.rpm",
dependencies=[
"./rpm/scripts",
],
scripts=dict(
preinstall="rpm/scripts/pre-install.sh",
postinstall="rpm/scripts/post-install.sh",
preremove="rpm/scripts/pre-remove.sh",
postremove="rpm/scripts/post-remove.sh",
# pretrans="",
# posttrans="",
# verify="",
),
vendor="The StackStorm Project",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new. It was not in st2-packages.git. It is not used in Fedora, so we don't have to include it.

See: https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package#vendor

packager=_maintainer,
# group="System/Management", # was only useful for EL 5 and earlier
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From (rpm): https://github.com/StackStorm/st2-packages/blob/d4d2d8dfdf1c88412e5d58635adb87da9c671952/rpmspec/st2pkg_toptags.spec#L15

We no longer support EL 5 or earlier, so we should probably just drop this line instead of commenting it out. Right?

Suggested change
# group="System/Management", # was only useful for EL 5 and earlier

See: https://www.pantsbuild.org/stable/reference/targets/nfpm_rpm_package#group

**_common_pkg_metadata,
**_distro("el8", compression="xz"),
**_distro("el9", compression="zstd:default"),
)
Loading