@@ -89,6 +89,13 @@ These apply to the `srpm` command and building in COPR.
8989| [ hook] | ` post-modifications ` | upstream git repo | after all modifications to the spec file and before running rpmbuild command | |
9090| | ` changelog-entry ` | upstream git repo | when adding a new changelog entry to the specfile | stdout is used as a changelog entry |
9191
92+
93+ ### Job-level actions
94+
95+ | | name | working directory | when run | description |
96+ | --------| -----------------------| -------------------| -----------------------------------------------------------------------| ------------------------------------------------------|
97+ | [ hook] | ` run-condition ` | upstream git repo | before a job would run | exit code of this action determines if the job will run |
98+
9299## Actions details
93100
94101All actions are executed in a locked-down OpenShift pod. Your commands are
@@ -157,6 +164,34 @@ Our internal API differentiates between the commit title and description, so we
157164have an additional requirement on separating the commit title by an empty line.
158165You can, of course, provide *just* the commit title.
159166
167+ # ## `run-condition`
168+
169+ This action only makes sense at a job level and the exit code of the last command executed
170+ determines if the job will run. If the exit code is non-zero, the job will be skipped.
171+ If [`clone_repos_before_run_condition`](/docs/configuration/#clone_repos_before_run_condition)
172+ is `true`, upstream and/or downstream git repos (depending on the job in question and its trigger)
173+ will be cloned before the action is run.
174+
175+ For example :
176+
177+ ` ` ` yaml
178+ jobs:
179+ - job: koji_build
180+ trigger: commit
181+ dist-git-branches:
182+ - fedora-all
183+ actions:
184+ run-condition:
185+ # run only if version is not a pre-release
186+ - bash -c 'echo $PACKIT_PROJECT_VERSION | grep -Pvq -- "-(alpha|beta|rc)\d *$"'
187+ ` ` `
188+
189+ :::note
190+
191+ The action is currently enabled only for downstream jobs.
192+
193+ :: :
194+
160195# ### Debugging
161196
162197For your own debugging purposes we allow arbitrary output before outputting the
@@ -246,6 +281,12 @@ when syncing upstream release downstream, e.g. `rhbz#123 rhbz#124`
246281* `PACKIT_RESOLVED_BUGS` - bugs resolved by the release separated by space,
247282 e.g. `rhbz#123 rhbz#124`
248283
284+ # ## `run-condition`
285+
286+ * `PACKIT_PROJECT_VERSION` — current version of the project
287+ * `PACKIT_UPSTREAM_REPO` — absolute path to cloned upstream git repo, presence depends on context
288+ * `PACKIT_DOWNSTREAM_REPO` — absolute path to cloned downstream git repo, presence depends on context
289+
249290# ## Release-synchronization actions
250291
251292Related to the `propose-downstream` and `pull-from-upstream` jobs.
0 commit comments