Commit graph

735 commits

Author SHA1 Message Date
Ondřej Budai
05fd221bd4 upload/koji: add support for GSSAPI/Kerberos auth
Prior this commit we only had support for username/password authentication
in the koji integration. This wasn't particularly useful because this
auth type isn't used in any production instance.

This commit adds the support for GSSAPI/Kerberos authentication.
The implementation uses kerby library which is very lightweight wrapper
around C gssapi library.

Also, the koji unit test and the run-koji-container script were modified
so the GSSAPI auth is fully tested.
2020-08-27 17:29:57 +01:00
Ondřej Budai
ecc7340570 upload/koji: allow passing a custom transport to koji.Login
In the near future, we will need to communicate with Koji using HTTPS.
This will surely bring the need for ignoring bad certificates/providing
our own self-signed ones. Thus, this commit prepares the Koji integration
by adding a way to accept a custom http transport which can be used to
customize the TLS settings.
2020-08-27 17:29:57 +01:00
Ondřej Budai
bc02da786d upload/koji: ensure that Koji type instance is always logged-in
Previously, Koji instance could be both logged-in and not logged-in.
This change disallows it: Now, the Koji instance is created by calling
koji.Login, so it must be always logged-in. This change should lead to more
robust code.
2020-08-27 17:29:57 +01:00
Ondřej Budai
f77f570202 upload/koji: extract RoundTripper from Koji type
The RoundTripper bits are not dependant on the Koji type, this commit extracts
them, so the responsibilities are clearly separated.
2020-08-27 17:29:57 +01:00
Ondřej Budai
1a13f6936c upload/koji: reuse the transport used by xmlrpc when uploading a chunk
This way, the handling of session and callnum is done at one place instead of
two places.
2020-08-27 17:29:57 +01:00
Ondřej Budai
c9d7892ec0 upload/koji: reorganize run-koji-container script
run-koji-container has now two actions: start and stop:
- ./run-koji-container.sh start
- ./run-koji-container.sh stop

The start action starts all containers. When it exits, all containers are
started and running in the background. To stop and removethem, use the stop
action.

This change is needed so we're able to easily use this script also in the CI
environment.
2020-08-27 17:29:57 +01:00
Ondřej Budai
355f4da115 upload/koji: use v1 koji container
rc1 doesn't seem to exist anymore.
2020-08-27 17:29:57 +01:00
Ondřej Budai
a32ff633ba upload/koji: make koji runner work with docker
The setup should be container engine agnostic. This changes allows this script
to be run on systems which prefer docker over podman (e.g. Github Actions).
2020-08-27 17:29:57 +01:00
Alexander Todorov
963e46f50d Always use .vmdk suffix after streamOptimized conversion
b/c vCenter gets confused by the .stream suffix
2020-08-26 14:45:31 +02:00
Alexander Todorov
3292b5eb68 Do not unlink file while it is still open
- inside RunJob() there is a deferred function which will remove
  the entire temporary directory in which images are created, including
  the streamOptimized file

- inside testBootUsingVMware(), which wants to use this function,
  there is already a deferred function which removes the converted
  image
2020-08-26 14:45:31 +02:00
Alexander Todorov
e7aa9c10c2 Move openAsStreamOptimizedVmdk() into importable package
so it can be used later within tests
2020-08-26 14:45:31 +02:00
Tom Gundersen
5803abfeee osbuild/result: parse the metadata from the rpm stage
osbuild support returning metadata about each of the stages/assembler
runs. Parse the results from the rpm stage, which contains the header
fields from the installed RPMs, in particular the MD5 sum of the RPMs in
question. This information is needed to be passed as metadata to koji
when uploading images.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-26 12:12:37 +02:00
Tom Gundersen
ac5f69e757 osbuild: move result serialization from common
In the same way `osbuild.Manifest` is the input to the osbuild API,
`osbuild.Result` is the output. Move it to the `osbuild` package where
it belongs.

This is not a functional change.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-26 12:12:37 +02:00
Ondřej Budai
8d1c187f3c upload/azure: delete the unused test
This test is not run anywhere because it was surpassed by image tests with
azure boot type which perform more than just uploading a randomly generated
file to Azure. Let's delete dead code.
2020-08-25 10:41:10 +02:00
Ondřej Budai
c711b9149e remove travis mentions in codebase
Travis is no longer used, let's ditch these.
2020-08-25 10:41:10 +02:00
Major Hayden
70c32ef7c5 awsupload: Add comments for Register()
Please the golang linter by adding a small comment for the Register
function.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
02306c978e awsupload: Better emoji for snapshot wait
The clock emoji isn't as well supported as the 🚚.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
6659ab58ad awsupload: Apply tags to imported snapshot
Applying a `Name` tag to the snapshot makes the name of the image appear
in the snapshot listing in EC2's console. It also makes it easier to
remove a snapshot after deregistering the AMI.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Major Hayden
fc7f6349eb awsupload: Add description to snapshots
Make it easier to tell which snapshot goes with each AMI by labeling
them with a description.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-24 12:57:37 -05:00
Tom Gundersen
b0cd29f78b worker: support returning returning images as StreamOptimized
vCenter requires images to be uploaded as vmdk StreamOptimized. Lorax
always produced images on this format, so we should make sure to do the
same for our VMWare images.

