Commit graph

194 commits

Author SHA1 Message Date
robojerk
4eeaa43c39 did stuff
Some checks failed
Tests / 🛃 Unit tests (push) Failing after 13s
Tests / 🗄 DB tests (push) Failing after 19s
Tests / 🐍 Lint python scripts (push) Failing after 1s
Tests / ⌨ Golang Lint (push) Failing after 1s
Tests / 📦 Packit config lint (push) Failing after 1s
Tests / 🔍 Check source preparation (push) Failing after 1s
Tests / 🔍 Check for valid snapshot urls (push) Failing after 1s
Tests / 🔍 Check for missing or unused runner repos (push) Failing after 1s
Tests / 🐚 Shellcheck (push) Failing after 1s
Tests / 📦 RPMlint (push) Failing after 1s
Tests / Gitlab CI trigger helper (push) Failing after 1s
Tests / 🎀 kube-linter (push) Failing after 1s
Tests / 🧹 cloud-cleaner-is-enabled (push) Successful in 3s
Tests / 🔍 Check spec file osbuild/images dependencies (push) Failing after 1s
2025-08-26 10:34:42 -07:00
Lukas Zapletal
15ec2fc431 go.mod: update sentry
Update sentry dep and code that was required.
2025-07-28 11:44:33 +02:00
Lukas Zapletal
1cde7e341b common: fix unclosed logrus logging pipes 2025-07-08 11:38:27 +02:00
Lukas Zapletal
f2bf47814f deps: upgrade go-systemd from v1 to v22 2025-06-16 17:46:45 +02:00
Tomáš Hozza
985e582953 osbuild-composer/config: update distro aliases for RHEL 9 and 10
Bump the `rhel-9` and `rhel-10` distro aliases to the next
in-development releases, because we don't plan to land any new releases
in 9.6 or 10.0.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-28 09:35:23 +01:00
Michael Vogt
35167ce83f many: update for new reporegistry.New() api (c.f. pr#1179)
This commit updates osbuild-composer for the new API in images
for the `reporegistry.New()`. The main incompatible change is
that the `/repositories` part is not longer automatically added
inside the library so we need to add it on the call-site.

This needs https://github.com/osbuild/images/pull/1179
2025-02-19 19:19:42 +01:00
Michael Vogt
90f069c2eb many: take repositories from the "images" library
This commit changes the spec file so that most of the repositories
are taken from the `images` library. See images PR#1112 for details.

Note that we still need the -no-auth-keys and the centos-stream
symlinks.
2025-02-13 14:00:45 +01:00
Tomáš Hozza
bb43578d92 osbuild-composer: bump rhel-9 distro alias to rhel-9.6
The alias in the built-in config is meant for on-prem and needs to be
set to the current in-development minor RHEL version.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-02-12 12:53:36 +01:00
Michael Vogt
40011e35a2 composer: use reporegistry.New() again (see PR#4378)
This commit changes cmd/composer to use the `reporegistry.New`
call again. This is a preparation for
https://github.com/osbuild/images/pull/1179

And undoes parts of https://github.com/osbuild/osbuild-composer/pull/4378
but that is no longer necessary because in
https://github.com/osbuild/images/pull/946 the error is now passed
on from `reporegistry.New()` in the same way as from `LoadRepositories()`.
2025-01-29 13:27:32 +01:00
Brian C. Lane
73101d2ff2 Fix non-constant log strings
Newer versions of the go compiler (1.24 in this case) fail when running
go test during a mock rebuild of the srpm created by 'make srpm' on
Fedora 42.

Even though we currently don't support go1.24, fix these so they don't
become an issue when we do.
2025-01-21 16:51:20 -08:00
Achilleas Koutsou
af48971981 osbuild-composer: fail weldr init when repos are nil
If weldr tries to initialise when there are no repositories set and
ignore_missing_repos is enabled, return with an error.
2024-11-05 08:21:42 +01:00
Achilleas Koutsou
51287ea57e osbuild-composer/config: new option: ignore_missing_repos
osbuild/images added an error type that's returned when the reporegistry
loader doesn't find any repository configurations to load [1].  This
lets callers decide whether to stop or continue execution based on
whether repository configurations are required.

A new top-level configuration option is added for osbuild-composer that
makes it possible to start the service without having static rpm
repositories configured.  This is useful in certain (SaaS) modes where
build requests specify their own repository configurations.
2024-11-05 08:21:42 +01:00
Tomáš Hozza
7437770352 composer: don't create RepoRegistry using reporegistry.New()
The `reporegistry.New()` has been enhanced to return an error, in case
there were no repositories loaded. This was to fix the situation in many
unit tests, which were previously not loading any repositories and
silently not running any tests.

This however broke our SaaS deployment, where we actually do not
configure any repositories on the filesystem. As a result,
osbuild-composer started to fail on it.

Workaround this situation in osbuild-composer by reverting to the old
behavior by loading the repo configs separately and then using the
loaded repos (which could be empty map) to initialize the RepoRegistry.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-09-23 18:51:39 +02:00
Florian Schüller
a4068b328d splunk_logger: move environment hook to splunk_logger pt2
for reusability also in image-builder
2024-08-28 16:41:07 +02:00
Florian Schüller
09c5f5e374 osbuild-composer: activate deployment-channel reporting for splunk
followup of PR #4285
2024-08-12 15:38:56 +02:00
Florian Schüller
9006836afc logrus: add deployment channel as field to the logs 2024-08-07 12:32:57 +02:00
Tomáš Hozza
286236b698 Config: don't override undefined keys when loading from ENV
Composer can load configuration values defined as map from ENV.
Previously, when loading the configuration from ENV, the whole map would
get overridden, not just values defined in the ENV. This is however not
intended and not consistent with how loading configuration from file
works.

Adjust the configuration loading from ENV and adjust the unit test
accordingly.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-07-17 11:02:41 +02:00
Lukas Zapletal
5ce8f65a58 cloudapi: propagate operation/external id
Signed-off-by: Lukas Zapletal <lzap+git@redhat.com>
2024-06-25 13:58:53 +02:00
Lukas Zapletal
f3c0daebbf cmd/osbuild-composer: journald support 2024-06-25 13:58:53 +02:00
Tomáš Hozza
b01b080565 Update 'rhel-9' distro alias to 'rhel-9.5'
New releases are landing in 9.5 already, so the on-prem version should
reflect that. The service can and does override this using a
configuration.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 13:03:37 +02:00
Tomáš Hozza
695febf39c Define distro alias for 'rhel-10'
Set it to RHEL-10.0.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-06-04 13:03:37 +02:00
Sanne Raymaekers
0b277937dd worker/server: make worker timeout configurable 2024-04-19 19:56:25 +02:00
Brian C. Lane
01ba674cac cloudapi: Pass the RepoRegistry to the cloudapi Server 2024-03-11 03:04:54 -07:00
Brian C. Lane
b8967d53bc Move RepoRegistry setup into Composer
This is so that both the weldr and cloud api's can use it as the source
of their repositories.
2024-03-11 03:04:54 -07:00
Tomáš Hozza
f57e88d034 osbuild-composer: support setting distro_aliases via ENV variable
This will allow us to configure the distro aliases in the service by
setting ENV variable.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-02-21 12:06:33 +01:00
Diaa Sami
76e686df10 switch to images/pkg/dnfjson and remove internal copy
COMPOSER-2068
2024-02-20 15:55:47 +01:00
Diaa Sami
f08d1f6068 composer: send error log messages to sentry 2024-02-14 10:38:42 +01:00
Diaa Sami
c9c51613a4 composer: glitchtip integration 2024-02-13 14:57:57 +01:00
Achilleas Koutsou
3e31ebfbb1 osbuild-composer: add iot-bootable-container to weldr deny list
We only want to build this image type in Fedora Koji.
2024-02-02 10:34:41 +01:00
Tomáš Hozza
8ba3426f12 composer: use distro name aliases from configuration
Register the distro name aliases from the configuration on the distro
factory.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
cdf57e5bc1 osbuild-composer/config: support specifying distro aliases
Add new configuration option `distro_aliases`, which is a map of
strings, allowing to specify distro name alias for supported
distributions.

Define aliases for RHEL major versions without the minor version
specified.

For now, the distro aliases map is not used by any API
implementation and it is ignored.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
fb1b27c0ef Move cleaning up old dnfjson cache dirs from composer to Weldr API
Previously, the old dnfjson cache dirs for unsupported distributions
were deleted in the osbuild-composer binary on startup. This is no
longer possible, since the supported distros are determined by loading
available repositories. Loading repositories happens in the Weldr API
constructor. Move the cleanup code there.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
625b1578fa Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation"
for distro release versions.

 - Replace all uses of distroregistry by distrofactory.
 - Delete local version of reporegistry and use the one from the
   osbuild/images.
 - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single
   `createTestWeldrAPI()` function`.
 - store/fixture: rework fixtures to allow overriding the host distro
   name and host architecture name. A cleanup function to restore the
   host distro and arch names is always part of the fixture struct.
 - Delete `distro_mock` package, since it is no longer used.
 - Bump the required version of osbuild to 98, because the OSCAP
   customization is using the 'compress_results' stage option, which is
   not available in older versions of osbuild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Brian C. Lane
ea05f400e6 cloudapi: Listen on /run/cloudapi/api.socket
Add a local socket for communicating with the cloudapi. It is started by
osbuild-composer.socket and is located at /run/cloudapi/api.socket

cloudapi requests can be passed to it using curl like this:

curl -k --unix-socket /run/cloudapi/api.socket --header 'Content-Type: application/json' \
--data request.json http://localhost/api/image-builder-composer/v2/compose

A simple request.json looks like this:

{
  "distribution": "fedora-38",
  "image_request":
    {
      "architecture": "x86_64",
      "image_type": "guest-image",
      "upload_options": {},
      "repositories": [
          {
            "name": "fedora",
            "metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-38&arch=x86_64",
            "check_gpg": false
          },
          {
            "name": "updates",
            "metalink": "https://mirrors.fedoraproject.org/metalink?repo=updates-released-f38&arch=x86_64",
            "check_gpg": false
          }
      ]
    }
}
2024-01-15 11:48:35 +01:00
Diaa Sami
9b53d3e6a6 composer: update ident field used for Splunk
to maintain backward compatibility
2023-12-18 11:46:23 +01:00
Diaa Sami
2443048ecf composer: cleanup unused code related to fluentd sidecar
COMPOSER-2051
2023-12-18 11:46:23 +01:00
Diaa Sami
6cfa26399f composer: use logrus hook instead of k8s sidecar
for splunk log forwarding
Fixes COMPOSER-2051
2023-11-28 12:42:00 +01:00
Ondřej Budai
cac9327b44 update to go 1.19
UBI and the oldest support Fedora (37) now all have go 1.19, so we are
cleared to switch.

gofmt now reformats comments in certain cases, so that explains the formatting
changes in this commit.
See https://go.dev/doc/go1.19#go-doc

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-07-21 19:18:00 +02:00
Diaa Sami
cb0734145d remove old prometheus listener 2023-07-19 10:56:36 +02:00
Achilleas Koutsou
0e4a9e586f split: replace internal packages with images library
Remove all the internal package that are now in the
github.com/osbuild/images package and vendor it.

A new function in internal/blueprint/ converts from an osbuild-composer
blueprint to an images blueprint.  This is necessary for keeping the
blueprint implementation in both packages.  In the future, the images
package will change the blueprint (and most likely rename it) and it
will only be part of the osbuild-composer internals and interface.  The
Convert() function will be responsible for converting the blueprint into
the new configuration object.
2023-07-10 21:11:19 +02:00
Diaa Sami
8398f27742 internal/cloudapi: additional prometheus listener
Listening on another port, while keeping the existing endpoint until
transition is complete
2023-06-07 17:05:32 +02:00
Achilleas Koutsou
81d6f526d0 config: don't show azure-eap7-rhui in weldr
The azure-eap7-rhui image type should only be available for internal
builds (for now).
2023-03-30 18:40:12 +02:00
Brian C. Lane
f731ab53d0 dnfjson: Cleanup old distro cache dirs
This adds a function, CleanupOldCacheDirs, that checks the dirs under
/var/cache/osbuild-composer/rpmmd/ and removes files and directories
that don't match the current list of supported distros.

This will clean up the cache from old releases as the are retired, and
will also cleanup the old top level cache directory structure after an
upgrade.

NOTE: This function does not return errors, any real problems it
encounters will also be caught by the cache initialization code and
handled there.
2023-03-23 11:26:40 +01:00
Brian C. Lane
7a4bb863dd Update deprecated io/ioutil functions
ioutil has been deprecated since go 1.16, this fixes all of the
deprecated functions we are using:

ioutil.ReadFile -> os.ReadFile
ioutil.ReadAll -> io.ReadAll
ioutil.WriteFile -> os.WriteFile
ioutil.TempFile -> os.CreateTemp
ioutil.TempDir -> os.MkdirTemp

All of the above are a simple name change, the function arguments and
results are exactly the same as before.

ioutil.ReadDir -> os.ReadDir

now returns a os.DirEntry but the IsDir and Name functions work the
same. The difference is that the FileInfo must be retrieved with the
Info() function which can also return an error.

These were identified by running:
golangci-lint run --build-tags=integration ./...
2023-03-07 09:22:23 -08:00
Brian C. Lane
8c07d65fe0 distro: Add azure-sap-rhui image type to RHEL8 2022-11-18 16:53:22 +01:00
Brian C. Lane
826e9d8cc6 osbuild-composer: Set ReadHeaderTimeout to 5s
This satisfies the linter complaint about potential Slowloris attack
where headers are read slowly in an attempt to DoS the server.

The uses of ListenAndServe are only for testing purposes and are not run
in the production server so ignore the lint errors in
osbuild-mock-openid-provider.
2022-09-15 03:57:40 -07:00
Brian C. Lane
c32f94d6f2 weldr: Preload metadata at startup
For each of the supported distros start a goroutine to depsolve
'filesystem' which will preload the metadata making subsequent responses
faster.

This is safe to do without limits because we only supposed a limited
number of distros, and without additional locking because this is the
the same as hitting the API with multiple depsolve requests at the same
time.
2022-08-31 12:18:51 +01:00
Ondřej Budai
74eb3860df internal: remove kojiapi
We no longer use it, let's remove it. If you are wondering what to use instead,
use Cloud API. It supports everything that Koji API supported and more.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-19 16:00:52 +02:00
Sanne Raymaekers
03b57f002c jobqueue: Move jobqueue out of internal 2022-07-04 15:37:28 +02:00
Achilleas Koutsou
6fbddeea35 composer+worker: make dnf-json path externally configurable
The default value is the installation path.
2022-06-01 11:36:52 +01:00