Skip to content

Commit 53ac935

Browse files
committed
Add examples of Rules to the README.md file
1 parent 709f5d5 commit 53ac935

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

README.md

+68-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,76 @@ prerequisites:
3636
Task state can be one of:
3737

3838
- Pending (if some prerequisites are in Pending)
39-
- In-progress (if some prerequisites are in In-progress but none are Pending)
39+
- InProgress (if some prerequisites are in InProgress but none are Pending)
4040
- Completed (if all prerequisites are Completed)
4141

42+
## Rule Examples
43+
44+
### Simple Rule for New Product Releases
45+
46+
Here is an example of a single rule that would make sure that Jira issues
47+
exists for specific releases in Product Pages:
48+
49+
```yaml
50+
name: New RHEL release
51+
52+
# version of the rule schema
53+
version: 1
54+
55+
# inputs for tasks created from this rule
56+
inputs:
57+
# The input here is "rhel" product in Product Pages.
58+
# One task will be created for each active release of the product.
59+
- product: rhel
60+
61+
# prerequisites are processed in the given order
62+
prerequisites:
63+
# The following condition skips releases with version less than 10.1.
64+
# For example, for rhel-9.2, the no other prerequisites would be processed,
65+
# and the task would be marked as Pending.
66+
- condition: "(10, 1) <= (major, minor)"
67+
68+
# Require schedule task with "GA" name to be defined (for all releases
69+
# rhel-10.1 and up). This also sets a few variables for templating engine,
70+
# mainly "start_date" and "end_date".
71+
- schedule_task: "GA"
72+
73+
# Avoid processing further prerequisites if the target date is not reached,
74+
# or the schedule task is marked as draft (this can be overridden with
75+
# "ignore_drafts"). Processing would continue 8 weeks before the start date
76+
# in "GA" schedule (and the schedule is not draft).
77+
- target_date: "start_date - 8|weeks"
78+
79+
# This would create and manage Jira issues (main one and sub tasks) until
80+
# the main issue one is resolved.
81+
- jira_issue: rhel_config
82+
# Jira issue fields are defined in Jinja2 template (the file path is
83+
# relative to "jira_template_path" in configuration).
84+
template: "rhel/rhel_config.yml.j2"
85+
# The fields can be also defined or overridden here (both "template" and
86+
# "fields" are optional).
87+
fields:
88+
labels:
89+
- releng
90+
subtasks:
91+
- id: rhelwf-release-handoff-{{ release }}
92+
template: "rhelwf/new-rhel-release/set-up-rhel-release-phase1-accept-handoff.yml.j2"
93+
fields:
94+
priority:
95+
name: Normal
96+
97+
# After creating Jira issues, the task is marked as InProgress until the main Jira
98+
# issue is resolved. After that, the task is marked as Completed.
99+
```
100+
101+
Using the rule above, ReTaSC would create a Jira issue (and a subtask) after
102+
`target_date` and update it whenever some fields change in the template.
103+
104+
ReTaSC sets a unique label for the Jira issues, to find it later without
105+
storing any extra information. The label is constructed using
106+
"jira_label_prefix" configuration, "jira_issue" from the prerequisite and
107+
"jira_label_suffix" template variable originating from the Product pages input.
108+
42109
## Environment Variables
43110

44111
Below is list of environment variables supported by the application and in the

0 commit comments

Comments
 (0)