Allow LocalTarget to request the images produced by osbuild be converted
to be streamOptimized before saving in composer, and hook the weldr API
up to enable this option for vmdk images.

Ideally this should simply be an option in osbuild, but that would
require some more work, which we will not manage in time for RHEL8.3.
Therefore do this minimal fix.

Note that that means the images produced by our manifests (including in
our image-test test cases) are not on the format that the weldr API
returns, so the tests we run on them would also, for now, need to
convert before uploading to vCenter.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-23 14:45:27 +02:00
Tom Gundersen
cc677dea3c repositories: distinguish between RHEL8 beta and GA
We need the same RPMs to work equally well on a host running a beta
release (pulling beta content) as on a machine running GA (pulling GA
content). Detect this at run-time and point at the right repository.

Testing this is a bit hairy as we are building 8.3 images, but obviously
there is currently no 8.3 content at the GA URLs.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-19 15:06:21 +02:00
Tom Gundersen
a2f8a06e79 weldr/upload: don't expose AWS/Azure acconut details
Change the translation from our internal structs to the structs used for
weldr serialization to drop account details. These must obviously be
passed in to configure an upload, but exposing them in the logs may be
surprising.

There is no notion of user accounts in the weldr API, and the state
should not be considered private. However, this is likely to take people
by surprise, so let us guard the secrets entrusted to us.

Fixes #907.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-08-18 08:55:57 +02:00
Major Hayden
5d7aa2f699 Add friendly message for logs on running build
Improve the message returned by osbuild-composer when a user asks for
logs of a compose that is still running.

Signed-off-by: Major Hayden <major@redhat.com>
2020-08-17 09:10:50 +02:00
Brian C. Lane
5471bd7f30 store: Add newImageBuildFromV0 test 2020-08-13 17:47:57 +02:00
Brian C. Lane
02ef8a7174 store: Add newComposesV0 and newComposesFromV0 tests 2020-08-13 17:47:57 +02:00
Brian C. Lane
428d1f9478 store: Add newComposeV0 and newComposeFromV0 tests 2020-08-13 17:47:57 +02:00
Brian C. Lane
55136323c5 store: Add newSourceConfigsFromV0 and newSourcesV0 tests 2020-08-06 15:25:02 +02:00
Brian C. Lane
542dfc4ec2 store: Add newChangesFromV0 and newChangesV0 tests 2020-08-06 15:25:02 +02:00
Brian C. Lane
79b84fe52f store: Add newWorkspaceFromV0 and newWorkspaceV0 tests 2020-08-06 15:25:02 +02:00
Brian C. Lane
f0e2f01421 store: Add newBlueprintsFromV0 and newVlueprintsV0 tests 2020-08-06 15:25:02 +02:00
Brian C. Lane
45f3901a6a store: Add newCommitsV0 tests 2020-08-06 15:25:02 +02:00
Brian C. Lane
be2ce10b75 weldr: Fix out of range index for missing toml blueprint freeze
The API was crashing if the freeze request was called on a non-existent
blueprint. This changes it to return an empty string, matching
lorax-composer's behavior (since the output is toml it shouldn't return
json).
2020-08-05 11:43:35 +02:00
Brian C. Lane
ec19003b70 store: Fix copy failure when initializing blueprints commit list
copy() will not append to a slice, so if the length is 0 nothing will be
copied. Initialize the slice with the length instead of the capacity.

This fixes a problem with blueprint commits vanishing when the server is
restarted.

This commit also includes a new test in json_test for the
newCommitsFromV0() function.
2020-08-02 11:21:20 +01:00
Brian C. Lane
7ca9579487 client: Add an integration test for a bad blueprint depsolve
This test makes sure that a bad /blueprints/depsolve/... will return a
list of blueprints and a list of errors, not just a single error 400
response.
2020-07-28 08:18:56 +02:00
Brian C. Lane
eb76b9ec8e weldr: Fix the bad blueprint depsolve response
This changes the response to match lorax-composer's behavior. If any of
the blueprints in the list passed to /blueprints/depsolve/... have an
error that error should be appended to the error list, and the blueprint
included in the blueprints list with an empty dependencies section.

It was returning an error 400 and a single error if it hit any depsolve
problems, skipping any other blueprints and returning the wrong
response.

This also adjusts the tests to account for the change.

Fixes #890
2020-07-28 08:18:56 +02:00
Major Hayden
3daa751095 distro/rhel8: increase default image size to 4GB
RHEL 8.3 requires more than 2GB to install on aarch64/ppc64le.

