Commit graph

4442 commits

Author SHA1 Message Date
Christian Kellner
7f3f016ed1 distro: add containers arg to ImageType.Manifest
This is the first step to support embedding container images. Here
we add the `containers []container.Spec` argument to supply images
with resolved container specifications. For now all distros will
return an error in case a container is actually supplied since none
of them currently support embedding containers. NB: also no apis or
tools will actually resolve containers.
2022-07-21 13:32:07 +02:00
Christian Kellner
f8804358a4 osbuild: add new org.osbuild.skopeo stage
Add bindings for the `org.osbuild.skopeo` that can be used to copy
container images, accessed via the `org.osbuild.containers` input,
into images.
The constructor is designed with ease of use in mind and takes
the needed container inputs and the storage path option, i.e.
where to store the container in the images.
2022-07-21 13:32:07 +02:00
Christian Kellner
718b0c0c32 osbuild: add support for org.osbuild.container inputs
Add bindings for `org.osbuild.conainer` inputs which can be used to
supply containers to stages. Currently only fetching containers via
sources is supported.
2022-07-21 13:32:07 +02:00
Christian Kellner
513ae6d3d0 osbuild: add support for the org.osbuild.skopeo source
Add bindings for the `org.osbuild.skopeo` source that can be used
to fetch container images from container registires.
2022-07-21 13:32:07 +02:00
Christian Kellner
b4f890a909 container: add tests for resolver
Add checks for the new `container.Resolver`, including the failure
case.
2022-07-21 13:32:07 +02:00
Christian Kellner
76d80295fa container: add new resolver helper
Add a new class `container.Resolver` which can be used to resolve
multiple container images to their respective ids in parallel.
It should make it easy for all existing tools and api endpoints
to adpot container resultion.
2022-07-21 13:32:07 +02:00
Christian Kellner
dcbdcf4419 container: simple client resolver tests
Add some basic checks for the new `client.Resolve` method.
Specifically that pinning down the ids is working as expected.
2022-07-21 13:32:07 +02:00
Christian Kellner
60135dd5df container: add mock container registry for testing
Create a small only mock container registry to test `Client`.
Currently the registry is read-only and thus cannot be used
for upload tests but it can and will be used for container
resolution checks.
2022-07-21 13:32:07 +02:00
Christian Kellner
60607af26c container: ability to resolve containers to specs
Add a new `Resolve` method to `Client` that will resolve its `Target`
to the corresponding manifest digest id and its corresponding iamge
identifier. The former can be used in the URL to fetch a specific
image from the registry via `<name>@<digest>` and the latter uniquely
identifies a container image via the hash of its configuration object.
This should stay the same across pulls and is also the id returned via
`podman pull` and `podman images`.
Since (most) container images are OS and architecture specific a tag
often points to a manifest list that contains all available options.
Therefore the resolve operation needs to choose the correct arch for
image. A new pair of getters `Set{Architecture,Variant}Choice` lets
the user control which architecture/variant is selected during the
resolution process.
2022-07-21 13:32:07 +02:00
Christian Kellner
bd42243882 container: set default auth file path to sane location
Ensure that the `Client.AuthFilePath` points to a sane location,
which here means that the location is either accessible by the
current user or does not exist. This is because any other error
opening the auth file with lead to a overall failure when trying
to access container registries, even if the target resources is
public.
The reason we have to set it ourselves is that by default the
containers library looks in a sub-path of `XDG_RUNTIME_DIR` and if
that variable is not set it falls-back to `/run/containers/<uid>`.
Since `XDG_RUNTIME_DIR` is indeed not set for the composer process
started via systemd, it will fall-back, but it does not have access
to `/run/containers` and finding the authorization info for any
request will fail with "permission denied".
Add a setter so that we can set the `Client.AuthFilePath` to a
different location than the default one.
2022-07-21 13:32:07 +02:00
Christian Kellner
e53b9c8bb2 container/client: rework credentials storage
Instead of keeping an extra field in `Client`, we just use the
existing `sysCtx.DockerAuthConfig` structure. When the context
is later copied during the upload operation the credentials
will be copied as well. It also saves us from syncing the
credentials if we directly use said `sysCtx` for operations.
2022-07-21 13:32:07 +02:00
Christian Kellner
865a899f70 container/client: rework tls settings
Instead of having an extra field, `TlsVerify`, on the `Client` and
then later setting the corresponding `SystemContext` options, use
the existing `SystemContext` field of `Client`. The corresponding
field is a tri-state: unset, true, false, which is represented as
a pointer to boolean in the `Client`'s new getter and setter. This
also inverts the boolean logic from verify TLS to skip TLS which
aligns very well with the corresponding fields in the upload target
struct.
In addition we properly capitalize some existing variables.
2022-07-21 13:32:07 +02:00
Christian Kellner
4b67e12958 ci: install gpgme-devel for db test
This prepares the usage of the `internal/container` from composer
directly, as opposed to the existing use in the worker. Said pkg
uses the `containers/image/v5`, which uses `proglottis/gpgme` and
the latter needs the gpgme C library. We therefore install it and
its dependencies.
2022-07-21 13:32:07 +02:00
Christian Kellner
4c55063a55 Dockerfile-ubi: install gpgme devel package in builder
The go package `proglottis/gpgme` a dependency of `containers/image/v5`
package uses `libgpgme`. In the near future `internal/container`, which
depends on `containers/image/v5`, will be used directly in composer and
thus we need to install the `gpgme` devel package and its build deps.
2022-07-21 13:32:07 +02:00
Christian Kellner
f76b1545ca test/diff-manifests.sh: install build dependencies via spec file
This test is compiling `gen-manifests` via `go run` and thus needs
to pick up build requirements for the source. Instead of manually
installing the go toolchain use the `dnf build-dep` command on the
spec file so we pick up current and future build dependencies.
2022-07-21 13:32:07 +02:00
Jakub Rusz
f93b38c1a8 CI: fix ci_details artifact placement
The output of the ci_details.sh needs to be placed in the /tmp/artifacts
in order to be uploaded with the rest of the artifacts.
2022-07-21 13:17:45 +02:00
Jakub Rusz
151a9f5c86 tests/filesystems: Fix error checking
Checking the results of each scenario separately and making it more
clear what has actually failed.
2022-07-21 13:17:45 +02:00
Alexander Todorov
6e6f595c1a ci: Disable some Fedora-36 OStree testing due to #2702 2022-07-21 12:19:38 +03:00
Alexander Todorov
0cbac05d42 tests: Temporarily disable cloud-image-val util CLOUDX-54 is resolved 2022-07-21 12:19:38 +03:00
Alexander Todorov
9960021a56 Update version of cloud-image-val b/c of failure on Fedora-36
the test scenario which failed appears to be a noop on Fedora-36
and has been tagged appropriately in cloud-image-val.
2022-07-21 12:19:38 +03:00
Alexander Todorov
63a4ae7626 Update fedora-36 manifests 2022-07-21 12:19:38 +03:00
Alexander Todorov
9cf8054d21 Add fedora-36.json repo definitions 2022-07-21 12:19:38 +03:00
Alexander Todorov
d36e005b37 Update tests with config for Fedora 36 2022-07-21 12:19:38 +03:00
Alexander Todorov
4dab7b74cf COMPOSER-1623: Enable Fedora 36 testing 2022-07-21 12:19:38 +03:00
Ondřej Budai
0adbce3606 test/koji: remove the old code for testing koji API
Koji API is no more, let's drop the test and rename koji-compose-v2.py to
koji-compose.py.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-19 16:00:52 +02:00
Ondřej Budai
e779562f3c worker: remove osbuild-koji job
Koji API removed by the previous commit was the last user of osbuild-koji job.
Let's remove it since nothing uses it. This also removes all of the
compatibility code in Cloud API, see concerns below:

