Commit graph

1672 commits

Author SHA1 Message Date
Tomas Hozza
2e8ef3eadd packit: enable builds on ppc64le
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-10-06 08:24:33 +02:00
Achilleas Koutsou
8076f2beb2 CI: rename rhel-8.5 runners to rhel-8.5-nightly
Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-10-05 15:57:45 +02:00
Achilleas Koutsou
3de57ae9a7 mockbuild: add RHEL 8.6
- CI runners
- Subscription override for mock templates
- Terraform SHA for 8.6 runners

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-10-05 15:57:45 +02:00
Christian Kellner
03411015a2 docs: document osbuild and selinux integration
Add a first outline of the integration points of osbuild and
selinux, from two perspectives: how osbuild interacts with
the host and how osbuild labels the target artefact and the
resulting peculiarties.
2021-10-01 11:02:32 +02:00
Christian Kellner
ebb7a982f8 ci: trigger gitlab from checks not tests
Use the "Checks" workflow to trigger gitlab; this workflow should
be much quicker to complete and thus the gitlab ci will trigger
earlier leading to a more parallel ci run.
2021-09-29 20:07:59 +02:00
Christian Kellner
ead48226fc ci: split out checks from tests
Split out all checks that verify documentation, spelling and that
test data is update to date from the actual unit and integration
tests.
2021-09-29 20:07:59 +02:00
Sanne Raymaekers
706e1ce243 .github: Get PR number from sha
Sadly `github.event.workflow_run.pull_requests` is empty if the pull
request was opened from another fork. Use the sha to find an open PR,
otherwise assume it's a branch.
2021-09-29 13:24:46 +02:00
Sanne Raymaekers
1c9fd1cf99 .github: Use the workflow_run event data in trigger-gitlab
This workflow doesn't have access to the original pull request event
that resulted in this workflow being triggered.

