Commit graph

51 commits

Author SHA1 Message Date
Tomas Hozza
6edf4aad49 osbuild2: add prefix parameter to the fix-bls stage
The `fix-bls` stage supports a `prefix` argument, which was not
supported in composer. Specifying this argument is necessary in case the
`/boot` mountpoint is on a separate partition.

Add the `prefix` argument to the `fix-bls` stage. Amend unit tests.

The RHEL-8.5 and RHEL-9.0 `aarch64` `ec2` and `ami` images use partitioning
with `/boot` on a separate partition. Due to this, the pipeline must specify
a non-default prefix to the `fix-bls` stage.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-13 08:24:37 +02:00
Achilleas Koutsou
844f77f7ca distro/rhel85: add zipl.inst stage for s390x
Installs the zipl bootloader on the disk image.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-06 07:30:05 +02:00
Achilleas Koutsou
0ed4f057c2 osbuild2: zipl install stage
New stage: org.osbuild.zipl.inst

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-06 07:30:05 +02:00
Achilleas Koutsou
38e88daea6 osbuild2: Don't add nil stages
Do nothing if a nil value is passed to pipeline.AddStage().

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-06 07:30:05 +02:00
Ondřej Budai
5c9af03785 osbuild2/grub2.inst: always include location in stage options
Location property is actually required. If it's omitted from the stage
options, the stage just fails.

Also see: https://github.com/osbuild/osbuild/pull/759

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-08-05 13:43:17 +02:00
Tomas Hozza
a79e541cec osbuild2: fix typo in files_input.go
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-05 09:34:07 +02:00
Tomas Hozza
a2ecf46e04 osbuild2: extend chrony stage with leapsectz property
Add support for specifying the `leapsectz` property of
`org.osbuild.chrony` stage. Modify stage tests to test setting of the
value.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Tomas Hozza
52ccf1d6ef osbuild2: add xz stage implementation
Add support for osbuild `org.osbuild.xz` stage. The stage accepts Files
inputs.

Add unit tests for the added functionality.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Tomas Hozza
8271910051 osbuild2: refactor files inputs
osbuild stage inputs were originally implemented in composer as
stage-specific inputs, while in reality, they are defined as individual
inputs, usually accepted by multiple stages. Therefore a single stage
input can be passed to any stage, as long as the stage accepts it.

Files inputs type was previously defined, but not used by any stage.
Creation of proper inputs type structures is currently handled in
`internal/distro/rhel85/stage_inputs.go` instead.

Refactor files inputs type to be usable directly as an input type
structure for stages, which accept it. For now, implement only the
`org.osbuild.pipeline` origin and related input reference.

Add unit tests for the `FilesInputs`.

Define input origin names as string constants, so that they can be used
by inputs implementations, instead of using string literals.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Tomas Hozza
241c5cc9d6 osbuild2: fix typo in systemd-logind stage
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-08-02 19:05:09 +02:00
Tomas Hozza
928131003c osbuild2: fix incorrect function name in dracut.conf stage
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
cdc65f82da osbuild2: extract unit drop-ins from systemd -> systemd.unit
The part creating Systemd unit drop-ins was extracted from
`org.osbuild.systemd` stage to `org.osbuild.systemd.unit`,
before the osbuild v30 release. Update the composer implementation
to reflect the change.

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
49aebf1c68 osbuild2: change systemd-logind stage to match osbuild v30
The `org.osbuild.systemd-logind` stage was reworked before the osbuild
v30 release. Update the composer implementation to match the expected
schema.

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
6cd626d462 osbuild2: change dracut.conf stage to match osbuild v30
The `org.osbuild.dracut.conf` stage was reworked before the osbuild v30
release. Update the composer implementation to match the expected
schema.

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
b56642d6dd osbuild2: change modprobe stage to match osbuild v30
The `org.osbuild.modprobe` stage was reworked before the osbuild v30
release. Update the composer implementation to match the expected
schema.

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Tomas Hozza
d4de95ab5a osbuild2: change cloud-init stage to match osbuild v30
The `org.osbuild.cloud-init` stage was reworked before the osbuild v30
release. Update the composer implementation to match the expected
schema.

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

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-26 22:01:33 +02:00
Achilleas Koutsou
347fcf74a6 osbuild2: base device options are optional 2021-07-24 15:54:00 +02:00
Ondřej Budai
c656972f25 osbuild2: specify mounts as an array
osbuild has recently got support for specifying mounts as an array. This
commit takes advantage of it and uses this new format.

This allows us to specify the order of mounts which is important because
we cannot mount /boot/efi before / is mounted.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
bc1b45f7fa qemu stage test squash 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
ce0fddf4c2 osbuild2: unit tests for new stages 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
ceba83dcca distro/rhel85: introduce the vmdk image type 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
1ed9008785 distro/rhel85: introduce the vhd image type 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
dec74dba32 distro/rhel85: add image and qcow pipelines
Live image pipeline: Creates the live image in a file through a loopback
device.

