Commit graph

1873 commits

Author SHA1 Message Date
Alexander Larsson
693e44e412 sources test: Support custom mimetypes in http server
By creating a `foo.mimetype` file you can override the mimetype returned
for the file `foo`.
2022-02-10 14:43:17 +01:00
Alexander Larsson
dbaed75b46 osbuild-mpp: Support mpp-resolve-image for container images 2022-02-10 14:43:17 +01:00
Alexander Larsson
66cc2900c9 obuild-mpp: Add process_stage() helper
Both file embedding and depsolves start by iterating over all stages,
and we want to add another similar one for container installs, so
break out the iteration over the containers so that it is done in
one place only.
2022-02-10 14:43:17 +01:00
Alexander Larsson
46a228df38 Add support for installing containers in images
This adds a stage called org.osbuild.skopeo that installs docker and
oci archive files into the container storage of the tree being
constructed.

The source can either be a file from another pipeline, for example one
created with the existing org.osbuild.oci-archive stage, or it can
be using the new org.osbuild.skopeo source and org.osbuild.containers
input, which will download an image from a registry and install that.

There is an optional option in the install stage that lets you
configure a custom storage location, which allows the use of the
additionalimagestores option in the container storage.conf
to use a read-only image stores (instead of /var/lib/container).

Note: skopeo fails to start if /etc/containers/policy.json is
not available, so we bind mount it from the build tree to the
buildroot if available.
2022-02-10 14:43:17 +01:00
Alexander Larsson
b6629de7b2 Add skopeo to f34-build-v2 manifest
This will be needed to test the container support.
Also update the test data
2022-02-10 14:43:17 +01:00
Alexander Larsson
0c4b83e6e9 Update to the latest osbuild-ci container (with skopeo) 2022-02-10 14:43:17 +01:00
Jakub Rusz
d878824696 ci: remove fedora-33 and add fedora-35 2022-02-09 10:52:21 +01:00
Jakub Rusz
df189a7301 ci: update to 8.5 ga runners 2022-02-09 10:52:21 +01:00
Alexander Larsson
d57eeb38b9 Pass source-epoch to stages only if set
The client side does meta.get("source-epoch", default), but for
this to work we need to have the key unset if not specified,
but currently we set it to None.

Also, make sure the check for "not None" is explicit, because
we do consider a value of `0` to be a valid source-epoch.
2022-02-09 09:58:49 +01:00
Alexander Larsson
1897eaf8bc org.osbuild.oci-archive: Try to create more reproducible images
This tries to make the various tar-balls produced by the stage more
likely to be identical in separate runs. We do this by sorting
the names and removing some unnecessary metadata for the files.

The most important thing to get right is the layer tarball, because
that is what defines the container id. We sort the names to avoid
random differences, and drop ctimes and atimes because these are
generally just set to the something near the current build time which
is not useful to encode in the container image. This is as opposed
to the mtime which generally comes from e.g. the rpms that where
installed in the pipeline.

For the actual archive tarball we can standardize metadata even more,
because none of the metadata are used when consuming the archive.
2022-02-09 09:58:49 +01:00
Alexander Larsson
25b567990b oci-archive stage: Use source-epoch as creation data
If the source-epoch is specified, this is used as the creation date
instead of the current time.
2022-02-09 09:58:49 +01:00
Alexander Larsson
0ab4a6d401 Pipeline: Pass down the source-epoch to stages via the meta key
This can be used by stages that wish to support more reproducible
builds.
2022-02-09 09:58:49 +01:00
Alexander Larsson
b31c91d671 v2: Add source-epoch key in pipeline declaration and pass to buildroot
If this is set it is passed down to all stages and set as
SOURCE_DATE_EPOCH in the buildroot environment. This implements
the spec at:
  https://reproducible-builds.org/docs/source-date-epoch/
