Commit graph

1133 commits

Author SHA1 Message Date
Achilleas Koutsou
5909ca202d disk: boot partition finder as partitiontable method
Moved the function that searches for the boot partition index to the
PartitionTable struct as a method. The method returns -1 if not found
and it's now the responsibility of the caller to handle the case where
it is not found.
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
dc62275d4d common: helper function for uint64 ptr 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
cba720e63f rhel85: depsolve blueprint packages separately
To avoid packages specified in a blueprint from conflicting with exclude
lists, we depsolve blueprint packages separately and pass them into the
Manifest generator under the new "blueprint" package set key.

This approach has the added benefit that dependencies of packages
specified in the blueprint are not subject to exclusion in addition to
the explicitly named packages.

The OS pipeline which installs the packages for the base system merges
the two package sets before running the RPM stage. The signature of the
function is changed to explicitly require blueprint packages be
specified (though `nil` or empty slice is valid).

The kernel selection test is adapted to merge the package sets before
counting kernel package.

Adaptation of changes in
https://github.com/osbuild/osbuild-composer/pull/1349
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
190f473b04 distro/rhel85: update unit tests 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
d6ec5aa59e distro/rhel85: update ami package set
Based on http://git.app.eng.bos.redhat.com/git/spin-kickstarts.git/tree/rhel8/rhel-8.5-ec2.ks
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
b8d34d7679 distro/rhel85: introduce the ami image type
This is a copy of the ami image type from RHEL 8.4.
Small modifications are necessary.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
1f005a55b9 distro/rhel85: don't always install bootloader
Don't install bootloader unless `platform` (imageType.arch.legacy) is
defined.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
9c3c956655 distro/rhel85: aarch64 uefi: true 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
3f0f4ffab9 distro/rhel85: simplify edge types and package sets
- Cleaned up distro-specific edge package sets
- Added edge package set merging in PackageSets() function
- Edge image type definitions are no longer arch specific, just like the
  other image types
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
78920efc36 distro/rhel85: partition table fixes
- Automatically find /boot partition (fallback to root)
- Partition sizes need a bit of a shrink
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
876a67ccb0 distro/rhel85: introduce the openstack image type 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
2ef462bdaa distro/rhel85: add dhcp-client to vhd packages
Is no longer installed by default but is required to boot in Azure
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
3eae16badb distro/rhel85: remove installer type for aarch64
The installer image type needs package definitions and testing before it
can be included in aarch64.
Removing for now.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
f09bf063c8 distro/rhel85: tidy up package sets
- Move all package set definitions to package_sets.go file.
- Do not append image package sets to arch and distro sets; this happens
  automatically in PackageSets() method.
- Fix architecture-specific package sets (boot and build where
  available).
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
Achilleas Koutsou
4cf26bb628 distro/rhel85: split coreStages() implementation
coreStages() was meant to produce the stages that are common between all
image types. Since there are too many exceptions and differences between
traditional and edge image types, keep the two pipelines separately
instead.

Moved SELinux stages to the end of each pipeline.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
39371b01ba distro/rhel85: document selinuxStageOptions arg
Renamed the argument to have clearer (and correct) meaning and added a
function docstring to describe the purpose.

The argument is set to 'true' in the build pipeline.
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
708de084aa distro/rhel85: add grub2 stage options 2021-07-24 15:54:00 +02:00
Achilleas Koutsou
bf61ca422f distro/rhel85: introduce the qcow2 image type
- distro definition
- qcow2 package set
- pipeline generation function (unfinished)
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
23de460a66 disk: generate fstab stage options for osbuild v2
Same function as v1 but generates v2 struct for v2 pipelines
2021-07-24 15:54:00 +02:00
Achilleas Koutsou
fd4a8387f7 distro/rhel85: partition table generator function
Copied from RHEL 8.4
2021-07-24 15:54:00 +02:00
Chloe Kaubisch
4c800f29a7 worker: add metrics
use prometheus to gather metrics
2021-07-23 21:54:28 +02:00
Thomas Lavocat
cfc91a3eb6 CloudAPI: Invalid package set returns 400
Previously a bad error code was returned, fixes #1477.

