Skip to content

Commit b845fbb

Browse files
committed
Handle backticks in try job patterns
1 parent d76e138 commit b845fbb

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

Diff for: src/ci/citool/src/main.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,20 @@ impl GitHubContext {
4646
}
4747
}
4848

49-
/// Tries to parse patterns of CI jobs that should be executed in the form of
49+
/// Tries to parse patterns of CI jobs that should be executed
50+
/// from the commit message of the passed GitHub context
51+
///
52+
/// They can be specified in the form of
5053
/// try-job: <job-pattern>
51-
/// from the commit message of the passed GitHub context.
54+
/// or
55+
/// try-job: `<job-pattern>`
56+
/// (to avoid GitHub rendering the glob patterns as Markdown)
5257
fn get_try_job_patterns(&self) -> Vec<String> {
5358
if let Some(ref msg) = self.commit_message {
5459
msg.lines()
5560
.filter_map(|line| line.trim().strip_prefix("try-job: "))
61+
// Strip backticks if present
62+
.map(|l| l.trim_matches('`'))
5663
.map(|l| l.trim().to_string())
5764
.collect()
5865
} else {

Diff for: src/doc/rustc-dev-guide/src/tests/ci.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,34 @@ There are several use-cases for try builds:
133133
Again, a working compiler build is needed for this, which can be produced by
134134
the [dist-x86_64-linux] CI job.
135135
- Run a specific CI job (e.g. Windows tests) on a PR, to quickly test if it
136-
passes the test suite executed by that job. You can select which CI jobs will
137-
be executed in the try build by adding lines containing `try-job:
138-
<job patter>` to the PR description. All such specified jobs will be executed
139-
in the try build once the `@bors try` command is used on the PR. If no try
140-
jobs are specified in this way, the jobs defined in the `try` section of
141-
[`jobs.yml`] will be executed by default. Each pattern can either be an exact
142-
name of a job or a glob pattern that matches multiple jobs, for example
143-
`*msvc*` or `*-alt`. You can start at most 20 jobs in a single try build.
136+
passes the test suite executed by that job.
137+
138+
You can select which CI jobs will
139+
be executed in the try build by adding lines containing `try-job:
140+
<job pattern>` to the PR description. All such specified jobs will be executed
141+
in the try build once the `@bors try` command is used on the PR. If no try
142+
jobs are specified in this way, the jobs defined in the `try` section of
143+
[`jobs.yml`] will be executed by default.
144+
145+
Each pattern can either be an exact name of a job or a glob pattern that matches multiple jobs,
146+
for example `*msvc*` or `*-alt`. You can start at most 20 jobs in a single try build. When using
147+
glob patterns, you might want to wrap them in backticks (`` ` ``) to avoid GitHub rendering
148+
the pattern as Markdown.
144149

145150
> **Using `try-job` PR description directives**
146151
>
147152
> 1. Identify which set of try-jobs you would like to exercise. You can
148153
> find the name of the CI jobs in [`jobs.yml`].
149154
>
150-
> 2. Amend PR description to include (usually at the end of the PR description)
151-
> e.g.
155+
> 2. Amend PR description to include a set of patterns (usually at the end
156+
> of the PR description), for example:
152157
>
153158
> ```text
154159
> This PR fixes #123456.
155160
>
156161
> try-job: x86_64-msvc
157162
> try-job: test-various
158-
> try-job: *-alt
163+
> try-job: `*-alt`
159164
> ```
160165
>
161166
> Each `try-job` pattern must be on its own line.

0 commit comments

Comments
 (0)