2022-02-09 09:58:49 +01:00
Alexander Larsson
e516bf7898 BuildRoot: Support adding custom env vars
We will need this later to set SOURCE_DATE_EPOCH in the build.
2022-02-09 09:58:49 +01:00
Thomas Lavocat
31fb124716 bootiso: add the option to compress using lz4 2022-02-08 16:02:36 +01:00
Ondřej Budai
172c4bcfaf runners: add rhel-87
As always, it can be just a symlink to rhel-82
2022-02-08 11:37:05 +01:00
Jakub Rusz
860a9bb49f tests/ci: fix sonarqube analysis for main branch
Only use the branch options if it's actually running in a branch and
analyse main without them, sonarqube otherwise doesn't recognize the
main branch.
2022-02-04 12:57:36 +02:00
jkozol
ee46f89647 Post release version bump
[skip ci]
2022-02-02 17:03:08 +00:00
Christian Kellner
0f670829a3 util/linux: fix BLK_IOC_FLSBUF on ppc64le
ioctl contants are platform dependent. It should be the same on
x86, aarch64 and s390x but it is indeed different on ppc64le.
This lead to the call to `ioctl_blockdev_flushbuf` actually
raising an exception of `OSError: [Errno 22] Invalid argument`.

The constant was calculated with a little python snippet that
in theory could also go directly into the code, but for now
the simpler condition in this patch is enough.

The snippet is a port of the defines from the Linux kernel,
specifically /usr/include/asm-generic/ioctl.h.

    class IOConstants:
        """IO Commands for Linux"""
        if platform.machine() == "ppc64le":
            NRBITS = 8
            TYPEBITS = 8
            SIZEBITS = 13

            DIR_NONE = 1
        else:
            NRBITS = 8
            TYPEBITS = 8
            SIZEBITS = 14

            DIR_NONE = 0

        NRSHIFT = 0
        TYPESHIFT = NRSHIFT+NRBITS
        SIZESHIFT = TYPESHIFT+TYPEBITS
        DIRSHIFT = SIZESHIFT+SIZEBITS

        @classmethod
        def make(cls, directory, iotype, nr, size):
            return ((directory << cls.DIRSHIFT) |
                    (iotype << cls.TYPESHIFT) |
                    (nr << cls.NRSHIFT) |
                    (size << cls.SIZESHIFT))

        @classmethod
        def make_dir_none(cls, iotype, nr):
            return cls.make(cls.DIR_NONE, iotype, nr, 0)

This is used to get the value for `BLKFLSBUF` taken from the
include `/usr/include/linux/fs.h`:

    #define BLKFLSBUF  _IO(0x12,97)	/* flush buffer cache */

The value is then obtained via:

    print("0x%x" % IOConstants.make_dir_none(0x12,97))
    0x20001261