Compatibility concerns:
- the internal deployment was moved to a completely different composer
  instance, thus there are no old jobs
- Fedora deployment is still unused in prod, thus we don't care about keeping
  backward compatibility of the old jobs

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-19 16:00:52 +02:00
Ondřej Budai
74eb3860df internal: remove kojiapi
We no longer use it, let's remove it. If you are wondering what to use instead,
use Cloud API. It supports everything that Koji API supported and more.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-19 16:00:52 +02:00
Ondřej Budai
058edd3d76 cloudapi: remove a confusing test
This test tested two things:

1) Invalid route - this is already covered by TestUnknownRoute
2) Invalid UUID in the compose status route - this is now covered by
   TestComposeStatusInvalidUUID

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-19 16:00:52 +02:00
Ondřej Budai
3e25f5ef76 remove all traces of fedora 34
Fedora 34 is EOL, let's remove all traces of it, including:

- distro definition
- repositories (and test one)
- test manifests
- special package set rules
- hacks from the spec file

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-18 20:38:33 +02:00
Chloe Kaubisch
86971ca312 templates: update dashboards to include tenant
Add a tenant variable to the composer dashboard, with the option
to select multiple tenants. Add tenant filter to queries accordingly.

link to dashboard: https://grafana.stage.devshift.net/d/image-builder-worker-with-tenant/image-builder-worker?orgId=1
2022-07-18 18:55:13 +02:00
Ondřej Budai
30a1f6a68f github: fix the coverity scan action
It was failing on:

