|
1 | 1 | # Copyright Contributors to the Packit project. |
2 | 2 | # SPDX-License-Identifier: MIT |
3 | 3 |
|
| 4 | +import argparse |
4 | 5 | import logging |
5 | 6 | import os |
6 | 7 | from datetime import datetime, timezone |
@@ -217,6 +218,79 @@ def get_packit_commands_from_comment( |
217 | 218 | return [] |
218 | 219 |
|
219 | 220 |
|
| 221 | +def get_pr_comment_parser() -> argparse.ArgumentParser: |
| 222 | + parser = argparse.ArgumentParser(prog="/packit") |
| 223 | + parser.add_argument("--package", help="Specific package from monorepo to apply job to") |
| 224 | + |
| 225 | + subparsers = parser.add_subparsers( |
| 226 | + dest="command", |
| 227 | + help="Jobs available", |
| 228 | + ) |
| 229 | + |
| 230 | + build_parser = subparsers.add_parser( |
| 231 | + "copr-build", |
| 232 | + aliases=["build"], |
| 233 | + help="Build package(s) in copr", |
| 234 | + ) |
| 235 | + build_parser.add_argument( |
| 236 | + "--commit", help="Run copr build jobs configured with the commit trigger" |
| 237 | + ) |
| 238 | + build_parser.add_argument( |
| 239 | + "--release", help="Run copr build jobs configured with the release trigger" |
| 240 | + ) |
| 241 | + subparsers.add_parser("rebuild-failed", help="Re-build failed builds in copr") |
| 242 | + subparsers.add_parser( |
| 243 | + "upstream-koji-build", |
| 244 | + help="Build package(s) in Koji (the latest commit of this PR will be targeted, not HEAD)", |
| 245 | + ) |
| 246 | + test_parser = subparsers.add_parser("test", help="Run tests in Testing Farm") |
| 247 | + test_parser.add_argument("--commit", help="Run tests configured with the commit trigger") |
| 248 | + test_parser.add_argument("--release", help="Run tests configured with the release trigger") |
| 249 | + test_parser.add_argument("target", nargs="*", help="Test target(s)") |
| 250 | + test_parser.add_argument("env", nargs="*", help="Environment variables") |
| 251 | + subparsers.add_parser("retest-failed", help="Re-run failed tests in Testing Farm") |
| 252 | + subparsers.add_parser("vm-image-build", help="Trigger VM image build") |
| 253 | + subparsers.add_parser("propose-downstream", help="Trigger propose-downstream job") |
| 254 | + pull_from_upstream_parser = subparsers.add_parser( |
| 255 | + "pull-from-upstream", help="Trigger pull-from-upstream job" |
| 256 | + ) |
| 257 | + pull_from_upstream_parser.add_argument( |
| 258 | + "--resolve-bug", |
| 259 | + help="Override the referenced resolved bug set by Packit", |
| 260 | + ) |
| 261 | + pull_from_upstream_parser.add_argument( |
| 262 | + "--with-pr-config", |
| 263 | + action="store_true", |
| 264 | + help="Use the configuration file from this dist-git pull request", |
| 265 | + ) |
| 266 | + subparsers.add_parser( |
| 267 | + "koji-build", |
| 268 | + help="Build package(s) in Koji (the latest commit of this PR will be targeted, not HEAD)", |
| 269 | + ) |
| 270 | + koji_tag_parser = subparsers.add_parser("koji-tag", help="Tag Koji build to the common sidetag") |
| 271 | + koji_tag_parser.add_argument("--all-branches", action="store_true", help="Target all branches") |
| 272 | + subparsers.add_parser("create-update", help="Trigger Bodhi update job") |
| 273 | + |
| 274 | + return parser |
| 275 | + |
| 276 | + |
| 277 | +def get_pr_comment_parser_fedora_ci() -> argparse.ArgumentParser: |
| 278 | + parser = argparse.ArgumentParser(prog="/packit-ci") |
| 279 | + parser.add_argument("--package", help="Specific package from monorepo to apply job to") |
| 280 | + |
| 281 | + subparsers = parser.add_subparsers( |
| 282 | + dest="command", |
| 283 | + help="Jobs available", |
| 284 | + ) |
| 285 | + test_parser = subparsers.add_parser("test", help="Run tests in Testing Farm") |
| 286 | + test_parser.add_argument("target", nargs="*", help="Test target(s)") |
| 287 | + test_parser.add_argument("env", nargs="*", help="Environment variables") |
| 288 | + subparsers.add_parser("retest-failed", help="Re-run failed tests in Testing Farm") |
| 289 | + subparsers.add_parser("scratch-build", help="Build package in Scratch") |
| 290 | + |
| 291 | + return parser |
| 292 | + |
| 293 | + |
220 | 294 | def get_koji_task_id_and_url_from_stdout(stdout: str) -> tuple[Optional[int], Optional[str]]: |
221 | 295 | task_id, task_url = None, None |
222 | 296 |
|
|
0 commit comments