Commit graph

3140 commits

Author SHA1 Message Date
Tomas Hozza
b200fa8fcd RHEL-90: introduce default image config data structure
Introduce a new data structure `ImageConfig` holding the default OS
configuration applied when building an image. The structure can be used
to hold the default image configuration on the distribution level with
possible overrides defined on the image-type level.

As a starting point, move hard-coded default values and configuration
common for `osPipeline`, `ec2BaseTreePipeline` and `ostreeTreePipeline`
to the distribution and image-type default image configuration. This is
preparing the ground for merging all of these three pipeline functions
into `osPipeline`, which will produce the appropriate OS pipeline based
on the image-type configuration and the fact if it is rpmOstree or not.

Regenerate affected EC2 and AMI manifests. There is however no change in
the resulting image configuration and image-info report.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-01-11 17:08:19 +01:00
sanne
3c729be3c5 tools/appsre-build-worker-packer: Add image_users variable
packer will share the ami with those users.
2022-01-11 14:30:19 +01:00
sanne
2420504e1d tools/appsre-build-worker-packer: Use WORKSPACE variable
Docker doesn't accept "." as a mountpoint, use the WORKSPACE variable on
jenkins and default to PWD.
2022-01-11 14:30:19 +01:00
sanne
d08147864a osbuild-service-maintenace: Map AWS secrets 2022-01-11 12:57:02 +01:00
sanne
4797ac281a osbuild-service-maintenance: Rework GCP credentials mapping
Because of the way the gcp secrets are stored for the workers, and how
the mapping from vault to openshift works (unable to map a multiple key
secret into a single json file), there's a bit of juggling required to
get the gcp credentials in the right format.
2022-01-11 12:57:02 +01:00
sanne
204bf9e176 tools/appsre-build-worker-packer: Don't fast-fail cleanup 2022-01-07 11:42:16 +01:00
sanne
4970e4d788 tools/appsre-build-worker-packer: Use CI_COMMIT_SHA
CI is also defined on appsres infra, and is also true. Use CI_COMMIT_SHA
instead to determine if we're running from a PR or not.
2022-01-07 10:35:34 +01:00
Achilleas Koutsou
785b11b008 schutzbot: add new key and remove old for Achilleas
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2022-01-06 23:51:00 +00:00
Jakub Rusz
564148b743 test/cases: Add test to verify osbuild-composer works after upgrade
This test provisions a RHEL-8.6 VM locally, installs osbuild-composer on
it, upgrades the system to RHEL-9.0 and verifies osbuild-composer still
works by building a simple qcow image.
2022-01-06 21:30:46 +01:00
Juan Abia
9c946a306e ci: enable zure testing on centos-8
this test was disabled because it blocked CI, to be solved later. See
COMPOSER-1118
2022-01-06 13:54:55 +01:00
Juan Abia
211dd88ccb test/cases: divide regression test
split regression-composer-works-behind-satellite in two different tests.
As they test independent funcionalities.
2022-01-06 09:45:38 +01:00
Ondřej Budai
4637e36ddf schutzbot: remove ssh keys of team member that left us
bye 😢

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-01-06 09:18:01 +01:00
sanne
71da979c81 tools: AppSRE packer build 2022-01-05 22:13:55 +01:00
Ondřej Budai
d967790ea5 api/cloud: drop v1 API
It's deprecated and not used anywhere, let's just drop it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-01-04 16:38:50 +01:00
Ondřej Budai
8d81da7d7b packer: remove /var/lib/osbuild-composer check
This directory is not used on worker instances. It was a left-over from the
times when this AMI was also used for running composer.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-01-04 16:17:59 +01:00
Ondřej Budai
9d0ae3bc1f packer: add initialization scripts
The worker needs quite a lot of configuration involving secrets. Baking them
in the AMI is just awful so we need to fetch them during the instance startup.

Previously, this was all done using cloud-init. This makes the cloud-init
config huge and it is also very hard to test.

This commit moves all the configuration scripts into the image itself.
Cloud-init still needs to be used to push the secret variables into the
instance. The configuration scripts are run after cloud-init. They pick up
yhe secrets and initialize the worker correctly.

These scripts were adopted from
75b752a1c0
(private repository).