Testing:

I have two test cases to test the solution. The first is a request that
makes depsolve crash by changing the dnf-json script by an almost empty
one that only throws an exception. The second one fails because it
requests a non existing package. The former ends with a 500 error and
the later with a 400.

----8<-----

HTTP/1.1 500 Internal Server Error

Failed to depsolve base packages for ami/x86_64/centos-8: ailed to
depsolve base packages for ami/x86_64/centos-8: unexpected end of JSON
input

----8<-----

HTTP/1.1 400 Bad Request

Content-Length: 226Failed to depsolve base packages for
ami/x86_64/centos-8: DNF error occured: MarkingErrors: Error occurred
when marking packages for installation: Problems in request:
missing packages: jesuisunpaquetquinexistepas_idonotexist
2021-07-21 16:21:15 +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
3a0540dff0 test/api.sh: randomize used GCP zone from the region
The `api.sh` test currently always defaults to "<REGION>-a" zone when
creating instance using the built image. The resources in a zone may get
exhausted and the solution is to use a different zone. Currently even a
CI job retry won't help with mitigation of such error during a CI run.

Modify `api.sh` to pick random GCP zone for a given region when creating
a compute instance. Use only GCP zones which are "UP".

The `cloud-cleaner` relied on the behavior of `api.sh` to always choose
the "<REGION>-a" zone. Guessing the chosen zone in `cloud-cleaner` is
not viable, but thankfully the instance name is by default unique for
the whole GCP project. Modify `cloud-cleaner` to iterate over all
available zones in the used region and try to delete the specific
instance in each of them.

Make `ComputeZonesInRegion` method from the `internal/cloud/gcp` package
exported and use it in `cloud-cleaner` for getting the list of available
zones in a region.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2021-07-16 10:14:30 +02:00
Brian C. Lane
b5f0400bd4 weldr: Filter the list of supported distributions
Some distributions do not have repositories and therefore cannot be
built. This filters the list of supported distributions by checking for
repos when starting up. All other requests use the api.distros list or
api.getDistro() function.
2021-07-12 08:58:42 +02:00
Brian C. Lane
fabe0d28d2 reporegistry: Add a DistroHasRepos helper function
This returns the repos and the found flag, useful for testing if a
distro has any valid repos.
2021-07-12 08:58:42 +02:00
Brian C. Lane
963ce1d050 weldr: Use host distro name from registry list
The name of the distro you get from distros.FromHost() may not match any of
the names in the registry's list. Use the actual name of the distro
instead of the mangled name.

Also removes api.distro which is unused.
2021-07-12 08:58:42 +02:00
Brian C. Lane
b0f9d38a95 api_test: Test new source with 2nd distro 2021-07-12 08:58:42 +02:00
Brian C. Lane
f731d7a606 api_test: Test compose with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
788daf91a4 api_test: Test projects/depsolve with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
e010e2c421 api_test: Test modules/info with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
2ad4b84af6 api_test: Test projects/info with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
c9f4b1ac8b api_test: Test modules/list with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
05f327c796 api_test: Test projects/list with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
43171b4169 api_test: Test compose types with 2nd distribution 2021-07-12 08:58:42 +02:00
Brian C. Lane
5021ef06f7 Add 2nd distribution to the NewTestAPI function
This will help test support for multiple distributions.
2021-07-12 08:58:42 +02:00
Brian C. Lane
c1da403dc0 weldr: Use GetAllDistroSources in allRepository* functions 2021-07-12 08:58:42 +02:00
Brian C. Lane
76e65e88c8 store: Add GetAllDistroSources function 2021-07-12 08:58:42 +02:00
Brian C. Lane
e2b170e754 weldr: Check source POST for valid distros 2021-07-12 08:58:42 +02:00
Brian C. Lane
2b56e4d8e9 store: Add Distros to Source structs 2021-07-12 08:58:42 +02:00
Brian C. Lane
f79f399808 weldr: Add optional distro selection to compose/types 2021-07-12 08:58:42 +02:00
Brian C. Lane
f233f540e5 weldr: Fix PROJECTS_ERROR response 2021-07-12 08:58:42 +02:00