What happened? What is the problem?
When I either edit a comment (typically) or write some comment text and only then follow it with /packit test ... --env FOO=bar (on its own line), the --env definitions are silently discarded but the test seems to run.
This is likely because (according to some code analysis) Packit uses two different CLI parsers and they disagree about where a /packit command may appear:
- Command detection / routing scans the comment line by line, so a command on any line triggers the job.
- Argument extraction (
CommentArguments, used by the Testing Farm handler) anchors a regex at the start of the whole comment, so it only reads /packit at character 0 (start of the comment).
So if a comment has any text before the /packit line, the command still runs but all of its arguments are silently ignored (--identifier/--id/-i, --labels, etc.).
(In my case, I noticed it with --env.)
-
Detection is line-based → job fires. Matches /packit as the first token of any line: utils.py#L218-L236. Router keeps only command/package, args left to handlers: jobs.py#L266.
-
Arg parsing is start-anchored → bails. CommentArguments runs re.match(r"^/packit\s+(.*)", comment) on the whole body; no match ⇒ early return, leaving identifier/labels/envs as None: testing_farm.py#L89-L95.
-
Consumers read None → silent no-op. --env: testing_farm.py#L572 · -i: #L201-L206 · --labels: #L216-L249.
Fix: make CommentArguments find the command line-wise (as in #1), or thread the tokens from get_packit_commands_from_comment to handlers. Invariant: triggered ⇒ args parsed from the same line.
What did you expect to happen?
That it doesn't matter where in the comment I put /packit, it should either
- correctly detect its arguments
- or do nothing (no eyes emoji, no action taken)
- or throw some warning/error
Example URL(s)
RHSecurityCompliance/contest#664
Steps to reproduce
1. Start a comment with some text
2. Add a `/packit test ... --env FOO=bar` as one of the later lines
3. Let Packit trigger a CI run
4. Look into the TF request UUID that the env variables were not passed
Alternatively (my exact repro):
1. Write a packit-less comment
2. Edit it, append a `/packit test ... --env FOO=bar` line
3. Let Packit trigger a CI run
4. Look into the TF request UUID that the env variables were not passed
What is the impacted category (job)?
Testing Farm tests
Workaround
Participation
What happened? What is the problem?
When I either edit a comment (typically) or write some comment text and only then follow it with
/packit test ... --env FOO=bar(on its own line), the--envdefinitions are silently discarded but the test seems to run.This is likely because (according to some code analysis) Packit uses two different CLI parsers and they disagree about where a
/packitcommand may appear:CommentArguments, used by the Testing Farm handler) anchors a regex at the start of the whole comment, so it only reads/packitat character 0 (start of the comment).So if a comment has any text before the
/packitline, the command still runs but all of its arguments are silently ignored (--identifier/--id/-i,--labels, etc.).(In my case, I noticed it with
--env.)Detection is line-based → job fires. Matches
/packitas the first token of any line:utils.py#L218-L236. Router keeps only command/package, args left to handlers:jobs.py#L266.Arg parsing is start-anchored → bails.
CommentArgumentsrunsre.match(r"^/packit\s+(.*)", comment)on the whole body; no match ⇒ earlyreturn, leavingidentifier/labels/envsasNone:testing_farm.py#L89-L95.Consumers read
None→ silent no-op.--env:testing_farm.py#L572·-i:#L201-L206·--labels:#L216-L249.Fix: make
CommentArgumentsfind the command line-wise (as in #1), or thread the tokens fromget_packit_commands_from_commentto handlers. Invariant: triggered ⇒ args parsed from the same line.What did you expect to happen?
That it doesn't matter where in the comment I put
/packit, it should eitherExample URL(s)
RHSecurityCompliance/contest#664
Steps to reproduce
What is the impacted category (job)?
Testing Farm tests
Workaround
Participation