Commit graph

1702 commits

Author SHA1 Message Date
Christian Kellner
f16b606716 stages/grub2.legacy: new stage for non-bls config
Configure grub2 but instead of using the Bootloader Specification (BLS)
it uses traditional menu entries for the individual boot entries. This
is needed since RHEL7 does not have grub2 with BLS support.
2021-10-30 00:54:09 +01:00
Christian Kellner
da5150084e stages/parted: new stage to partition a device
Like the existing sfdisk stage, the parted stage can be used to create
a partition table on the specified device. In contrast to sfdisk, it
does not support uuids, neither for specifying the partition types,
nor the actual uuid of the partition. The current implementation only
supports GPT.
This stage is meant to be used on older systems, like RHEL 7, where
sfdisk exists but does not support GPT (or --json).
2021-10-30 00:54:09 +01:00
Christian Kellner
4a7e49c20b pipeline: don't bind-mount /boot from the host
When setting up the build root, only bind mount the `/boot` dir
from the supplied build tree, if the build tree is not the host
itself, since we never want to leak any host specific data and
the `/boot` directory should never be needed when building the
build root. The only reason `/boot` is mounted at all is for
the grub2 stage to copy efi binaries to the tree since they
directly installed to `/boot` by the respective bootloader
packages.
2021-10-30 00:16:03 +01:00
Christian Kellner
ccb26806fc buildroot: make mounting /boot optional
Currently, we take to paths from the root file system supplied
to the `BuildRoot` class: `/boot` and `/usr`. The reason for
mounting `/boot` is that grub2 and shim install efi binaries
there and for certain images we want to copy the binaries from
the build root and not install the respective packages.
However, if we build to build root itself, we probably don't
want the mount the hosts' `/boot` since we don't want to copy
anything from there. This change should give us the ability to
do exactly that.
2021-10-30 00:16:03 +01:00
Christian Kellner
d8a8dc84d6 setup.cfg: increase max-statements to 75
The default is 50, which we hit in a few places already. Let's do
75, equally arbitrary but gives us a bit more wiggle room.
2021-10-30 00:16:03 +01:00
Christian Kellner
de7fd7b402 runners: add new centos9 runner
Actually, rename the rhel90 runner to the centos9 runner, and
make the former a link to the latter, since in RHEL 9, CentOS
is the upstream and RHEL the downstream.
2021-10-30 00:14:16 +01:00
Ondřej Budai
a39d5af339 ci: remove 8.5 nightly testing
It no longer makes sense because:

- we don't make any changes to 8.5
- we don't regenerate test manifests for 8.5
- osbuild-composer for 8.5 is in the rhel-8.5.0 branch

Also, the latest-8.5.0 symlink was removed, which broke the CI.
2021-10-26 12:39:35 +02:00
Christian Kellner
c42c19356c mpp: fix long options
The correct way to specify long options is as separate arguments,
not as one argument separated by comma.
2021-10-25 18:01:25 +02:00
Alexander Larsson
611b6846e8 osbuild-mpp: Set the "arch" variable to the current rpm arch 2021-10-25 15:17:04 +02:00
Alexander Larsson
1425f66449 osbuild-mpp: Better handling of variable defaults and propagation
We now allow there to be default variables (none so far) which gets
installed as the initial value of manifest.vars.

Additionally, when including a file the default comes from the current
state of the including manifest, allowing the included manifest to use
variables from the base file.
2021-10-25 15:17:04 +02:00
Alexander Larsson
41db488aaa osbuild-mpp: Better handling of -D overrides
We expand variables in various places during load, like when importing
files, etc. This means that the current approach of merging the
overrides into `manifest.vars` at the end doesn't work.

Instead we track overrides completely separate, and when we do the
expansion that always replaces whatever is in `manifest.vars`.
2021-10-25 15:17:04 +02:00
Alexander Larsson
2d16f1243b osbuild-mpp: Allow using formating in depsolver node
This is very useful so that mpp-join can create a merged
package list.
2021-10-25 15:17:04 +02:00
Alexander Larsson
cedb2426c7 osbuild-mpp: Add mpp-join
This allows you to join a set of lists, its very nice to use
e.g. when constructing the package-list for a depsolve node.
2021-10-25 15:17:04 +02:00
Alexander Larsson
01fbc8c136 osbuild-mpp: Add mpp-eval
This:
 {"mpp-eval": "foo+bar"}

