Skip to content

json_generator: SLFO PR client-tools URLs; static Salt repos for 4.3/5.0; default 51-sles#1984

Draft
ktsamis wants to merge 1 commit intoSUSE:masterfrom
ktsamis:slfo_json
Draft

json_generator: SLFO PR client-tools URLs; static Salt repos for 4.3/5.0; default 51-sles#1984
ktsamis wants to merge 1 commit intoSUSE:masterfrom
ktsamis:slfo_json

Conversation

@ktsamis
Copy link
Copy Markdown
Member

@ktsamis ktsamis commented Apr 16, 2026

Summary

  • add --slfo-pull-request support for sles160_minion and slmicro62_minion on 5.1/5.2, including beta URL handling
  • move SLES 16 / SL Micro 6.2 client-tools repos out of static 5.1/5.2 definitions so they are only injected when an SLFO PR is provided
  • add static SL Micro 6.0 / 6.1 salt-image repositories for 4.3 and 5.0, and extend static repo initialization to cover 4.3/5.0/5.1/5.2
  • change the default --version to 51-sles and update CLI help/README accordingly
  • fail fast when --slfo-pull-request is used with unsupported versions
  • fix nodes_by_version typing to reflect separate static and dynamic shapes
  • expand and normalize unit tests, including SLFO PR coverage, updated version values, mock timeout compatibility, and cwd-independent testdata paths

Testing

  • PYTHONPATH="susemanager-ci/jenkins_pipelines/scripts/json_generator" python3 -m unittest tests.test_maintenance_json_generator

fixes https://github.com/SUSE/spacewalk/issues/29968

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the maintenance JSON generator to support SLFO PullRequest-driven client-tools repositories for SLES 16 / SL Micro 6.2, and ensures static Salt image repositories are always included for SUMA 4.3 / 5.0 SL Micro minions. It also changes the CLI default version to 51-sles and updates documentation/tests accordingly.

Changes:

  • Add --slfo-pull-request to inject SLES 16 and SL Micro 6.2 client-tools repo URLs for 5.1/5.2 (including beta variants) and log the PR id.
  • Add static SL Micro 6.0/6.1 Salt/image repositories for versions 43, 50-micro, and 50-sles, and expand static-repo merging logic beyond 51/52.
  • Update CLI default version to 51-sles and adjust README/tests to reflect the new behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py Adds --slfo-pull-request, expands static repo merging to 43/50/51/52, changes default version to 51-sles.
jenkins_pipelines/scripts/json_generator/repository_versions/init.py Wires 4.3/5.0 static Salt repos into nodes_by_version.
jenkins_pipelines/scripts/json_generator/repository_versions/v43_nodes.py Introduces v43_static_slmicro_salt_repositories with fixed Salt/image URLs for SL Micro 6.0/6.1.
jenkins_pipelines/scripts/json_generator/repository_versions/v51_nodes.py Removes static definitions for sles160_minion / slmicro62_minion client-tools repos.
jenkins_pipelines/scripts/json_generator/repository_versions/v52_nodes.py Removes static definitions for sles160_minion / slmicro62_minion client-tools repos (beta).
jenkins_pipelines/scripts/json_generator/maintenance_json_generator_README.md Documents new default version, beta options, and --slfo-pull-request plus static Salt repos behavior for 43/50.
jenkins_pipelines/scripts/tests/test_maintenance_json_generator.py Updates default-version expectation and adds assertions around static Salt repo merging for 43/50.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread jenkins_pipelines/scripts/json_generator/repository_versions/__init__.py Outdated
Comment thread jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py Outdated
Comment thread jenkins_pipelines/scripts/tests/test_maintenance_json_generator.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py:52

  • read_mi_ids_from_file is annotated to take file_path: str, but callers now pass a Path (and open() supports path-like objects). To keep typing accurate (and avoid type-checker noise), widen the type to accept Path/os.PathLike[str] (or convert to str at the call site consistently).
def read_mi_ids_from_file(file_path: str) -> list[str]:
    with open(file_path, 'r') as file:
        return file.read().strip().split()

jenkins_pipelines/scripts/tests/test_maintenance_json_generator.py:71

  • The assertions inside this assertRaises(SystemExit) block are unreachable because parse_cli_args() raises and exits the with body immediately. Move the assertEqual/assertIn checks after the with block (using the captured exception in cm).
        sys.argv = ['maintenance_json_generator.py',  '-x']
        with self.assertRaises(SystemExit) as cm:
            parse_cli_args()
            self.assertEqual(cm.exception.code, 2)
            self.assertIn("error: unrecognized arguments: -x", cm.msg)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py Outdated
Comment thread jenkins_pipelines/scripts/tests/test_maintenance_json_generator.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

jenkins_pipelines/scripts/json_generator/repository_versions/init.py:42

  • DynamicRepos is defined as dict[str, list[str]], but the dynamic_* values coming from get_v51_static_and_client_tools() / get_v52_static_and_client_tools() are currently dict[str, set[str]]. This is both a typing mismatch and contributes to non-deterministic iteration order downstream. Consider converting those returned sets to sorted list[str] here (e.g., when assigning dynamic_51_* / dynamic_52_*) or updating the type alias and downstream logic to consistently use ordered sequences.