2022-02-01 16:28:56 +01:00
Jakub Rusz
087b403042 ci: make jobs interruptible
This will cancel old running pipelines if a new one is created.
2022-01-27 13:01:35 +02:00
Jakub Rusz
b38524b7ee test/ci: fix sonarqube run on main
Minor oversight from previous commit. Specify clone depth in
.gitlab-ci.yml file instead.
2022-01-26 13:51:18 +02:00
Jakub Rusz
8bc4bff80c tests/ci: add sonarqube scan
Adding sonarqube scan to the pipeline.
2022-01-25 13:23:36 +02:00
ochosi
597759c18f Post release version bump
[skip ci]
2022-01-19 14:52:39 +00:00
Thomas Lavocat
bb30ffa062 Add the option of compressing using lz4
Using lz4 in squashfs reduces the time to complete the stage from 446s
to 4s on my laptop while making the produced iso going from 1.6G to
2.0G.
2022-01-11 13:20:11 +01:00
thozza
d19d1b498d Post release version bump
[skip ci]
2022-01-07 11:14:37 +00:00
Christian Kellner
26a250ca6e test/data: don't write cmdline in grub2
In the fedora-boot manifest, do not write the kernel command line
to the `grubenv` file.
2022-01-06 15:09:33 +00:00
Christian Kellner
ee96b11faf stages/grub2: ability to not write kernel cmdline
Currently we always write the kernel command line to the `grubenv`
file, if only to include the root device. Starting with Fedora 33
and thus RHEL 9, the kernel command line included statically in
the BLS snippets and the grubenv `kernelopts` variable not used.
Instead one of the {/usr/lib,/etc}/kernel/cmdline files is read
and the parameters in them used during the creation of the BLS
snippets.
Therefore we add a new `write_cmdline` option that, if set to
FALSE, will prevent us from writing the kernel command line.
2022-01-06 15:09:33 +00:00
Christian Kellner
d4f275e024 stages/grub2: fix whitespace in docstring
For you, David.
2022-01-06 15:09:33 +00:00
Christian Kellner
7a2b8ac107 stages/grub2: extract uuid js schema definition
The uuid schema is duplicated in a few places. Extract it and use
references to it instead.
2022-01-06 15:09:33 +00:00
Christian Kellner
94e9f62f63 test/osbuild: check devices, mounts schema
Also check that the schema is valid for devices and mounts.
2022-01-06 15:09:33 +00:00
Jelle van der Waa
e3515caf01 stages: Remove excess whitespace between words 2022-01-06 16:01:26 +01:00
Jelle van der Waa
3d4be5f059 stages/org.osbuild.pacman: Make /dev/stdin available
Installing the mkinitcpio kernel preset's requires /dev/stdin to be
available for calling install.
2022-01-06 16:01:26 +01:00
Jelle van der Waa
97202e53b0 stages: Respect grub_home for grub legacy boot
Additionally add a new QEMU image output target for testing
grub2/mkinitcpio stages.
2022-01-06 16:01:26 +01:00
Ondřej Budai
dccbfb5916 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:17 +01:00
Ondřej Budai
0b8dbd4bc3 stages/kickstart: ensure a newline at the end of the file
To simplify extending of the kickstart file.

Fixes: rhbz#2036971
2022-01-04 18:36:37 +01:00
Ondřej Budai
fe379b631b stages/kickstart: remove dead code
post nor anaconda wasn't ever set to something truthy, let's just remove them
2022-01-04 18:36:37 +01:00
Tomas Hozza
a9e1070ce2 Fix typo in tar stage schema option enum
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-22 11:50:08 +01:00
Jelle van der Waa
0cbd7898c7 Add mkinitcpio stage
This stage generates the initrd for Arch Linux and derivates.
2021-12-21 10:44:55 +01:00
Tomas Hozza
9786d1f0d6 stages: allow using sysconfig stage multiple times.
The sysconfig stage currently does not produce expected results when
used multiple times within the same pipeline. Specifically, the stage
always truncates respective configuration files for properties `kernel`
and `network`, if if these are not set in the stage options. Due to this
reason, the outcome of the image builds may depend on the order of
multiple occurrences of the sysconfig stage.

The following two pipeline snippets would produce different
configuration files content:

Configuration files are truncated:
```
{
  "type": "org.osbuild.sysconfig",
  "options": {
    "kernel": {
      "update_default": true,
      "default_kernel": "kernel"
    },
    "network": {
      "networking": true,
      "no_zero_conf": true
    }
  }
},
{
  "type": "org.osbuild.sysconfig",
  "options": {
    "network-scripts": {
      "ifcfg": {
        "eth0": {
          "bootproto": "dhcp",
          "device": "eth0",
          "ipv6init": false,
          "onboot": true,
          "peerdns": true,
          "type": "Ethernet",
          "userctl": true
        }
      }
    }
  }
},
```

No configuration files are truncated:
```
{
  "type": "org.osbuild.sysconfig",
  "options": {
    "network-scripts": {
      "ifcfg": {
        "eth0": {
          "bootproto": "dhcp",
          "device": "eth0",
          "ipv6init": false,
          "onboot": true,
          "peerdns": true,
          "type": "Ethernet",
          "userctl": true
        }
      }
    }
  }
},
{
  "type": "org.osbuild.sysconfig",
  "options": {
    "kernel": {
      "update_default": true,
      "default_kernel": "kernel"
    },
    "network": {
      "networking": true,
      "no_zero_conf": true
    }
  }
},
```

