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
#6311 #6314 #6315 #6317 #6319 #6312 #6320 #6321 #6323 #6324
Contributed by @cognifloyd
* Build of ST2 EL9 packages #6153
Contributed by @amanda11
Expand Down
6 changes: 5 additions & 1 deletion pants-plugins/release/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
"""

from release.rules import rules as release_rules
from release.target_types import rules as release_target_types_rules


def rules():
return release_rules()
return [
*release_target_types_rules(),
*release_rules(),
]
3 changes: 2 additions & 1 deletion pants-plugins/release/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
packagecloud_get_next_release,
)
from .packagecloud_rules import rules as packagecloud_rules
from .target_types import DistroIDField


REQUIRED_KWARGS = (
Expand Down Expand Up @@ -240,7 +241,7 @@ async def inject_package_fields(
next_release = await packagecloud_get_next_release(
PackageCloudNextReleaseRequest(
nfpm_arch=target[NfpmArchField].value,
distro_id="", # TODO: add field for distro ID
distro_id=target[DistroIDField].value,
package_name=target[NfpmPackageNameField].value,
package_version=version,
production=not is_dev,
Expand Down
52 changes: 52 additions & 0 deletions pants-plugins/release/target_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2025 The StackStorm Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

from pants.backend.nfpm.target_types import NfpmDebPackage, NfpmRpmPackage
from pants.engine.target import StringField
from pants.util.strutil import help_text


class DistroIDField(StringField):
nfpm_alias = "" # Not an nFPM field
alias = "distro_id"
valid_choices = ( # officially supported (or planned future support)
# ubuntu
"focal",
"jammy",
"noble",
# el
"el8",
"el9",
)
required = True
help = help_text(
"""
The package distribution and version.

This is an internal StackStorm field used by pants-plugins/release.
The IDs are StackStorm-specific IDs that get translated into distribution + version.
These examples show how the distro_id gets translated into packagecloud values:
- distro_id "el8" is distro "el" with version "8";
- distro_id "focal" is distro "ubuntu" with version "focal".
"""
)


def rules():
return [
NfpmDebPackage.register_plugin_field(DistroIDField),
NfpmRpmPackage.register_plugin_field(DistroIDField),
]
Loading