Commit graph

407 commits

Author SHA1 Message Date
Simon Steinbeiss
2e1d94aa48 github/actions: Enable /jira-epic slash commands
This change allows for using the command to create Jira Tasks under a
given Epic both in a pull request comment or in the pull request
description. By default, this action uses the HMS project to create the
Task in.

Also, the Epic referred to needs to be in a project that is accessible
to the imagebuilder-bot account (currently: COMPOSER, HMS).
2024-12-17 14:58:12 +01:00
packit-public-repos-bot
a23f9d6e72 Fix configuration for Packit 1.0.0
This commit fixes the configuration for the forthcoming Packit 1.0.0.
See [our blog post](https://packit.dev/posts/packit_1_0_0_action_required) for more details.
  - Job type `build` has been changed to `copr_build`.
  - Job type `production_build` has been changed to `upstream_koji_build`.
  - Key `upstream_project_name` has been changed to `upstream_package_name`.
  - Key `synced_files` has been changed to `files_to_sync`.

Please review and merge me before January 2025 otherwise packit-service jobs will fail because of an invalid configuration.
2024-12-12 09:03:44 +01:00
schutzbot
809b5792b1 Post release version bump
[skip ci]
2024-11-14 15:24:44 +00:00
Sanne Raymaekers
8a3c8f0f14 test/integration: fix RHEL repositories
Drop the package sets, I'm not sure they exist anymore in that form, it
breaks depsolving.

Also pirnt the journal logs during the test to make it easier to debug
failures.
2024-10-28 10:59:05 +01:00
Sanne Raymaekers
c12492a7d4 test/container: fix path to koji sql schema 2024-10-28 10:59:05 +01:00
Sanne Raymaekers
7ade47b379 koji-osbuild.spec: remove podman-plugins
This package is no longer shipped.
2024-10-28 10:59:05 +01:00
Sanne Raymaekers
f2e38706f0 schutzbot/deploy: bump the osbuild and composer commits 2024-10-28 10:59:05 +01:00
Sanne Raymaekers
c7f1895ecf .github/workflows/ci: disable codespell
This check is failing on the spelling of the valid function `assertIn`
of the unittest library.
2024-10-28 10:59:05 +01:00
Sanne Raymaekers
423b5037b7 test: fix unit tests
Koji complains if the `repo` isn't present.
2024-10-28 10:59:05 +01:00
Sanne Raymaekers
8b6955e7b1 schutzbot/terraform: update terraform sha 2024-10-28 10:59:05 +01:00
Sanne Raymaekers
ffa8ff64bf .gitlab-ci.yml: use non-EOL runners 2024-10-28 10:59:05 +01:00
Sanne Raymaekers
313b8ecdf6 plugin/builder: increase retries
The fedora koji instance often has trouble contacting the composer api,
let's just make the retries a lot more generous.
2024-10-28 10:59:05 +01:00
Tomáš Hozza
3b1e3ca9e1 Actions: add workflow for marking and closing stale issues and PRs
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-09-07 11:57:24 +02:00
Ondřej Budai
18c24c431b packit: Enable Bodhi updates for unstable Fedoras
As we don't only want to get Bodhi updates for the stable releases, but
also the ones still in development, we need to use 'fedora-branched'.

See https://packit.dev/docs/configuration/#aliases and
82d4fbbb4e
2023-02-02 18:58:46 +01:00
Ondřej Budai
2dfb674b77 packit: push updates also to epel
We got asked to ship this package also to EPEL. I already managed to create
the branches and prepare the initial builds. The last step is to enable the
downstream release automation. This commit thus enables EPELs for packit.
2023-02-02 18:58:46 +01:00
dependabot[bot]
2519a75aba build(deps): bump ludeeus/action-shellcheck from 1.1.0 to 2.0.0
Bumps [ludeeus/action-shellcheck](https://github.com/ludeeus/action-shellcheck) from 1.1.0 to 2.0.0.
- [Release notes](https://github.com/ludeeus/action-shellcheck/releases)
- [Commits](https://github.com/ludeeus/action-shellcheck/compare/1.1.0...2.0.0)

---
updated-dependencies:
- dependency-name: ludeeus/action-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 12:25:59 +01:00
Simon Steinbeiss
36e082256e docs: Update architecture diagram
This update reflects the migration of composer from a single instance to
running in Openshift. All the essentials are still there and very few
details omitted in favor of clarity.
2023-01-23 15:30:40 +01:00
Ondřej Budai
cd91075d97 koji-osbuild.spec: migrate the license field to SPDX
See the relevant Fedora change:
https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1

We already verified that the SPDX format works well in the Enterprise Linux
pipeline.
2023-01-12 12:42:02 +01:00
Tomáš Hozza
68ee7eedbe hub: mark baseurl as required in repo schema
Previously it the `repo` schema didn't mark the `baseurl` property as
required, although Cloud API "technically" requires it and the builder
code also made assumptions about it being always provided.

Note on Cloud API:
Cloud API requires that at least one of `baseurl`, `metalink` or
`mirrorlist` is specified for a repo. Since the plugin schema specifies
only `baseurl` as a property, it is as a result mandatory in order for
the Cloud API request to be valid and succeed.

Mark `baseurl` property as required in the `repo` schema and add unit
test for it.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-05 14:44:04 +01:00
Tomáš Hozza
05b395c7db test/hub: tidy up the unit test code
Reformat the code to be easier to read.
An empty dict was sometimes passed to `osbuildImage()` as the `priority`
argument, because `opts` were already part of `args`. Fix it.
Restructure `test_input_validation()` test to allow multiple test cases.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-01-05 14:44:04 +01:00
Ondřej Budai
32d9826e1e ci: add Fedora 37
This commit needs to do three things:
- update the terraform definition
- add fedora-37 to the gitlab-ci file
- bump osbuild and osbuild-composer versions, so we have F37 RPMs for them

I also removed the commented out aarch64 runners to clean the file a bit.
2023-01-05 09:52:26 +01:00
Ondřej Budai
22ce1602aa container/hub: increase the httpd's timeout
CGImport seems to be slow in certain cases. Let's increase the timeout,
otherwise CGImport for the 10 GiB RAW AMI might exceed it.

Fun fact: Fedora's Koji has the timeout configured to 10800 seconds. 🤯
2023-01-05 09:52:26 +01:00
schutzbot
1b14426bea Post release version bump
[skip ci]
2022-11-21 11:09:31 +00:00
Tomáš Hozza
3d1c24fdc0 Hub: use anyOf for upload_options schema
It turned out, that the upload options for AWS EC2 or GCP with just the
required properties specified, would match both schemas. This is causing
the validation fail with `oneOf` used for `upload_options`.

This will be fixed in osbuild-composer PR#3018. However, we can't use
the same approach for koji-osbuild, while keeping the schema backward
compatible and sane.

Another discussed option would be to define `upload_options` as an empty
object with `additionalProperties` set to `True`. This would
effectively mean no validation of `upload_options`. None of the plugins
actually modify the `upload_options` in any way. It is passed as
provided to `osbuild-composer`.

I think that the change in this commit is a compromise. The validation
of the `upload_options` schema is kept, but it is relaxed to `anyOf`.

[1] https://github.com/osbuild/osbuild-composer/pull/3018

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2022-11-21 12:06:35 +01:00
Tomáš Hozza
7ccd349999 hub: make location optional for AzureUploadOptions
The Azure Resource Group Location is no longer required and
osbuild-composer can determine the correct Location from the
provided Resource Group.

Related to https://github.com/osbuild/osbuild-composer/pull/3093.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2022-11-21 12:06:35 +01:00
Tomáš Hozza
8939c3515f hub: make bucket optional for GCPUploadOptions
The GCP Bucket may be (and usually will be) set on the composer-worker.

Related to https://github.com/osbuild/osbuild-composer/pull/3023.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2022-11-21 12:06:35 +01:00
Tomáš Hozza
a90101bde9 builder: fix missing default value for details in ComposeStatusError
The builder plugin could produce a traceback when image build failed,
but it didn't contain any details.

```
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/koji/daemon.py", line 1468, in runTask
    response = (handler.run(),)
  File "/usr/lib/python3.6/site-packages/koji/tasks.py", line 335, in run
    return koji.util.call_with_argcheck(self.handler, self.params, self.opts)
  File "/usr/lib/python3.6/site-packages/koji/util.py", line 271, in call_with_argcheck
    return func(*args, **kwargs)
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 719, in handler
    status = client.wait_for_compose(cid, callback=self.on_status_update)
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 483, in wait_for_compose
    status = self.compose_status(compose_id)
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 454, in compose_status
    return ComposeStatus.from_dict(res.json())
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 251, in from_dict
    ImageStatus.from_dict(s) for s in data["image_statuses"]
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 251, in <listcomp>
    ImageStatus.from_dict(s) for s in data["image_statuses"]
  File "/usr/lib/koji-builder-plugins/osbuild.py", line 228, in from_dict
    error = ComposeStatusError(error_id=error_id, **error)
TypeError: __init__() missing 1 required positional argument: 'details'
```

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2022-11-21 12:06:35 +01:00
Simon Steinbeiss
292e8c9026 builder: Fix typo 2022-11-16 18:39:41 +01:00
Simon Steinbeiss
c4de854fc3 ci: Pin Fedora container for pylint
This is so that new pylint errors with the version in Fedora 37 can be
fixed in a separate, subsequent PR.
2022-11-16 18:39:41 +01:00
Simon Steinbeiss
9975f38990 hub: Log adding tasks to Koji's db
Log both the entrypoint and the return value from adding a task to
Koji's database. We can measure both to ensure a task has been
successfully added to the database as a service level indicator.
2022-11-16 18:39:41 +01:00
Simon Steinbeiss
fd42f9eaf2 builder: Explicitly log task id to track SLI
Each 'Task id' corresponds to a 'Compose id' in case everything works as
expected. In order to be able to track both in Splunk to measure our
first service level indicator (SLI) we need to explicitly log the 'Task
id' when it is received by the plugin.
2022-11-16 18:39:41 +01:00
Thomas Lavocat
741be470bb ci: add tags to AWS instances
The new terraform runners support an extended lists of tags to get a
greater precision on the stats we can extract from AWS cost center.
2022-11-10 18:39:30 +01:00
schutzbot
cc3e621754 Post release version bump
[skip ci]
2022-09-02 14:28:16 +00:00
Tomas Hozza
f21a2de39b Hub: support image_type being an array for backwards compatibility
The support for specifying multiple `image_types` for a single compose
has been removed by [1]. This turned out to be problematic, because e.g.
Pungi uses the array type when triggering image builds via osbuild.

Bring back the support for specifying the `image_type` as an array, but
restrict it to a single item. This will cover the Pungi use-case, since
it is always passing a single `image_type` in the array. The array is
then converted to a string in the Hub plugin and passed as such to the
Builder plugin.

Extend unit tests covering the introduced compatibility layer.

[1] c725265081
2022-09-02 15:15:21 +02:00
Tomas Hozza
6065ce8b72 packit: Enable Bodhi updates workflow 2022-09-01 18:47:45 +02:00
Tomas Hozza
afd0db50c2 containers: fix globing of RPMs with two-digit version
`?` matches only a single character, which does not work with the
version on `main` being "10".
2022-09-01 18:47:45 +02:00
schutzbot
bb421f845b Post release version bump
[skip ci]
2022-08-31 14:33:09 +00:00
Tomas Hozza
d1e064aec3 koji_test.py: test upload to cloud with AWS
Extend the integration test with a new case, testing that direct upload
to the cloud works for Koji composes. Test this using a single cloud
provider, specifically AWS.

The test case submits a new osbuild-image build using Koji CLI,
determines the image information once the build finishes and then checks
that such image exists in AWS. The image is then deleted as part of the
test case tear-down.

The AWS credentials are now configured in the worker's configuration, if
the appropriate environment variables are set.

Update the SPEC file with a new test dependency and update the required
osbuild-composer version.
2022-08-31 13:13:24 +02:00
Tomas Hozza
c76e97ddc9 Support specifying upload options for image builds
The upload options are expected to be provided as a JSON file. The same
options will be used for all image type and architecture combinations,
similarly as it is done for ostree options.

Extend unit tests to cover the newly added functionality.
2022-08-31 13:13:24 +02:00
Tomas Hozza
4e32ae5439 CI: exclude LICENSE from spell check
Spell check started to freak out on `complies` in the `LICENSE`. Exclude
`LICENSE` from spell check until it learns English.
2022-08-22 09:58:06 +02:00
Tomas Hozza
c725265081 Drop support for specifying more than one image type
While it is technically possible to build more than one image type
as part of a Koji compose in osbuild-composer, this option is not used
in reality and it also makes very little sense. If the user wants to
build more than one image type, they should submit multiple Koji builds.

Adjust affected unit tests.
2022-08-22 09:58:06 +02:00
Tomas Hozza
dd8233e8b7 Don't reduce infomation uploaded in compose-status.json
Previously, the image status in the compose status uploaded to the koji
build was represented as a single string describing the overall status.
All information related to the image upload or error details were
thrown away.

Refactor `ImageStatus` to contain all the information about the image,
its upload targets and potential errors, as they are returned by
composer.

This will improve the experience when debugging compose failures. In
addition, including all the data will be important once images
will be uploaded directly to the cloud, because it will contain
information to locate the image in the cloud environment.
2022-08-22 09:58:06 +02:00
Tomas Hozza
21a947d64f GH action: use Fedora container for Pylint 2022-08-22 09:58:06 +02:00
Tomas Hozza
ed6b01bb97 test_koji.sh: refactor the test case and de-duplicate some code
Refactor the test case implementation to make it easier to reuse
existing code when adding a new testing scenario.

The common pieces were moved under a new `SutInfo` class, which provides
information and convenience methods related to the system on which the
test is running.

This change will make it easier to later add a new scenario testing
upload to the cloud.
2022-08-22 09:58:06 +02:00
Tomas Hozza
0a026a6573 deploy.sh: drop Fedora 34 specific workaround 2022-08-22 09:58:06 +02:00
Tomas Hozza
85d7120d9f CI: Use Fedora 36, RHEL-8.6 and the latest osbuild and composer
Use latest osbuild and osbuild-composer releases. This is important to
be later able to test direct uploading to the cloud for Koji composes.
Also the mock openid server had to be enhanced to be usable for testing
`koji-osbuild`.

Modify used osbuild-worker configuration to use JWT for authentication
with composer. Update configurations of both, composer and worker to
handle multi-tenancy.

Do not start any services in `schutzbot/deploy.sh`, because at that
point, none of the configuration files are in place.

Ensure that the correct units are started and masked by
`test/integration.sh` to simulate the Service scenario more closely.
This means that the local worker is masked and only remote worker is
started.

Co-authored-by: Jakub Rusz <jrusz@redhat.com>
2022-08-22 09:58:06 +02:00
Tomas Hozza
faa40f1060 Schutzbot: add thozza's SSH key to team keys 2022-08-22 09:58:06 +02:00
Ondřej Budai
d38e11ea8a builder: add retries to composer API calls
The status calls are sometimes failing on:
upstream connect error or disconnect/reset before headers. reset reason:
connection termination

Since all requests are going through the company proxy, I think that the
networking isn't working 100% reliably. This commit adds a retry mechanism
provided by the urllib3 library. It will retry on all networking issues and
also on some 5xx errors that makes sense to retry (like gateway failures).

A test is added that runs the compose waiting code against a mock server
that fails every second request. This is imho sufficient to mimick a flaky
networking.
2022-08-05 14:53:37 +02:00
schutzbot
99062e8399 Post release version bump
[skip ci]
2022-06-30 16:45:09 +00:00
Ondřej Budai
a55f11211c builder: always refresh OAuth token after getting 401
See the comment inline
2022-06-30 18:38:23 +02:00