Is essentially the same as using mpp-format with a trivial format
string:

 {"mpp-format-int": "{foo+bar}"}

However, it is less to type, clearer to read, and supports
returning more complex types. For example, you can have a variable
that is a dict and expand that using eval.
2021-10-25 15:17:04 +02:00
Simon Steinbeiss
a33f1a975b Fix GitHub Action tag pattern
GitHub Actions currently doesn't support regular expressions, but
instead only "filter patterns".
https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
2021-10-25 15:13:03 +02:00
Ondřej Budai
8cd9fd79c6 mockbuild: reuse mock repos from the system ones
There's no need to define the repositories twice, let's just reuse the system
repository.

This change was already successfully applied in composer.
2021-10-21 17:48:08 +02:00
Ondřej Budai
b02dc8a7ab mockbuild: rotate a variable name
The previous one is no longer defined.
2021-10-21 17:48:08 +02:00
Ondřej Budai
74d1806ab0 gitlab: don't save journal 2021-10-21 17:48:08 +02:00
Ondřej Budai
f01d522dbf deploy: update to the latest composer commit
We rotated some variable names in composer, thus we need to adjust..
2021-10-21 17:48:08 +02:00
Ondřej Budai
3e402f126c ci: don't register the runners
They all subscribed before deploy.sh is even run.
2021-10-21 17:48:08 +02:00
Ondřej Budai
2f1b5d72dd trigger-gitlab: do not interpret the fetch_pulls outputs
Here documents are by default interpreted. Quoting the delimiter prevents
that.

See https://stackoverflow.com/questions/27920806/how-to-avoid-heredoc-expanding-variables
2021-10-21 11:35:08 +02:00
Simon Steinbeiss
4ff59e2086 Bump version numbers ahead of release
This is necessary for the new simplified release process and is done
ahead of time once for the upcoming release now.
After osbuild 40 this will be done by the GitHub composite action.
2021-10-19 11:21:54 +02:00
Simon Steinbeiss
4ea2915ef7 Switch to simple upstream releases
This commit changes our release process from the model of having a
release commit (and pull request) which also updated the NEWS.md file
and bumped the versions in the osbuild.spec and setup.py files to simply
pushing a tag.

After the tag (containing the release notes) is pushed, a GitHub
composite action is triggered that creates a GitHub release with the
contents of the git release tag. Furthermore the bumping of the version
number now always has to happen directly after a release to avoid having
to push a(n untested) commit to main for the release and this is also
handled by the GitHub composite action.

Finally packit pushes directly to dist-git now on pushing the release
tag, so no pull-request needs to be reviewed and merged anymore.
2021-10-19 11:21:54 +02:00
Christian Kellner
d76db390c8 stages/grub2.inst: ensure /var/tmp exists
Ensure that `/var/tmp` exists in the build root before trying to
create a file there. It seems to not be there on RHEL 7 build
roots.
2021-10-13 17:10:09 +02:00
Christian Kellner
bf5a7cdbb0 devices/loopback: remove extra "'" from print
There is an extra `'` character in the print messages that shows
which file we are using.
2021-10-13 17:10:09 +02:00
Jakub Rusz
221381b2de tests/ci: Switch to testing on 8.4 GA
Updating terraform sha and switching to 8.4 GA runners.
Also updating DISTRO_CODE for each runner.
2021-10-12 13:29:37 +02:00
Jakub Rusz
b065a456d6 tests: enable testing on RHEl-8.5 and RHEL-9.0
Also update osbuild-composer commit to use newer manifests.
2021-10-12 13:29:37 +02:00
Sanne Raymaekers
79f842d4e7 .github: Write PR data to a file first in trigger-gitlab
Using echo breaks if any PR body contains a `'` character.
2021-10-07 10:07:41 +02:00
Simon Steinbeiss
11dea50050 README: Add a link to our developer guide 2021-10-06 20:03:48 +01:00
Thomas Lavocat
00125e9fdb 39
Release osbuild 39

Signed-off-by: Thomas Lavocat <tlavocat@redhat.com>
2021-10-06 14:00:21 +02:00
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