Simply use `head_sha` which will contain the PR sha if it was triggered
by a PR's workflow, or the branch sha if it was triggered from a
branch's workflow.
2021-09-27 16:25:45 +02:00
Christian Kellner
ea2ee10268 ci: trigger gitlab ci via workflow run event
The `workflow_run` event is triggered either when a workflow was
requested or complete (see `types`). We can use this event as a
trigger for the gitlab ci conditioning on a successful workflow
run of the main tests ("Tests" workflow). This will ensure that,
with outside contributor protection turned o, no secrets are
leaked via PRs from non-contributors, but also that gitlab ci is
run for those PRs once they were manually allowed to run.
The only downside is that now the gitlab ci will only run after
the main workflow ("Tests) has completed and thus serializing
both CI runs. OTOH gitlab CI is quite intense so maybe this is
not so bad after all. If in the future we want to parallelize
both CI runs we could have a third "precheck" condition with
maybe the spell checker and the pylint tests that the main tests
as well as the gitlab ci run depend on.
2021-09-24 17:51:40 +02:00
Simon Steinbeiss
3678f3a4c5 38
Release osbuild 38

Signed-off-by: Simon Steinbeiss <simon.steinbeiss@redhat.com>
2021-09-24 17:20:15 +02:00
Pierre-Yves Chibon
407bb73a12 Copy the local_vars dictionary to avoid eval modifying it
This avoid having the local_vars dictionary getting filled with
a large number of built-in variable that are of no use for this
dictionary.

This commit was created by from Alexander Larsson.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2021-09-24 13:32:51 +02:00
Pierre-Yves Chibon
65b98448c6 Add support for defining variables from other variables or basic expression
Using this we can now define variables in the variable section using
basic expression that are evaluated as f-string.
For example, you can use the syntax:

```
"mpp-vars": {
   "rootfs_uuid": {"mpp-format-string": "{__import__('uuid').uuid1()}"},
   "bootfs_uuid": "156f0420-627b-4151-ae6f-fda298097515"
},
```

This will automatically call uuid.uuid1() for rootfs_uuid, thus allowing
to dynamically set the uuid for the rootfs variable.
This variable being able to be overridden via the -D argument of the
osbuild-mpp tool.

In addition, you can also define variable based on variables defined
above, for example:

```
"mpp-vars": {
   "rootfs_size": 4294967296,
   "homefs_size": {"mpp-format-string": "{rootfs_size}"}
},
```

For context, we're in particular interested in this for the uuid
generation, as we have had issues with xfs failing to mount a filesystem
if the uuid is already mounted. In particular, if we built e.g. a
raspberry pi image using osbuild and then we use that raspberry pi for building
the same manifest (typically a later version of it) the osbuild fails in the
loopback mount case. Being able to easily support reproducible fixed-uuid
images, as well as ones with a real unique uuid makes a lot of sense.

This commit was created with a lot of inputs from Alexander Larsson.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2021-09-24 13:32:51 +02:00
Christian Kellner
662fe0feb9 test/host: checks for invalid fd handling
Check that we properly handle `dispatch` returning invalid fds and
that all fds are properly closed.
2021-09-24 12:14:04 +01:00
Christian Kellner
28dcd0ee9a host: check reply_fds before sending them
If there are fds to send back to the client, do a check that none
of them are invalid, so that we do not raise an exception in send
later. This allows us to send a proper RemoteError instead of no
reply at all.
2021-09-24 12:14:04 +01:00
Christian Kellner
6a39067772 host: raise a protocol error for empty messages
When decoding a message, first check that it is not empty and
raise a `ProtocolError` otherwise. This prevent a more obscure
error like "NoneType has no get method".
2021-09-24 12:14:04 +01:00
Christian Kellner
879c56a3b5 sources: pass items via temporary file
Since source were converted to host services it now uses a unix
socket instead of stdin to pass the arguments, which includes
the list of items to download. The latter can become quite big,
in fact too big to fit into a single package (NB: SOCK_SEQPACKET
is used for the underlying transport).
Therefore write the actual items to a temporary file and pass
the fd of it along the message.
2021-09-24 08:27:19 +01:00
Christian Kellner
fe3bb30f4c test/host: add check for call with fds
Create a new test that checks method calls that pass file
descriptors in both directions.
2021-09-24 08:27:19 +01:00
Christian Kellner
3da1db0865 host: properly clean up passed fds
On the service server side, i.e. the actual host service binary,
when we receive a message that contains file descriptors, clean
then up eagerly, instead relying on the garbage collector.
More importantly, the fds that we get from as a reply, if any,
need to be closed since in the current model the ownership is
transferred to the caller of `dispatch`.
2021-09-24 08:27:19 +01:00
Christian Kellner
21ad9fa399 stages/qemu: fix 'compat' option
The option got renamed to `compat` (and moved into the `qemu`
object) when the stage was extracted from the `qemu` assembler;
but the code, taken from the assembler, still used the old
`qcow2_compat` name for the option. Fix this.
2021-09-23 11:00:47 +02:00
Martin Sehnoutka
7be475151d 37
Release osbuild 37

[skip ci]

Signed-off-by: Martin Sehnoutka <msehnout@redhat.com>
2021-09-22 15:03:21 +02:00
Christian Kellner
c902a7a754 sources: port to host services
Port sources to also use the host services infrastructure that is
used by inputs, devices and mounts. Sources are a bit different
from the other services that they don't run for the duration of
the stage but are run before anything is built. By using the same
infrastructure we re-use the process management and inter process
communcation. Additionally, this will forward all messages from
sources to the existing monitoring framework.
Adapt all existing sources and tests.
2021-09-22 00:00:20 +02:00
Alexander Larsson
072b75d78e org.osbuild.curl: Don't load secrets if not needed
This moves the check for already downloaded files earlier so
that if all files are already downloaded we don't need to
load the secrets.

This is faster, but also it allows a pre-seeded object store
to run the manifest on a system (like a VM) that isn't subscribed.
2021-09-22 00:00:20 +02:00
Christian Kellner
20c3290460 pipeline: split out downloading from building
Separate the downloading form the actual building, so that in the
future one could only download artifacts needed to build images.
2021-09-22 00:00:20 +02:00
Pierre-Yves Chibon
2d4bc41cfc Fix the assert as .sort() returns None
Since `.sort()` returns None, we were checking that None == None
which is not what we aimed to do.

Quick reproducer:
```
>>> assert [1,2,3].sort() == [2,3,4].sort()
>>> assert sorted([1,2,3]) == sorted([2,3,4])
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    assert sorted([1,2,3]) == sorted([2,3,4])
AssertionError
```

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2021-09-21 16:09:47 +02:00
Sanne Raymaekers
36a7475e26 schutzbot: Update terraform sha
Unbreaks fedora-33 updates-modular dnf error when installing the
gitlab-runner.
2021-09-21 16:00:08 +02:00
Simon Steinbeiss
d89c956008 packit: Propose PRs to all Fedoras 2021-09-20 10:51:46 +02:00
Christian Kellner
99dd623383 stages: pam_limits.conf → pam.limits.conf
Mostly my personal preference, but we do not have any stage
with an underscore in the name, so let not start now.
2021-09-14 15:31:12 +02:00
Tomas Hozza
46ff53d5f4 Add a new stage for configuring pam_limits module
Add a new stage `org.osbuild.pam_limits.conf`, which created
configuration files for `pam_limits` module in /etc/security/limits.d.

Add unit test for the new stage.

Fix #788

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-09 15:00:30 +02:00
Christian Kellner
7ec305a343 ostree.config: add bootloader config option
Ability to set the bootloader backend that OSTree should use. NB:
normally this should be set to `none` since in modern distros and
bootloaders the BLS is used and the BLS snippets are generated on
`none` but none of the of the specific bootloader tools are run,
like `grub2-mkconfig` for grub.

Update the fedora image manifest to use that config setting.
2021-09-09 12:29:54 +02:00
Tomas Hozza
187681f17d Add a new stage for setting kernel parameters via sysctl.d
Add a new stage `org.osbuild.sysctld` for setting kernel parameters at
boot by creating a configuration file in /usr/lib/sysctl.d. At least
one parameter must be specified for the stage.

Add unit test for the new stage.

Fix #790

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-09 11:16:11 +02:00
Diaa Sami
5d7316757b 36
Release osbuild 36

Signed-off-by: Diaa Sami <disami@redhat.com>
2021-09-08 19:01:52 +02:00
Tomas Hozza
cf8f851f9c Add a new stage org.osbuild.tmpfilesd for configuring tmpfiles.d
Add a new stage `org.osbuild.tmpfilesd` for creating tmpfiles.d
configuration files in /usr/lib/tmpfiles.d. Provided list of
configuration directives is written as separate lines into
the configuration file. At least one configuration directive
must be specified.

Fix #786

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-08 14:08:40 +02:00
Tomas Hozza
8d85036689 Add a new stage for configuring SELinux state on the system
Add a new `org.osbuild.selinux.config` stage to configure the
SELinux state on the system.

The stage configures the SELinux state on the system in /etc/selinux/config.
The policy enforcement state and active policy type can be configured.

Fix #785

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-08 11:22:55 +02:00
Tomas Hozza
ac02244369 Add a new org.osbuild.dnf.config stage for configuring DNF
Add a new `org.osbuild.dnf.config` stage for changing persistent DNF
configuration. Currently only DNF variables can be defined.

Fix #791

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-07 14:10:09 +02:00
Tomas Hozza
1cab686f7a Add new org.osbuild.tuned stage for setting active TuneD profile
Add a new stage for setting active TuneD profile. The stage checks the
value of chosen TuneD profile(s) with the list of available TuneD
profiles installed in the filesystem root. If any of the chosen profiles
does not exist, the stage raises an exception.

Add unit tests for the new stage.

Fix #792

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-09-07 10:43:54 +02:00
Sanne Raymaekers
5b5ec8e6b4 util/rhsm: Check if repositories is None before iterating
When `get_fallback_rhsm_secrets` was used, `Subscriptions.repositories`
was None, and `get_secrets` never returned the fallback secrets.

So check if `repositories` is None before
iterating over it, otherwise return the fallback secrets.
2021-09-03 20:52:17 +02:00
Achilleas Koutsou
f5a048e7b4 stages/kickstart: set passwords with --iscrypted
The password is assumed to be encrypted so the `--iscrypted` option is
required.
2021-09-03 15:13:00 +02:00
Tom Gundersen
b081cf7f64 35
Release osbuild 35

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-08-29 20:09:59 +02:00
Christian Kellner
3c565347a3 stages/kickstart: quote ssh-key
Surround the ssh key by quotes since it might contain spaces.
2021-08-29 20:09:30 +02:00
Tom Gundersen
b430bd8682 34
Release osbuild 34

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-08-29 18:28:55 +02:00
Christian Kellner
4a5508e086 stages/bootiso.mono: support for aarch64 tempates
Use the aarch64 templates if the efi architecture was set to AA64.
NB: since we only support efi booting for aarch64 this should be
good enough for aarch64 selection.
2021-08-29 16:33:13 +02:00
Christian Kellner
597f5f9ea7 stages/kickstart: add schema for remote option
The code of the `org.osbuild.kickstart` stage already supported
adding the `--remote` option for `ostreesetup` via the `remote`
option but it was not included in the schema.
2021-08-29 16:33:06 +02:00
Christian Kellner
82cc2aeb4e test/data: use cloud-init in ostree image
Although zezere is the official tool, cloud init is easier to use
for local testing so switch to that.
2021-08-28 16:34:37 +02:00
Christian Kellner
c788a74fb5 stages/ostree.deploy: add remote option
Add an optional `remote` to the deployment of the ostree so that
the it is tied to the specified remote. This is needed later for
updating the commit from that remote.
2021-08-28 16:34:37 +02:00
Christian Kellner
7ea9796d9b stages/ostree.pull: add remote parameter
Add an optional `remote` parameter that can be used to specify the
the remote to track for the pulled commits.
2021-08-28 16:34:37 +02:00
Simon Steinbeiss
4459a37a66 33
Release osbuild 33

Signed-off-by: Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at>
2021-08-25 22:24:46 +02:00
Christian Kellner
877f2ba3c3 stages/grub2: greenboot support
Greenboot is the idea of automatically rolling back bad updates,
i.e. updates that do not boot successfully. The implementation
is split between the boot loader and a user space component.
The latter sets two variables `boot_counter`, which indicates
the maximum number of boot attempts and `boot_success` which
tells the boot laoder if a previous boot was successful. The
bootloader on the other hand will decrement the counter variable
and reset the success indicator one.
An implementation of the user space component for rpm-ostree is
called `greenboot`.
2021-08-25 20:53:12 +02:00
Diaa Sami
7a676667d6 Don't save name or timestamp for compressed file 2021-08-24 20:47:00 +02:00
Diaa Sami
b93dedf353 stages: add org.osbuild.gzip to compress files
Add a new stage that will take a file from the input and compress
it via gzip.
2021-08-24 20:47:00 +02:00
Tom Gundersen
a40cf616f5 32
Release osbuild 32

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-08-24 14:48:14 +02:00