vendor/github.com/proglottis/gpgme/data.go:4:11: fatal error: gpgme.h: No such file or directory

Let's install this package before running the check, I verified that this
fix works locally.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-07-18 11:19:21 +02:00
Jakub Rusz
efbd5ebd7b ci/tests: Change the way artifacts are collected
We want to be able to safely gather any artifacts without worrying about
any possible secrets leaking. Every artifacts that we want to upload
will now have to be placed in /tmp/artifacts which will then be uploaded
to S3 by the executor and link to the artifacts will be provided in the
logs. Only people with access to our AWS account can see them.
2022-07-18 11:33:57 +03:00
Brian C. Lane
d3af314e58 users_stage: Don't allow empty passwords
Make sure empty passwords are set to nil so they result in a locked
account.

Also add a test for the password hashing in NewUserStageOptions()
2022-07-16 22:54:26 +01:00
Brian C. Lane
6adf3f5b7b blueprint: Don't allow empty password
If the password is set to "" it will get hashed, allowing access to the
account in some circumstances. Console and ssh login don't appear to
work in practice, but su to the account from another user account is
possible.

This sets the empty password to nil which makes sure that it ends up as
a locked account.
2022-07-16 22:54:26 +01:00
Brian C. Lane
20bf0c4836 blueprint: Hash all user passwords
This commit changes blueprint behavior to always store the hash of the
password for the 'customizations.user' accounts. Note that missing or
blank passwords are not hashed and should be dealt with at a lower
layer.

Resolves: rhbz#2107358
2022-07-16 22:54:26 +01:00
schutzbot
963c53ce09 schutzfile: Update snapshots to 20220715 2022-07-16 19:58:26 +02:00
dependabot[bot]
2285a0a03b build(deps): bump actions/setup-go from 2 to 3
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-16 19:15:06 +02:00
Juan Abia
b8f6ea4570 tag created vmare VMs
tag VMs with 'gitlba-ci-test' images so they can get removed with
cloud cleaner
2022-07-16 19:13:09 +02:00
Achilleas Koutsou
79fa253d69 repositories: remove centos-8 repos
The CentOS Linux 8 packages have been removed from the mirrors.
CentOS 8 is replaced by CentOS Stream 8. [0]

Keep the centos-8.json symlinked to centos-stream-8.json because
composer's host distro detection picks up CS8 as centos-8.

[0] https://www.centos.org/news-and-events/convert-to-stream-8/
2022-07-16 17:52:42 +01:00
Xiaofeng Wang
9a66ffa78b test: Install package sssd in all edge images for BZ#2088459 2022-07-16 16:14:56 +02:00
Xiaofeng Wang
a5a1611335 test: Update test for push container image to registry
Pushing container image to registry feature is ready by PR #2462,
test should be update to cover this feature
2022-07-15 13:12:46 +02:00
Alexander Todorov
62a681870e Tests: Use unified diff format - easier to read 2022-07-15 10:53:27 +02:00
Gianluca Zuccarelli
00f4f1690f Dockerfile: update worker builder
Additional packages are required to build the
docker worker. This fix updates the builder
container to install the required libraries
and then create the worker binary.
2022-07-15 03:06:43 +02:00
Achilleas Koutsou
9d4a351ca6 Rename osbuild2 package to osbuild 2022-07-14 16:54:00 +02:00
Achilleas Koutsou
01d87b4e60 osbuild1: DELETED 2022-07-14 16:54:00 +02:00
Achilleas Koutsou
dcef56c75a osbuild2: move v1 stage metadata parsing to convertStageResults
Make the v1StageResult.Metadata a simple json.RawMessage and perform the
RawMessage to StageMetadata conversion in the convertStage functions.
This lets us get rid of the custom v1StageResult Unmarshaller and the
v1RawStageResult, and makes the whole conversion process easier to
trace.
2022-07-14 16:54:00 +02:00
Achilleas Koutsou
d68a95c533 osbuild2: copy Result types from osbuild1
Types, parsing functions and helpers copied from osbuild1 to
osbuild2/v1result.go.
The metadata handling is simplified: osbuild1 stage metadata for the RPM
and ostree-commit stages is identical to the osbuild2 counterparts.
2022-07-14 16:54:00 +02:00
Achilleas Koutsou
c1956ba6e1 Use osbuild2 Manifest in all tests
The test_distro Manifest, which is used in tests across multiple
packages, was using the old structure.  Updated to the v2 structure and
adapted all tests.
2022-07-14 16:54:00 +02:00
Achilleas Koutsou
8eb12018c0 osbuild2: move v1 result handling code to separate file 2022-07-14 16:54:00 +02:00
Achilleas Koutsou
1c218bc633 osbuild2: fix package docstring 2022-07-14 16:54:00 +02:00