During the adoption, some changes has to be applied to make shellcheck happy.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-01-04 16:17:59 +01:00
Ondřej Budai
5697b43ad6 packer: update to RHEL 8.5
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-01-04 16:17:59 +01:00
Ondřej Budai
e668ed0ac5 weldr: return an error if host distro wasn't found in distro registry
Prevents a nil panic, see rhbz#2035956

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-01-03 18:05:15 +01:00
Thomas Lavocat
bcf34f8c6c dnj-json: delete unused cache folders
Detect folders that are not used since some timeout and delete them.
The cache folder must be empty when dnf-json is started in order to
avoid the situation where some folders can never be cleaned up (dnf-json
does not look at the cache directory content but uses information from
the requests to deduce which folders to keep and to delete).

Solves #2020
2022-01-03 16:00:38 +01:00
Jakub Rusz
d543e39fc9 Update terraform SHA
Update of Openstack 8.6 runners was needed.
2022-01-03 12:12:26 +01:00
dependabot[bot]
818e1bd040 build(deps): bump actions/setup-go from 2.1.4 to 2.1.5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.4 to 2.1.5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2.1.4...v2.1.5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 09:04:03 +01:00
ondrejbudai
46047d0a78 Post release version bump
[skip ci]
2021-12-22 14:17:36 +00:00
dependabot[bot]
87bbe51e03 build(deps): bump actions/checkout from 2.3.4 to 2.4.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.4.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-22 13:56:15 +01:00
dependabot[bot]
8b66e64893 build(deps): bump github.com/aws/aws-sdk-go from 1.40.49 to 1.42.25
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.49 to 1.42.25.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.40.49...v1.42.25)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-22 13:53:53 +01:00
Tomas Hozza
885fe3d2b4 osbuild2: fix typo in tar stage option value
Related to https://github.com/osbuild/osbuild/pull/940

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-22 10:41:22 +01:00
Tomas Hozza
35ef067396 osbuild2: support 'format' and 'root-node' Tar stage options
Bring the Tar stage implementation on par with the current osbuild
schema. Specifically add the 'format' and 'root-node' options to the
stage options structure.

Add stage options validation along with appropriate unit tests.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-21 20:40:12 +01:00
Tomas Hozza
a5319e78d4 (re)generate image test cases for image-installer on all distros
The existing test cases for `image-installer` image type were not
regenerated as part of PR #2135 which introduced 'image_type_tags'
because regenerating them using `generate-all-test-cases` failed on them
due to trying to analyze them using 'image-info'. These test cases were
most probably originally generated manually with --keep-image-info
option passed to `generate-test-cases`. And I missed that their
regeneration failed at that time.

Add the `image-installer` image type to all distros in
`distro-arch-imagetype-map.json` and (re)generate the test cases for it.

The image test case for CentOS Stream 9 is not generated, because there
are no repos defined yet for the distro. This is part of the CentOS 9
PR #2142.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-21 09:59:17 +01:00
Tomas Hozza
3025bbb775 Tools: add 'no-image-info' option to image test case requests
Add a new option `no-image-info`, which can be specified for an image
type in `format-request-map.json` in case the image can not be analyzed
using `image-info` and thus it should not be run as part of generating
the image test case.

This is the case for e.g. the `image-installer` image type in RHEL-8.6,
which effectively breaks generating all image test cases for RHEL-8.6
due to `image-info` failing to analyze the resulting image.

This change will allow us to consistently generate image test cases
(manifests only) for all image types, which were so far not covered by
the image testing.

Modify the `generate-test-cases` script to recognize the `no-image-info`
option in the `format-request-map.json`

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-21 09:59:17 +01:00
Tomas Hozza
4a2041b38e generate-all-test-cases: use make scratch for building RPMs
Use `make scratch` for building RPMs without tests. This fixes the case,
when the RPM build with test fails to build due to changes in image
manifests. The whole reason of running the script is to regenerate image
test cases when the manifest changed, so this was a chicken and egg
problem.

No CI testing is needed, as this is a development tool.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-20 14:52:45 +01:00
Ondřej Budai
68410e0a4c osbuild-auth-tests: add a build constraint also to certificates.go
These tests can be run only in our CI environment, and not as pure unit tests
launched by go test ./... Let's make sure that all files that belong to these
tests are properly marked with build constraints.

This should fix the following error in Coverity Scan runs:

 # github.com/osbuild/osbuild-composer/cmd/osbuild-auth-tests
runtime.main_main·f: function main is undeclared in the main package
Warning:  Build command go build -o bin/ ./... exited with code 2. Please verify that the build completed successfully.

