Skip to content

Commit 1e30b7c

Browse files
committed
Automate CLI command help messages generation
Fixes #825
1 parent 1ee3fe7 commit 1e30b7c

24 files changed

+406
-312
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Regenerate help messages of CLI commands
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * 2"
7+
8+
jobs:
9+
update-help-messages:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.11"
20+
cache: "pip"
21+
22+
- name: Install dependencies
23+
run: pip install packitos
24+
25+
- name: Regenerate help messages
26+
run: python3 files/generate_cli_messages.py
27+
28+
- name: Check for changes
29+
id: check_changes
30+
run: git diff --exit-code
31+
32+
- name: Create pull request
33+
if: steps.check_changes.outputs.exit_code != '0'
34+
uses: peter-evans/create-pull-request@v4
35+
with:
36+
TOKEN: ${{ secrets.RELEASEBOT_GITHUB_TOKEN }}
37+
commit-message: "Update help messages of CLI commands"
38+
title: "Update help messages of CLI commands"
39+
body: "Automatically regenerated help messages for CLI command docs."
40+
delete-branch: true

docs/cli/build/copr.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

docs/cli/build/in-copr.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: in-copr
3+
date: 2019-07-16
4+
sidebar_position: 35
5+
---
6+
7+
# `packit build in-copr`
8+
9+
Submit a [Copr](https://copr.fedorainfracloud.org) build of the present content in the upstream repository.
10+
11+
## Requirements
12+
13+
* Upstream git repository on GitHub.
14+
* Packit config file placed in the upstream repository.
15+
* `~/.config/copr`
16+
17+
A minimum copr configure file is:
18+
```
19+
[copr-cli]
20+
copr_url = https://copr.fedorainfracloud.org
21+
gssapi = true
22+
```
23+
This uses GSSAPI (see [`fkinit`](https://fedoraproject.org/wiki/Infrastructure/Kerberos#How_to_use_kerberos_auth_with_Fedora_Infrastructure)
24+
for more details). Alternatively you can use copr API token available [here](https://copr.fedorainfracloud.org/api/).
25+
26+
## Tutorial
27+
28+
1. [Place a config file for packit in the root of your upstream repository.](/docs/configuration/)
29+
30+
2. The command below would create a SRPM from the present content of a repo and perform `copr-cli build` with it. If you need to specify a project name/owner or chroots, see the options in help.
31+
```
32+
$ cd my/ustream/project/
33+
$ packit build in-copr
34+
```
35+
36+
## Help
37+
38+
Usage: packit build in-copr [OPTIONS] [PATH_OR_URL]
39+
40+
Build selected upstream project in Copr.
41+
42+
PATH_OR_URL argument is a local path or a URL to the upstream git
43+
repository, it defaults to the current working directory.
44+
45+
Options:
46+
--wait / --no-wait Wait for the build to finish
47+
--owner TEXT Copr user, owner of the project. (defaults to
48+
username from copr config)
49+
--project TEXT Project name to build in. Will be created if
50+
does not exist. (defaults to the first found
51+
project value in the config file or 'packit-
52+
cli-{repo_name}-{branch/commit}')
53+
--targets TEXT Comma separated list of chroots to build in.
54+
(defaults to 'fedora-rawhide-x86_64')
55+
--description TEXT Description of the project to build in.
56+
--instructions TEXT Installation instructions for the project to
57+
build in.
58+
--list-on-homepage Created copr project will be visible on copr's
59+
home-page.
60+
--preserve-project Created copr project will not be removed after
61+
60 days.
62+
--additional-repos TEXT URLs to additional yum repos, which can be
63+
used during build. Comma separated. This
64+
should be baseurl from .repo file. E.g.:
65+
http://copr-be.cloud.fedoraproject.org/results
66+
/rhughes/f20-gnome-3-12/fedora-$releasever-$ba
67+
search/
68+
--upstream-ref TEXT Git ref of the last upstream commit in the
69+
current branch from which packit should
70+
generate patches (this option implies the
71+
repository is source-git).
72+
--request-admin-if-needed Ask for admin permissions when we need to
73+
change settings of the copr project and are
74+
not allowed to do so.
75+
--enable-net / --disable-net Copr build is built with explicitly enabled
76+
network access or disabled
77+
--release-suffix TEXT Specifies release suffix. Allows to override
78+
default generated:{current_time}.{sanitized_cu
79+
rrent_branch}{git_desc_suffix}
80+
--default-release-suffix Allows to use default, packit-generated,
81+
release suffix when some release_suffix is
82+
specified in the configuration.
83+
--module-hotfixes Created copr project will have module_hotfixes
84+
set to True
85+
-p, --package TEXT Package to build, if more than one available,
86+
like in a monorepo configuration. Use it
87+
multiple times to select multiple
88+
packages.Defaults to all the packages listed
89+
inside the config.
90+
-h, --help Show this message and exit.

docs/cli/build/in-image-builder.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,29 @@ Create a VM image in Image Builder defined in your "packit.yaml" using your Copr
3737
As of December 2022, Packit Github app can now submit builds to Red Hat Image
3838
Builder, for more details see the `vm_image_build` job description.
3939
40-
4140
## Help
4241
4342
Usage: packit build in-image-builder [OPTIONS] IMAGE_NAME [PATH_OR_URL]
44-
43+
4544
Create a VM image in Image Builder.
46-
45+
4746
### EXPERIMENTAL ###
48-
47+
4948
This command is experimental and the integration with Image Builder will be
5049
changed in a backwards incompatible way in the future.
51-
50+
5251
Packit loads image build configuration from your packit.yaml file.
53-
52+
5453
When `--job-config-index` is not specified, the job configuration is loaded
5554
from your .packit.yaml and the first matching vm_image_build job is used.
56-
55+
5756
IMAGE_NAME is the name of the image to be created. Please pick something
5857
unique so it's easy to identify for you in the Image Builder interface and
5958
can be well associated with the image content.
60-
59+
6160
[PATH_OR_URL] argument is a local path or a URL to the upstream git
6261
repository, it defaults to the current working directory
63-
62+
6463
Options:
6564
--job-config-index INTEGER Use N-th job definition to load configuration
6665
for the image build. The type needs to be
@@ -72,4 +71,3 @@ Builder, for more details see the `vm_image_build` job description.
7271
packages.Defaults to all the packages listed
7372
inside the config.
7473
-h, --help Show this message and exit.
75-

docs/cli/build/in-koji.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: in-koji
3+
sidebar_position: 3
4+
---
5+
6+
# `packit build in-koji`
7+
8+
Submit a Koji build for the selected branch in Fedora dist-git.
9+
10+
## Requirements
11+
12+
* Upstream git repository on GitHub.
13+
* Packit config file placed in the upstream repository.
14+
* Valid Fedora Kerberos ticket.
15+
16+
17+
## Tutorial
18+
19+
1. [Place a config file for packit in the root of your upstream repository.](/docs/configuration/)
20+
21+
2. The command below would perform `fedpkg build` in the Fedora dist-git main branch.
22+
```
23+
$ cd my/ustream/project/
24+
$ packit build in-koji
25+
```
26+
27+
## Help
28+
29+
Usage: packit build in-koji [OPTIONS] [PATH_OR_URL]
30+
31+
Build selected upstream project in Fedora.
32+
33+
By default, packit checks out the respective dist-git repository and
34+
performs `fedpkg build` for the selected branch. With `--from-upstream`,
35+
packit creates a SRPM out of the current checkout and sends it to koji.
36+
37+
PATH_OR_URL argument is a local path or a URL to the upstream git
38+
repository, it defaults to the current working directory
39+
40+
Options:
41+
--dist-git-branch TEXT Comma separated list of target branches in dist-
42+
git to release into. (defaults to repo's default
43+
branch)
44+
--dist-git-path TEXT Path to dist-git repo to work in. Otherwise clone
45+
the repo in a temporary directory.
46+
--from-upstream Build the project in koji directly from the
47+
upstream repository
48+
--koji-target TEXT Koji target to build inside (see `koji list-
49+
targets`).
50+
--scratch Submit a scratch koji build
51+
--wait / --no-wait Wait for the build to finish
52+
--release-suffix TEXT Specifies release suffix. Allows to override
53+
default generated:{current_time}.{sanitized_curren
54+
t_branch}{git_desc_suffix}
55+
--default-release-suffix Allows to use default, packit-generated, release
56+
suffix when some release_suffix is specified in
57+
the configuration.
58+
-p, --package TEXT Package to build, if more than one available, like
59+
in a monorepo configuration. Use it multiple times
60+
to select multiple packages.Defaults to all the
61+
packages listed inside the config.
62+
-h, --help Show this message and exit.

docs/cli/build/mock.md renamed to docs/cli/build/in-mock.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Create RPMs in mock using content of the upstream repository.
1111
## Help
1212

1313
Usage: packit build in-mock [OPTIONS] [PATH_OR_URL]
14-
14+
1515
Build RPMs in mock using content of the upstream repository.
16-
16+
1717
PATH_OR_URL argument is a local path or a URL to the upstream git
1818
repository, it defaults to the current working directory.
19-
19+
2020
Options:
2121
--upstream-ref TEXT Git ref of the last upstream commit in the current
2222
branch from which packit should generate patches

docs/cli/build/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Subcommand that groups all RPM build related commands together.
1212

1313
## Possible ways to build an RPM
1414

15-
* [`locally`](/docs/cli/build/local)
16-
* [`in-mock`](/docs/cli/build/mock)
17-
* [`in-copr`](/docs/cli/build/copr)
18-
* [`in-koji`](/docs/cli/build/koji)
15+
* [`locally`](/docs/cli/build/locally)
16+
* [`in-mock`](/docs/cli/build/in-mock)
17+
* [`in-copr`](/docs/cli/build/in-copr)
18+
* [`in-koji`](/docs/cli/build/in-koji)
1919
* [`in-image-builder`](/docs/cli/build/in-image-builder)
2020

2121
## Help

0 commit comments

Comments
 (0)