StaticRepos: TypeAlias = dict[str, dict[str, str]]
DynamicRepos: TypeAlias = dict[str, list[str]]


class VersionNodes(TypedDict):
    static: StaticRepos
    dynamic: DynamicRepos

static_51_micro, dynamic_51_micro = get_v51_static_and_client_tools("micro")
static_51_sles, dynamic_51_sles = get_v51_static_and_client_tools("sles")

# 5.2 (Non-Beta clients - shared from 5.1)
static_52_micro, dynamic_52_micro = get_v52_static_and_client_tools("micro", beta=False)
static_52_sles, dynamic_52_sles = get_v52_static_and_client_tools("sles", beta=False)

# 5.2 (Beta clients - exclusive -Beta tools)
static_52_micro_beta, dynamic_52_micro_beta = get_v52_static_and_client_tools("micro", beta=True)
static_52_sles_beta, dynamic_52_sles_beta = get_v52_static_and_client_tools("sles", beta=True)

nodes_by_version: dict[str, VersionNodes] = {
    "43": {"static": v43_static_slmicro_salt_repositories, "dynamic": get_v43_nodes_sorted()},
    "50-micro": {
        "static": v43_static_slmicro_salt_repositories,
        "dynamic": get_v50_nodes_sorted(get_v43_nodes_sorted(), "micro"),
    },
    "50-sles": {
        "static": v43_static_slmicro_salt_repositories,
        "dynamic": get_v50_nodes_sorted(get_v43_nodes_sorted(), "sles"),
    },
    "51-sles": {"static": static_51_sles, "dynamic": dynamic_51_sles},
    "51-micro": {"static": static_51_micro, "dynamic": dynamic_51_micro},
    "52-sles": {"static": static_52_sles, "dynamic": dynamic_52_sles},
    "52-micro": {"static": static_52_micro, "dynamic": dynamic_52_micro},
    "52-sles-beta": {"static": static_52_sles_beta, "dynamic": dynamic_52_sles_beta},
    "52-micro-beta": {"static": static_52_micro_beta, "dynamic": dynamic_52_micro_beta}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread jenkins_pipelines/scripts/tests/test_maintenance_json_generator.py Outdated
…s/tests

Support SLFO PullRequest IDs for SLES 16 and SL Micro 6.2 client-tools repos on
5.1/5.2, add static SL Micro 6.0/6.1 salt repos for 4.3/5.0, and change the
default target version to 51-sles. Also tighten CLI validation and typing,
update the README, and refresh tests to cover the new version/PR behavior and
stable test-path handling.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 13 to +34
@@ -18,12 +30,22 @@ def parse_cli_args() -> argparse.Namespace:
description="This script reads the open qam-manager requests and creates a json file that can be fed to the BV testsuite pipeline"
)
parser.add_argument("-v", "--version", dest="version",
help="Version of SUMA/MLM you want to run this script for, options include 43, 50, 51, and 52 variations (including beta)",
choices=["43", "50-micro", "50-sles", "51-micro","51-sles", "52-micro", "52-sles", "52-micro-beta", "52-sles-beta"], default="43", action='store')
help="Version of SUMA/MLM to run this script for. Accepted values: 43, 50-micro, 50-sles, 51-micro, 51-sles, 52-micro, 52-sles, 52-micro-beta, 52-sles-beta. Default: 51-sles.",
choices=SUPPORTED_VERSIONS, default="51-sles", action='store')
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

SUPPORTED_VERSIONS duplicates the authoritative version list already present in repository_versions.nodes_by_version. This can drift (e.g., adding a new entry to nodes_by_version but forgetting to update SUPPORTED_VERSIONS, or vice‑versa) and will either reject a valid version or accept one with no mapping. Consider deriving choices (and optionally the help text) directly from nodes_by_version.keys() instead of maintaining a separate constant.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +46
help="SLFO PullRequest id for sles160_minion and slmicro62_minion (5.1 / 5.2 only; independent of MI ids)",
)
args = parser.parse_args()
if args.slfo_pull_request and not supports_slfo_pull_request(args.version):
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

--slfo-pull-request is accepted as an arbitrary string and interpolated directly into the generated IBS URLs. This allows values containing /, :, whitespace, etc. to produce malformed URLs (and potentially confusing JSON keys). Consider validating that the PR id is numeric (e.g., type=int in argparse, or an explicit .isdigit() check) and emitting a clear argparse error when invalid.

Suggested change
help="SLFO PullRequest id for sles160_minion and slmicro62_minion (5.1 / 5.2 only; independent of MI ids)",
)
args = parser.parse_args()
if args.slfo_pull_request and not supports_slfo_pull_request(args.version):
type=int,
help="SLFO PullRequest id for sles160_minion and slmicro62_minion (5.1 / 5.2 only; independent of MI ids)",
)
args = parser.parse_args()
if args.slfo_pull_request is not None and not supports_slfo_pull_request(args.version):

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants