Commit graph

19 commits

Author SHA1 Message Date
Christian Kellner
591a55aad5 plugins: add support for customizations
The Cloud API supports passing in a variety of image customizations,
like e.g. extra packages or pre-defining users.

Add a new command line option to the client `--customizations` which
takes a path to a JSON file which contains the customziations; they
will be passed via the existing `opts` argument to the hub.

Add support for `customizations` to the `opts`/`options` arguments
to the hub plugin. No validation to the object is done. Instead we
rely in Composer for the validation of the content.

Add support for `customizations` the image `ComposeRequest` in the
builder plugin. All specified values are just passed through to
composer as-is.

Add tests for the respective plugins.
2022-05-03 12:28:05 +02:00
Christian Kellner
f559c18079 plugins: support for repo package sets
This adds support for specifing the package sets for repositories;
on the command line this can be done via `--repo-package-set` with
and argument of `;` separated package set names. This will result
in repo information being transported via dict instead of plain
strings. Thus the hub plugin's schema was modified accordingly.
Last but not least, the builder plugin now can decode these dicts
and setup the repos accordingly.
Test were added for plugins as well as the integration test changed
to use this new feature.
The first upstream commit that supports this feature is pinned.
2022-02-15 17:35:29 +01:00
Christian Kellner
78ed04dbd6 plugins: support for ostree specific options
OStree compose requests need special options, like the `ref` the
`parent` and the `url`. Add support for those options to all three
plugins:
  The command line plugin now takes `--ostree-{parent,ref,url}`
  and passes it to koji via the existing options dictionary.

  The JSON schemata in the hub plugin was adjusted to allow these
  new options.

  Finally the builder plugin will look for the new `ostree` dict
  inside the options, create an `OSTreeOptions` object from it,
  and attach it to each image request.

NB: since the ostree options are per image request and are thus
architecture dependent we support a "$arch" substition in the
`parent` and `ref` options that will be resolved by the plugin;
this allows to builds arch specific commits for with a single
compose request.

Add the respective unit tests.
2022-02-14 13:14:19 +01:00
Christian Kellner
54c59cc41c builder: use cloud api
Composer now[1] has integrated the koji API into the "cloud API"
and thus we can use this more general purpose and powerful API
instead of using the specialized koji API endpoint.
Adapt the request and response structures as well as the unit
tests to use that.

[1] PR #2214, commit 11e2ae45284bfb0d89ef1c1e0d2aa4ae230ea573
2022-02-11 16:36:07 +01:00
Christian Kellner
9f0cdfd8a6 cli: do not use translation helper
This got deprected upstream[1] and now spits out a warning.

[1] https://pagure.io/koji/c/32b5377392ade0f1d1e159288b000383e5c3a39b
2022-01-26 18:40:23 +01:00
Christian Kellner
2b324d3d89 plugin/cli: remove type annotation
Remove the single string type annotation; it does not gain us much and
seems to be the only thing missing for python 2.7 (RHEL 7) support.
2021-08-17 02:28:07 +02:00
Christian Kellner
d7bfaee189 plugins: ability to skip the tagging
Add a new command line option `--skip-tag` that will skip tagging
after a successful build. The help text is copied from the same
option of other sub-commands in the koji client. The hub plugin's
jsonschema was updated accordingly, and the builder plugin will
skip the tag if the option was requested.
Tests were added or augmented for all three plugins to test the
new option.
2020-11-16 17:00:40 +01:00
Christian Kellner
1d9612ca05 plugin: pass repos as arrays
Currently we were passing the repo information as a comma
separated string, which is fragile, since urls can contain
commas. Just transfer them as arrays of strings.
2020-09-17 16:33:14 +01:00
Christian Kellner
899c2233c7 plugin/cli: silence pylint warning
We use `_running_in_bg` for now, as other plugins do. Silence the
warning for that.
2020-09-11 23:18:04 +01:00
Christian Kellner
01cf643516 plugin/cli: return a value in all code paths
Be consistent in all code paths.
2020-09-11 23:18:04 +01:00
Christian Kellner
4eeb998a60 plugin/cli: provide a bit documentation
Better describe the plugin in the file level doc-string.
2020-09-11 23:18:04 +01:00
Christian Kellner
928d2278be plugin/cli: return task result when waiting
When waiting for the task, return the result from the `watch_task`
call, which will indicate if the task was successful. This will
then be reflected in the error code of the koji call.
2020-09-10 18:41:13 +01:00
Christian Kellner
3dc463c8dd plugin/cli: pretty-print the options dict
Also show the options that we are using.
2020-09-10 18:41:13 +01:00
Christian Kellner
3f5de8a68d plugin/cli: eager check of target input
Check the target with name exists and has a destination tag, so
we can abort early.
2020-09-09 15:56:35 +02:00
Christian Kellner
3934382337 plugin/cli: honor global --quiet flag
If --quiet was requested globally, then don't print anything.
2020-09-09 15:51:11 +02:00
Christian Kellner
8099d79aa1 plugin/cli: support --wait, --nowait option
Can be used to explicitly opt in or out of waiting for the task to
finish. The help text is taken from the standard koji client.
2020-09-09 15:28:36 +02:00
Christian Kellner
79387f1f2c plugins/cli: use upstream description help text
For --repo and --release, use the help text from koji build-image.
2020-09-09 15:07:36 +02:00
Christian Kellner
81aebbc681 plugin/cli: use koji_cli.lib.OptionParser
Use koji's OptionParser instead of argparse to be better aligned
with the formatting of standard koji options.
2020-09-09 15:06:53 +02:00
Christian Kellner
49a6974e18 plugins/cli: initial version of the cli plugin
Re-uses code from compose.py. Needs to be installed into
  /usr/lib/python3.$/site-packages/koji_cli_plugins
Yes indeed.
2020-09-08 17:46:21 +02:00