Signed-off-by: Major Hayden <major@redhat.com>
2020-07-27 10:27:15 -05:00
Martin Sehnoutka
3fc03503a5 distro/f32: manually relabel cp in buildroot with install_t
By labeling `cp` with `system_u:object_r:install_exec_t:s0` we allow it
to copy labels unknown to the host.

See also corresponding commit in osbuild:
e80130a830
2020-07-22 10:47:46 +01:00
Martin Sehnoutka
f8f35016d6 osbuild: Add "labels" field into the SELinux stage
The SELinux stage supports labeling specific files with specific labels
like this:
7b0db90c76/stages/org.osbuild.selinux (L37)

This can be useful for preventing some SELinux issues during the image
build. You can find example usage here:
7b0db90c76/test/data/stages/selinux/test_basic.json (L5)

And more reasoning here:
e80130a830
2020-07-22 10:47:46 +01:00
Martin Sehnoutka
636b761b6b distro/f32: add SELinux RPM to build pipeline
This patch adds SELinux stage to build pipeline for f32 just like
we do for RHEL8. This helps with issues like this:
https://github.com/osbuild/osbuild-composer/issues/798
2020-07-22 10:47:46 +01:00
Martin Sehnoutka
60269abdff distro: print more information in case the test fails
This helps when looking for the issue because the previous input did not
mention which specific qcow2 test case failed.
2020-07-22 10:47:46 +01:00
chloenayon
ae3fb5e1c5 distro: enable cloud-init services for openstack and qcow2 images for fedora
Previously, cloud-init was installed on qcow and openstack images but was not
enabled, preventing a user from logging in to these images. Cloud-init, cloud-final,
cloud-init-local and cloud-config services are enabled to make cloud-init work
and to maintain consistency with official fedora 31 and fedora 32 images.

The image tests have been updated to reflect these changes.

Fixes #698
2020-07-18 11:57:05 +02:00
Lars Karlitski
f38d55da88 distro/tests: use test case filename as test name
These tests used the image type as test name, which is ambiguous. Use
the file name for the test case instead.
2020-07-18 10:52:11 +01:00
Tom Gundersen
fbfa191c81 rcm: drop sub-package
The osbuild-composer-rcm package was never finished, not in use and will be replaced by osbulid-composer-koji.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-07-17 19:13:15 +01:00
Tom Gundersen
bca53a596c crypt: add automatic darwin support
Currently one would have to pass a `macos` flag explicitly to build on
OSX, but if we replace `macos` with `darwin` this happens automatically.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-07-17 07:48:22 +02:00
Ondřej Budai
b4a57225a7 api/weldr: add missing modtime to tar returned by /compose/logs
This file was surely not created on 1970-01-01, this commit sets the ModTime
to the current datetime.
2020-07-15 08:58:25 +01:00
Ondřej Budai
454e471af8 api/weldr: bring tars back from the future
By default, go's tar archiver uses USTAR header format. Unfortunately, this
format doesn't support sub-second resolution for ModTime. Go solves this by
*rounding* the time. Sometimes, this creates an archive containing a file
with modtime from the future. When such archive is untarred by GNU tar,
the following message is produced:

tar: bf548dfd-0a90-40e6-bbf2-dcdd82fcbb4e.json: time stamp 2020-07-13
13:34:31 is 0.356223173 s in the future

We have two options here:

1) Use gnu header format that supports sub-second resolution. Unfortunately,
   it seems that not all tar archivers support this format (e.g. 7-zip).

2) The other option is to truncate the date (instead of rounding).

I went with option 2.

Also, this commit adds a test to check that the header is not from the future.
Without this fix, the test is actually failing, I verified this manually.

Fixes #854
2020-07-15 08:58:25 +01:00
Major Hayden
0f32f35756 📦 Use raw image format for AWS
Although the vhdx format is smaller than raw, AWS often has some issues
booting instances from an imported vhdx snapshot. The raw format seems
to boot consistently at AWS.

Fixes #754.

Signed-off-by: Major Hayden <major@redhat.com>
2020-07-02 13:11:11 -05:00
Tom Gundersen
8c7d8a442b osbuild: pass UID/GID as int
These were passed as strings, which is not what osbuild expects.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-29 16:04:38 +02:00
Tom Gundersen
50d469fe45 distro: replace BasePackages() with Packages()
Rather than getting a set of base packages from the ImageType, and then
appending the requested packages from the blueprint, pass the blueprint
into the new Packages() function, and return the full set of packages to
be depsolved.

This allows us to also append packages based on other customizations
too, and use that to append chrony when the timezone is set. This
matches the behavior anaconda had, and there was a TODO item to do this,
which had been overlooked.

Fixes #787.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-06-29 16:04:38 +02:00
Tom Gundersen
d31e3ebb65 distro: add groups before users
If a user is added to a group, then the group must be added first.
2020-06-29 16:04:38 +02:00