See https://github.com/osbuild/osbuild-composer/runs/4427232580?check_suite_focus=true

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-12-18 11:56:17 +00:00
Ondřej Budai
ab3990b90a dbjobqueue: fix FinishJob not returning an error if already finished
Reported by covscan

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-12-18 00:14:07 +00:00
sanne
2543459a7f osbuild2: Expand dnf_config stage 2021-12-17 20:07:56 +01:00
Juan Abia
786fc2719d test: make test more resilient
During manual cleanup of unused resources, the storage account can get
removed. The current storage account is not possible to remove
mannually, but adding this check to make it more resielient in future
scenarios.
2021-12-17 16:05:35 +01:00
sanne
f284e2a932 .github: Bump fedora container version for rpmlint 2021-12-17 13:13:05 +01:00
sanne
8406ada6f5 worker: Treat a non echo.HTTPError like a regular error 2021-12-17 13:13:05 +01:00
Tomas Hozza
30f64d190d osbuild2: ensure that empty sysconfig options members are omitted
The `Kernel` and `Network` members of the sysconfig stage options
structure were previously not declared as pointers. As a result, they
always appeared in the resulting JSON object, even though they were
empty. Use pointers to ensure that the members are omitted from the
resulting JSON object, if they were not defined.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 20:47:28 +01:00
Tomas Hozza
96000173db osbuild2: do not use reflect in pam.limits.conf stage
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 20:01:42 +01:00
Tomas Hozza
09cd5b3576 osbuild2: support org.osbuild.dnf-automatic.config stage
Add support for the new `org.osbuild.dnf-automatic.config` stage for
configuring DNF Automatic.

Add appropriate new unit tests for the stage implementation and modify
necessary existing unit tests.

Related to https://github.com/osbuild/osbuild/pull/936

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 20:01:42 +01:00
Tomas Hozza
97ef7fbf28 osbuild2: support org.osbuild.yum.repos stage
Add support for the new `org.osbuild.yum.repos` stage for creating DNF /
YUM repository configuration files.

Add appropriate new unit tests for the stage implementation and modify
necessary existing unit tests.

Related to https://github.com/osbuild/osbuild/pull/932

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 20:01:42 +01:00
Tomas Hozza
37a39743bc osbuild2: support PermitRootLogin in sshd.config stage
Add support for the `PermitRootLogin` option in the `sshd.config` stage.
Valid values can be of type `bool` or `string`. Due to this reason, a
custom interface type is defined and a custom `UnmarshalJSON()` method is
defined for the `SshdConfigConfig` structure.

Modify unit tests to test the newly added option and test
(un)marhsalling of valid values of both types.

Related to https://github.com/osbuild/osbuild/pull/917

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 20:01:42 +01:00
Tomas Hozza
33c7da9dc3 tools: use image_type_tags in repos used for image test cases
Use image_type_tags in repo definitions used for generating image test
cases. Enhance the `generate-test-cases` script to take the
image_type_tags into account when creating a compose request for a
specific image test case.

The motivation for the change is to keep the list of repositories in the
compose request of a image test case as small as possible. Previously,
all of the defined repositories were part of each image test cases for a
specific architecture, even those that were not needed.

Regenerate affected image test cases.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-16 18:07:50 +01:00
sanne
60d4f5a751 composer: Disable artifacts for the service
When backed by a DB, composer has no need of a queue directory.

This also addresses "Error moving artifacts for job" logging noise.

Signed-off-by: sanne <sanne.raymaekers@gmail.com>
2021-12-16 17:04:08 +00:00
Diaa Sami
487e2d0669 internal/cloud: use logrus for logging
and log upload & sharing failures
2021-12-16 11:58:41 +00:00
Diaa Sami
8f80dd06d6 composer: use logrus everywhere for consistency 2021-12-16 11:58:41 +00:00
Diaa Sami
b599245284 internal/worker: Use logrus for logging 2021-12-16 11:58:41 +00:00
Diaa Sami
510d2ccac0 worker/server: pass more error details to handler 2021-12-16 11:58:41 +00:00
Diaa Sami
c1aeeeaf0e internal/worker: log internal details when available 2021-12-16 11:58:41 +00:00
Thomas Lavocat
d26a93319c Tracing: measure IO during each job
Using iostat from package sysstat
2021-12-16 10:32:37 +01:00
Thomas Lavocat
8d67b90a2e Tests: trim dependencies for test generation 2021-12-16 10:21:25 +01:00
Gianluca Zuccarelli
e165db63ea metrics: add additional buckets
The change between the 32s bucket and the 64s bucket is too drastic
for measuring the duration of depsolve jobs. At present, 90% of the
depsolve jobs have a duration inbetween 32s and 64s, making the 32s
bucket too sensitive and the 64s bucket not sensitive enough.
2021-12-15 19:53:11 +00:00