Commit graph

38 commits

Author SHA1 Message Date
Brian C. Lane
0256e09031 lint: Clean up golangci-lint v1.60 complaints
This cleans up the linting results by adding checks for
integer underflow/overflow in several places, suppressing the error in
places where it has been checked, or fixing the types when possible.
2025-02-24 04:20:42 -08:00
Achilleas Koutsou
bec893e37c go.mod: update github.com/vmware/govmomi to v0.48.0
Needs manual change of import paths.
2025-02-01 18:14:18 +01:00
Sanne Raymaekers
fa3b203178 internal/boot: adapt to aws sdk v2 2024-08-20 15:32:40 +02:00
Tomáš Hozza
43e87632fb Drop common.CurrentArch() in favor of osbuild/images
Drop `common.CurrentArch()` implementation and use
`arch.Current().String()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Tomáš Hozza
c4e5ab5aca Drop internal/common/distro.go in favor of osbuild/images
Drop `common.GetHostDistroName()` implementation and use
`distro.GetHostDistroName()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2024-01-26 11:32:34 +01:00
Miguel Martín
991293a897 Generate FIPS compliant SSH keys
Generate FIPS compliant SSH keys required
for testing system FIPS mode support
2023-12-13 10:19:47 +01:00
Tomáš Hozza
1afe7d20c8 Adjust code to new version of osbuild/images
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-12-06 17:32:18 +01:00
Tomáš Hozza
b41705adfb Delete unused internal/platform package
This is a leftover from the `osbuild/images` split`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-10-20 18:59:00 +02:00
Achilleas Koutsou
8f69088af1 distro: remove architecture names and use platform enum
Removing the dependence of the manifest package on the distro package to
import manifest into distro.
Wherever arch names are needed, we use the enums from the platform
package instead.
2023-05-31 16:40:07 +02:00
Tomáš Hozza
e13f0a1ae2 AWS: allow specifying the AMI boot mode when registering the image
When the AMI is being registered from a snapshot, the caller can
optionally specify the boot mode of the AMI. If no boot mode is
specified, then the default behavior is to use the boot type of the
instance that is launched from the AMI.

The default behavior (no boot type specified) is preserved after this
change.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-05-19 13:24:39 +02:00
Ondřej Budai
abe6ccfb50 upload/azure: migrate from azure-storage-blob-go to azure-sdk-for-go
https://github.com/Azure/azure-storage-blob-go/ is deprecated, the main SDK
should be now used instead. Let's migrate the code. There should be no
functional changes.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2023-04-04 09:09:43 +02:00
Sanne Raymaekers
d952e41161 internal/boot: boot VMWare VMs with EFI and SCSI
Since we use streamOptimized images everywhere, we no longer need to use
IDE and boot with bios. Let's test a more realistic scenario.
2023-03-31 09:24:42 +02:00
Brian C. Lane
b1c2dbdfc6 Remove old build tag comments
Go is transitioning from the old '// +build' form to '//go:build', this
removes all uses of the old form, adding the new one where needed.

See https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md
2023-03-07 09:22:23 -08:00
Brian C. Lane
7a4bb863dd Update deprecated io/ioutil functions
ioutil has been deprecated since go 1.16, this fixes all of the
deprecated functions we are using:

ioutil.ReadFile -> os.ReadFile
ioutil.ReadAll -> io.ReadAll
ioutil.WriteFile -> os.WriteFile
ioutil.TempFile -> os.CreateTemp
ioutil.TempDir -> os.MkdirTemp

All of the above are a simple name change, the function arguments and
results are exactly the same as before.

ioutil.ReadDir -> os.ReadDir

now returns a os.DirEntry but the IsDir and Name functions work the
same. The difference is that the FileInfo must be retrieved with the
Info() function which can also return an error.

These were identified by running:
golangci-lint run --build-tags=integration ./...
2023-03-07 09:22:23 -08:00
Brian C. Lane
0298dc85ab azure: Add note that azure-sdk-for-go module is deprecated 2022-09-15 03:57:40 -07:00
Brian C. Lane
dfb69dc8e7 golangci-lint: The parameters passed to exec.Command are safe
None of these parameters are user controlled, they are either
constructed from paths or are constants.
2022-09-15 03:57:40 -07:00
Tomas Hozza
c7e5e3c9c2 Move GetRedHatRelease() and GetHostDistroName() to common package
The `distro` package is now used for distro definitions supported by
osbuild-composer, not for introspecting the Host system. Move
`GetRedHatRelease()` and `GetHostDistroName()` functions to the `common`
package.
2022-06-10 14:48:18 +01:00
Jordi Gil
616258ee25 distro: housekeeping with cpu arch and arch.Name() 2022-05-10 19:53:41 +02:00
Jakub Rusz
f4b5c0956d tests: update IDs in Openstack image boot test
Update flavor and network ID for booting Openstack images in rhos-01
cloud.
2022-02-14 12:13:18 +02:00
Juan Abia
eb3fa3e5d4 gosec: G204 - Subproccess launched as function arg
G204 doesn't necessarily indicate a bad behaviour. But could help
discover potential command injection vector.
2021-12-13 12:17:30 +02:00
sanne
c43ad2b22a osbuild-service-maintenance: Clean up expired images 2021-12-03 00:14:09 +00:00
Ondřej Budai
58423c262b ci: rotate secret names
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-10-21 07:28:46 +02:00
Diaa Sami
c35097fd52 Support for temporary credentials
Handle session token so that temporary credentials are supported
2021-09-02 15:13:42 +02:00
Ondřej Budai
579a5df698 upload/aws: add support for session tokens
If a user uses a temporary access key for login, a session token is also
needed.

This commit adds support for it to the internal aws library and also
to the osbuild-upload-aws helper. Note that this doesn't affect the main
osbuild-composer executable nor the worker. Everything here should work
as before and session tokens are not supported. Something for a follow up
if anyone needs it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-06-28 13:14:19 +03:00
Ondřej Budai
54a458af5c test: replace genisoimage with mkisofs
genisoimage might be removed from RHEL 9. The users are advised to switch
to mkisofs tools from the xorriso package. It should be a drop-in replacement.

The same change was recently done by libguestfs:

efb8a766ca
2216ab2e32

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-04-02 14:21:29 +02:00
Tom Gundersen
271960585b internal/boot/azure: set storage account
This was lost in a refactor.
2021-03-06 15:40:48 +00:00
Ondřej Budai
4f66ab5d7c upload/azure: rename Image to PageBlob
The UploadImage method doesn't actually create an image. It creates a Page
Blob. Blob is something like S3 object but in the Azure terminology. Page
Blob means that's optimized for random access and it's the only blob type
that can be used to create images.

This commit cleans up the terminology so it's less confusing.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
478f69e092 upload/azure: move UploadImage under a new StorageClient struct
We will soon introduce new methods to the storage client.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-03-06 15:40:48 +00:00
Ondřej Budai
449242ebda test/openstack: increase timeout for the instance to become ACTIVE
The openstack boot test often ruins our days with:

Waiting for instance 63ac19be-2e19-44e2-8bef-9770d68a190c to become Active
failed: A timeout occurred

I decided to investigate. It turns out the first boot of an image can take
up to 18 minutes. The subsequent ones are usually much faster (but don't rely
on this fact, I saw 15 minutes there).

This commit bumps the timeout to 30 minutes. This should be plenty of time
for the instance to spin up and get into the ACTIVE state.

Honestly, I'm not very happy with the solution but it should help with the
failing Schutzbot. As a follow up, I will reach to the PSI OpenStack team
and ask them if we could somehow speed up the process (maybe by using another
flavor, ci.m1.medium.ephemeral just might be slow for some reason, I don't
know).

Anyway, this should help us in the short term because I strongly believe that
a slow test is still better than a failing one.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-02-25 17:27:01 +00:00
Ondřej Budai
5eb402415d distro/rhel84: add centos 8 stream support
The image definition is shared with the latest RHEL 8.y one (8.4 currently).
I expect that we the introduction of 8.5 support, we point the centos 8
distro at it.

The test repositories and manifests use the official CentOS composes. From
what I can tell, they are persistent. This is not guaranteed though, so we
might need to switch to RPMRepo at some point.

The "classic" CentOS 8 should also be buildable but due to the chicken and egg
issue (this commit will get into Centos "8.4" but Centos "8.4" isn't a thing
yet), we cannot test it and therefore it might be broken.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-02-14 16:08:08 +00:00
Ondřej Budai
9f80c2ac8e test/image: print saner error messages
%#v was my bad understanding of Go's error formatting. Let's use the standard
%v that gives saner and human-readable error messages.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-01 08:27:44 +01:00
Ondřej Budai
7256a92d15 test/image: use t4g.micro instance type for aarch64
The instance type is arch-dependant, therefore it's needed to pick the right
one for a given arch.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-01 08:27:44 +01:00
Ondřej Budai
4548923a09 upload/aws: fix architecture for aarch64 images
Previously, composer wrongly set x86_64 architecture even for aarch64 images.
This commit fixes it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2020-12-01 08:27:44 +01:00
Sanne Raymaekers
22c9f6af61 cloudapi: Share an ec2 snapshot/ami with an account 2020-11-26 13:08:18 +00:00
Martin Sehnoutka
509964bede image-tests: don't use random names for CI artifacts
When using random names for artifacts like AWS snapshots, or Azure
images, it becomes hard to clean them up in case of CI failure. See this
issue for more details:
https://github.com/osbuild/osbuild-composer/issues/942

This PR introduces predictable names so that we can easily determine
which artifact belongs to which PR and therefore we can decide to wipe
all resources that are not needed any more.
2020-09-15 14:30:51 +02:00
Martin Sehnoutka
e80110a12c azuretest: Refactor clean up code to separate functions
In order to run the clean up in a separate binary it is necessary to
refactor the clean up code away from the context manager.
2020-09-15 14:28:22 +02:00
Martin Sehnoutka
125fce92db internal/boot: Make some function public
More specifically only those that are needed in
/cmd/osbuild-image/tests.

This patch can be merged with the previous one if we want to make sure
every commit can be built, but I'm going to keep it like this for now so
that we can easily see the changes.
2020-09-03 15:12:59 +01:00
Martin Sehnoutka
ec6ce8387d internal/boot: introduce package for booting images
The package takes the existing code from /cmd/osbuild-image-tests and
makes it available for other executables.
2020-09-03 15:12:59 +01:00