Stages:
- truncate: create the file to hold the image
- sfdisk: partition the device
- mkfs.fat, mkfs.xfs: create the filesystems
- copy: copy the tree from the previous pipeline (the OS pipeline) into
  the directories where the partitions are mounted
- grub2.inst: install the bootloader

QEMU pipeline: Convert the live image from the previous pipeline to a
qcow2 image.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
6debb62758 osbuild2: separate input base types into new file
Keep input base types / interfaces separately from stages for
readability.
Cleaned up some unused interfaces in the process.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
e85fc3b48c osbuild2: new stages and osbuild features
Stages:
- org.osbuild.copy
- org.osbuild.truncate
- org.osbuild.sfdisk
- org.osbuild.qemu
- org.osbuild.mkfs.btrfs
- org.osbuild.mkfs.ext4
- org.osbuild.mkfs.fat
- org.osbuild.mkfs.xfs
- org.osbuild.grub2.inst

Stages can now have devices and mounts in addition to options and
inputs.

Devices:
- org.osbuild.loopback

Mounts:
- org.osbuild.btrfs
- org.osbuild.ext4
- org.osbuild.fat
- org.osbuild.xfs
2021-07-24 15:54:00 +02:00
Tomas Hozza
5359ff8da7 osbuild2: use type aliases for unexported types to prevent recursion
Some osbuild stages added as part of PR#1525 declare unexported types
which are complete copies of types with custom MarshalJSON method,
 to prevent recursion when marshalling to JSON.

Modify relevant osbuild stages to use type alias instead of declaring a
complete type copy.

https://github.com/osbuild/osbuild-composer/pull/1525

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-19 21:37:15 +02:00
Tomas Hozza
2be664de38 osbuild2: rename profile_id to profile in authselect stage
Reflect https://github.com/osbuild/osbuild/pull/729 in osbuild-composer.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-19 21:37:15 +02:00
Tomas Hozza
34d52aa8e1 osbuild2: add support for org.osbuild.authselect stage
Add support for the `org.osbuild.authselect` osbuild stage [1],
which allows one to set system identity profile and authentication
sources using `authselect`.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/696

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
006ff98025 osbuild2: support for x11-keymap option in org.osbuild.keymap
Add support for the newly added `x11-keymap` option in the
`org.osbuild.keymap` osbuild stage [1]. The option allows one to
set layouts for the X11 keyboard.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/693

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
f06e66b94b osbuild2: support for servers option in org.osbuild.chrony
Add support for the newly added `servers` option in the
`org.osbuild.chrony` osbuild stage [1]. The option allows one to
specify timeservers to be used by chrony, including a subset of
lower-level configuration options per each server.

Implement a custom JSON marshaller method for `ChronyStageOptions` to
ensure that exactly one of 'timeservers' or 'servers' is specified, as
mandated by the stage schema.

Optional values in `ChronyConfigServer` are declared as pointers to
distinguish the case when the value was explicitly set by the user from
the default value when the structure instance is created. All of these
options should be omitted from the JSON, but only when not explicitly
set, not when their value us "0" for int or "false" for bool. Downside
of this approach is that one can not easily use pointer to a basic
type literal in the struct literal. Passing the basic type literal has
to be workarounded using an intermediate variable, which address is
used in the struct literal.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/692

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
8367542f25 osbuild2: support for subscription-manager option in org.osbuild.rhsm
Add support for the newly added `subscription-manager` option in the
`org.osbuild.rhsm` osbuild stage [1]. The option allows one to
create configure subset of subscription-manager options in its
configuration file `/etc/rhsm/rhsm.conf`.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/659

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
29ade764ce osbuild2: support for unit-dropins option in org.osbuild.systemd
Add support for the newly added `unit-dropins` option in the
`org.osbuild.systemd` osbuild stage [1]. The stage allows one to
create `.service` unit files drop-in configuration files under
`/usr/lib/systemd/system/`.

Add unit test cases for the added functionality.

[1] https://github.com/osbuild/osbuild/pull/664

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
20e1cfeba4 osbuild2: add support for org.osbuild.cloud-init stage
Add support for the `org.osbuild.cloud-init` osbuild stage [1],
which allows one to configure cloud-init by creating
configuration files under `/etc/cloud/cloud.cfg.d/`.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/689

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
9957f378ca osbuild2: support for network-scripts option in org.osbuild.sysconfig
Add support for the newly added `network-scripts` option in the
`org.osbuild.sysconfig` osbuild stage [1]. The stage allows one to
create `ifcfg` configuration files under
`/etc/sysconfig/network-scripts`.