Change the stage to not touch respective configuration files if the
`kernel` and `network` properties are not set in the stage options.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-17 08:44:54 +01:00
Tom Gundersen
e97f6ef34e objectstore: don't store objects by their treesum
The treesum of a filesystem tree is the content hash of all its
files, its directory structure and file metadata.

By storing trees by their treesum we avoid storing duplicates of
identical trees, at the cost of computing the hashes for every
commit to the store.

This has limited benefit as the likelihood of two trees being
identical is slim, in particular when we already have the ability
to cache based on pipeline/stage ID (i.e., we can avoid rebuilding
trees if the pipelines that built them were the same).

Drop the concept of a treesum entirely, even though I very much
liked the idea in theory...

Signed-off-by: Tom Gundersen <teg@jklm.no>
2021-12-16 16:44:07 +00:00
ochosi
bf3c80372a Post release version bump
[skip ci]
2021-12-16 09:12:49 +00:00
Jelle van der Waa
a60af1e205 ci: update osbuild-ci containers image with pacman 2021-12-15 23:22:15 +01:00
Achilleas Koutsou
646dd238fe stages: add new org.os.build.pacman and org.osbuild.pacman.conf stage
Pacman is the default package manager for Arch Linux and derivates, the
pacman.conf stage generate a valid pacman.conf configuration file.

Co-Authored-By: Jelle van der Waa <jvanderwaa@redhat.com>
2021-12-15 23:22:15 +01:00
Achilleas Koutsou
bef387848f osbuild-mpp: Add support for a pacman resolver
This introduces a new dependency resolver to osbuild-mpp for Arch Linux
which uses the pacman package manager. The used solver is determined by
the `solver` field in the `mpp-depsolve` object inside the manifest
file, if it does not exists it falls back to the DepSolver for dnf/rpm.

Co-Authored-By: Jelle van der Waa <jvanderwaa@redhat.com>
2021-12-15 23:22:15 +01:00
Tomas Hozza
d7989a5c26 Add new stage for configuring DNF Automatic
Add a new stage `org.osbuild.dnf-automatic.config` for configuring DNF
Automatic.

The stage changes persistent DNF Automatic configuration. Currently, only
a subset of options can be set:
  - 'commands' section
    - apply_updates
    - upgrade_type

Fix #908

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-15 18:49:13 +01:00
Simon Steinbeiss
37c57bf5c9 release-action: Send notification to our Slack channel
Passing the webhook URL is necessary because GH composite actions don't
support handling secrets.
See also osbuild/release-action#3

[skip ci]
2021-12-11 14:06:13 +01:00
Tomas Hozza
cd4ac1c75a Add new stage for creating YUM / DNF repo files
Add a new stage `org.osbuild.yum.repos` for creating YUM / DNF `.repo`
files in `/etc/yum.repos.d`. All repo-specific options are supported but
only a subset of options which can be set for a repo as well as in the
[main] section are supported.

Add unit test for the new stage.

Fix #907

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-12-09 18:51:51 +01:00
Jelle van der Waa
f965ca8510 stages/users: Explicitly create a home directory
On distributions such as Arch Linux the home directory is not created by
default.
2021-12-09 16:48:31 +01:00
Sanne Raymaekers
5b3ebd7912 stages/org.osbuild.dnf.config: Edit /etc/dnf/dnf.conf
Fixes #906
2021-12-09 15:53:57 +01:00
Christian Kellner
c825c7e4fa buildroot: set container env variable
Set the container environment variable to indicate to programs
inside the build root that they are indeed running inside a
container (see also https://systemd.io/CONTAINER_INTERFACE/).
2021-12-09 13:14:27 +01:00