Add unit test cases for the added functionality as well as for other
options of the stage, which were missing.

[1] https://github.com/osbuild/osbuild/pull/663

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
bef4628a08 osbuild2: add support for org.osbuild.systemd-logind stage
Add support for the `org.osbuild.systemd-logind` osbuild stage [1],
which allows one to configure systemd-logind by creating
configuration drop-ins.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/668

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
5e97dcf2b3 osbuild2: add missing JSON unmarshaling test for org.osbuild.dracut stage
The `org.osbuild.dracut` stage was previously not tested for JSON
unmarshalling. Add the missing test case and extend Stage's
`UnmarshalJSON()` method.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
92719e05a2 osbuild2: add support for org.osbuild.dracut.conf stage
Add support for the `org.osbuild.dracut.conf` osbuild stage [1], which
allows one to configure dracut by creating configuration files.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/688

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Tomas Hozza
c0e8d4bdc4 osbuild2: add support for org.osbuild.modprobe stage
Add support for the `org.osbuild.modprobe` osbuild stage [1], which
allows one to configure modprobe by creating configuration files.

Add unit test cases for the newly added stage.

[1] https://github.com/osbuild/osbuild/pull/670

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-08 19:37:09 +02:00
Achilleas Koutsou
242f6d3c44 rhel85: tar installer main pipeline
Define a core set of packages and stages shared by images.
2021-07-01 12:48:32 +02:00
Achilleas Koutsou
1dcaa26966 osbuild2: add support for reading stage metadata
Metadata from stages in the output from osbuild in the v2 schema are
stored at the top level of the result structure.

Adding the same Metadata types from v1:
- org.osbuild.rpm stage
- org.osbuild.ostree.commit stage
- Raw metadata (for every other stage type)
2021-06-29 09:33:05 +01:00
Achilleas Koutsou
883adea2ac osbuild2: tar stage
Rename creation function from old assembler and add inputs.
2021-05-11 12:10:09 +02:00
Achilleas Koutsou
f7882993f9 osbuild2/bootiso: arch-based xz compression option
Added a helper function to the bootiso stage for setting the BCJ option
for xz compression.
The FSCompression struct is changed to use a pointer for the Options
substruct so it can be omitted when nil (omitempty).
2021-05-11 12:10:09 +02:00
Ondřej Budai
ea8d080c8a osbuild1/result: fix conversion of success field from v2
When a stage is successful in a manifest v2, the success field is omitted from
the result. In other words, the default value of the success field is true
which is against the default value of boolean in Go. This commit implements
a workaround.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-19 18:50:31 +01:00
Achilleas Koutsou
f8b3b3f7e2 rhel84,osbuild2: add system ID to ISO
New stage option added in osbuild
https://github.com/osbuild/osbuild/pull/611

System ID is used by osinfo to identify the RHEL boot ISOs, where the
system ID is "LINUX".
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
33cebcc8fc osbuild2: port tar assembler to new stage 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
bec194dfff osbuild2: add support for new osbuild stages
- org.osbuild.anaconda
    Configures Anaconda.  For now, only enabling kickstart modules is
    supported.

- org.osbuild.buildstamp
    Creates a buildstamp file, which is required by Anaconda.

- org.osbuild.kickstart
    Creates a kickstart file.

- org.osbuild.lorax-script
    Uses lorax template helpers to execute a template.

- org.osbuild.bootiso
    Prepares a bootable file system tree suitable for writing on an ISO
    file system

- org.osbuild.discinfo
    Creates a .discinfo file, used by the Anaconda installer.

- org.osbuild.xorrisofs
    Uses the `xorrisofs` command line utility to an ISO.

- org.osbuild.implantisomd5
    Uses the `implantisomd5` command to implant MD5 checksums into an
    ISO.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
011559f785 osbuild2: add SavedEntry to Grub2StageOptions
Added in osbuild1 already.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
f107241ee2 obsuild2: support additional layers in oci-archive
The org.osbuild.oci-archive stage now supports an arbitrary number of
layers on top of the Base layer.  The keys for these layers follow the
pattern "layer.N" (N = 1, 2, 3, ...).

We use a custom marshaller and unmarshaller for the
OCIArchiveStageInputs to handle this.  The unmarshaller also validates
the layer keys to match the pattern in the schema.
2021-03-17 18:12:17 +00:00
Achilleas Koutsou
dc5e46139a osbuild2: new dracut stage to re-create initrd 2021-03-17 18:12:17 +00:00
Achilleas Koutsou
164faa7503 osbuild{1,2}: new stages in unmarshal method
Recently added stages org.osbuild.sysconfig and
org.osbuild.kernel-cmdline were missing from the Manifest unmarshal
method causing it to fail when trying to unmarshal manifests that
contained them.
2021-03-17 18:12:17 +00:00