Commit graph

1546 commits

Author SHA1 Message Date
Achilleas Koutsou
59dcab700e distro/rhel86: conditional greenboot packages for centos
CS8 and RHEL 8.6 share package sets but the greenboot package names were
only changed in RHEL 8.6.
2022-02-16 10:49:55 +01:00
Peter Robinson
35b5b2b042 Update greenboot packaging names
In the greenboot 0.13 release we updated packaging due to the increase
in new tests and it not making sense to have packaging so granular.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2022-02-16 10:49:55 +01:00
Sanne Raymaekers
d492e8f702 cmd/osbuild-service-maintenance: GCP deletes by image name 2022-02-15 18:22:39 +01:00
Brian C. Lane
9f29f8eb25 store: Filter out blank blueprint name
Filter out listing blueprints with no name. This prevents old state.json
data from continuing to cause problems with the UI.

Resolves: rhbz#1922845
2022-02-15 10:10:21 +01:00
Brian C. Lane
a186fd4705 weldr: Check for missing undo blueprint
When the server is restarted the blueprint changes, which are only held
in memory, are lost. This checks for missing changes and returns an
error.

The test is also adjusted for the new error.

Related: rhbz#1922845
2022-02-15 10:10:21 +01:00
Brian C. Lane
aa8cf41ac2 blueprint: Make sure name is not empty
The blueprint name should never be empty, as it can cause other problems
like with the blueprints list results. Return an error if one is pushed
to the store, either as a blueprint commit or as a blueprint workspace.

Also adjusts the new test for the new error.

Related: rhbz#1922845
2022-02-15 10:10:21 +01:00
Brian C. Lane
a3b415d1df test: Add fixture support for blueprint changes
There is a problem with blueprint changes, once the server is restarted
the previous changes are all lost because they are not serialized to
disk.

This adds test fixture support so that new tests can be added before
fixing the problem. It adds store.FixtureOldChanges with blueprints
changes and empty blueprints.

Related: rhbz#1922845
2022-02-15 10:10:21 +01:00
Achilleas Koutsou
346486cd3f cloudapi: test repository config conversion function 2022-02-14 17:38:41 +01:00
Achilleas Koutsou
679028bb8e cloudapi: copy all Repository fields to RepoConfig 2022-02-14 17:38:41 +01:00
Achilleas Koutsou
2d0755b924 cloudapi: test new repository collection function 2022-02-14 17:38:41 +01:00
Achilleas Koutsou
3320f2c57d cloudapi: separate repositories based on package_sets
- Any repository without package_sets is added to the general `Repos`
  field of the DepsolveJob, just like before.
- Repositories with package_sets are added to the `PackageSetsRepos`
  map, indexed by the package set names.
- Repositories defined in the customizations as `PayloadRepositories`
  are considered to be associated only with the `PayloadPackageSets`
  names from the image type and are added to the `PackageSetsRepos`
  under the payload sets.

The repository collection and conversion of repository structs (from
Repository to RepoConfig) has been moved to a separate function.
2022-02-14 17:38:41 +01:00
Achilleas Koutsou
2dde6d7e33 cloudapi: add tags to repositories in image request
Tags is an array of strings that associates repositories with package
sets.  A repository tagged with a package set name will be used only for
the named package sets.
2022-02-14 17:38:41 +01:00
Achilleas Koutsou
82eedf5b82 DepsolveJob: rename struct field for consistency
We have two fields, `Repos` and `PackageSets`.  Renaming
`PackageSetsRepositories` to `PackageSetsRepos` for consistency.
The struct is for internal use only so the rename has no impact as long
as the serialised name is the same (json tag).

Also it's shorter.

Added docstring to the struct that explains the arguments in the same
way as they are described for the `depsolve()` function.

Changing the name of the argument in the internal `depsolve()` function
for the same reasons.
2022-02-14 17:38:41 +01:00
Achilleas Koutsou
0e5bb66516 cloudapi: small comment for readability
Comment the code that reads the user-defined repositories to explaine
what's happening.
2022-02-14 17:38:41 +01: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
Christian Kellner
b18b4e80a0 distro/{rhel86,rhel90}: specify a remote for deployments
When deploying an ostree commit, specify a remote, currently hard-
coded to `rhel-edge`, so that updates work automatically, if they
are served from the same location as the initial commit is pulled
from.

NB: now that the remote is specified in the raw image, remove the
corresponding bits form the tests.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-11 12:30:44 +01:00
Christian Kellner
4b84a3c70f osbuild2: add 'remote' option for ostree.pull
Add support for the `remote` option of the `ostree.pull` stage.
This can be used to tie a commit to a remote while pulling the
commit.
2022-02-11 12:30:44 +01:00
Christian Kellner
bebf046f84 osbuild2: add 'remote' option for ostree.deploy
Add support for the `remote` option of the `ostree.deploy` stage.
This can be used to deploy a commit that is tied to a remote.
2022-02-11 12:30:44 +01:00
Diaa Sami
c1ae5b0881 Relax TCP timeouts for koji connections
See COMPOSER-1354 and linked tickets
2022-02-10 14:58:10 +01:00
Ondřej Budai
631bd21ffe cloudapi/v2: add support for aws-*-rhui image types
For the brew use-case, we also need to build AWS images containing RHUI. This
commit is thus adding them.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-02-10 11:26:50 +00:00
Ondřej Budai
b1a40c1040 distro: add an alias for RHEL 8.7
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-02-08 17:37:36 +01:00
Gianluca Zuccarelli
80f24dbd61 metrics: change job metrics namespace
Currently the job metrics are namespaced with the composer
subsystem, i.e. `composer_worker`. Since we plan to split
the components to their own namespaces in app interface,
the worker subsystem should be split too.
2022-02-08 15:57:12 +01:00
Tomas Hozza
2c04329645 distro: drop support for Fedora 33
Fedora 33 is already EOL, therefore there is no point in supporting
image builds for it. Drop F33 from the distroregistry list and remove
F33 repositories definition.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-08 10:19:52 +01:00
Tomas Hozza
eb36b86161 RHEL-90: Remove deprecated crashkernel=auto option
Setting of the `crashkernel` option to the appropriate value is now done
by the `kexec-tools` package when installed and when any new kernel is
installed.

Regenerate relevant image test cases.

Fix #1819
Fix rhbz#2006692

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-07 09:29:07 +01:00
Gianluca Zuccarelli
1e443cf0fa worker: fix error status codes
The DNFDepsolveError and DNFMarking error should have
a `4xx` code instead of a `5xx` error code.
2022-02-04 19:30:25 +01:00
Gianluca Zuccarelli
290472dfdf metrics: add worker error metrics
This commit introduces the collection of error
metrics since it is now possible to differentiate
between internal errors and user input errors.
Additionally, the error status is reported for
job duration metrics.
2022-02-03 23:40:42 +00:00
Gianluca Zuccarelli
6c4caec022 metrics: move metrics to worker server
For simplicity, the collection of the job metrics
was carried out in the job queue. This was only
being done in the dbqueue and not in the fsqueue.
This pr refactors the metric collection and moves
the job metrics to the worker server, by adding a
wrapper function to enqueueing jobs so that the
metrics only have to be recorded in one place when
queueing a job.
2022-02-03 23:40:42 +00:00
Gianluca Zuccarelli
bce12b7bea metrics: extract metric collection
Refactor the current metric collection to make use
of re-usable functions, since some of the same queries
are repeated. This will also make it easier to move
the collection of metrics from the job queue.
2022-02-03 23:40:42 +00:00
Tomas Hozza
07a5745875 internal/cloud/gcp: use pkg.go.dev/cloud.google.com/go for Compute Engine
The internal GCP package used `pkg.go.dev/google.golang.org/api` [1] to
interact with Compute Engine API. Modify the package to use the new and
idiomatic `pkg.go.dev/cloud.google.com/go` [2] library for interacting
with the Compute Engine API. The new library have been already used to
interact with the Cloudbuild and Storage APIs. The new library was not
used for Compute Engine since the beginning, because at that time, it
didn't support Compute Engine.

Update go.mod and vendored packages.

[1] https://github.com/googleapis/google-api-go-client
[2] https://github.com/googleapis/google-cloud-go

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-03 15:35:28 +01:00
Christian Kellner
9302befa67 distro/rhel90: disable pw auth for EC2 images
Disable loging in via password authentication since this is an
official Amazon marketplace requirement

  Linux-based AMIs must not allow SSH password authentication.
  Disable password authentication via your sshd_config file by
  setting PasswordAuthentication to NO.

  Section "Security policies" from
  https://docs.aws.amazon.com/marketplace/latest/userguide/product-and-ami-policies.html
2022-02-03 14:57:16 +01:00
Christian Kellner
90cebf0337 distro/rhel86: disable pw auth for EC2 images
Disable loging in via password authentication since this is an
official Amazon marketplace requirement

  Linux-based AMIs must not allow SSH password authentication.
  Disable password authentication via your sshd_config file by
  setting PasswordAuthentication to NO.

  Section "Security policies" from
  https://docs.aws.amazon.com/marketplace/latest/userguide/product-and-ami-policies.html
2022-02-03 14:57:16 +01:00
Christian Kellner
8aede24057 distro/rhel85: disable pw auth for EC2 images
Disable loging in via password authentication since this is an
official Amazon marketplace requirement

  Linux-based AMIs must not allow SSH password authentication.
  Disable password authentication via your sshd_config file by
  setting PasswordAuthentication to NO.

  Section "Security policies" from
  https://docs.aws.amazon.com/marketplace/latest/userguide/product-and-ami-policies.html
2022-02-03 14:57:16 +01:00
Christian Kellner
6f132181d9 distro: add sshd config to ImageConfig
Ability to specify the sshd configuration via the ImageConfig
data structure.
2022-02-03 14:57:16 +01:00
Tomas Hozza
b9efe82bd7 distro/fedora: implementation cleanups for newer releases
Clean up some implementation aspects of the Fedora distro definition:
 - Do not have default Fedora distro version and use `fedora` as the
   package name in all places that use it, instead of `fedora33`.
 - Fix bugs when wrong (Fedora 33) values were returned by `OSTreeRef()`
   and `Releasever()` for newer Fedora releases.
 - Test Fedora 35 in package unit tests.
 - Add unit test for `OSTreeRef()` method.
 - Use architecture name constants from `distro` package, instead of
   string literals.

Fix #1802

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-03 14:51:07 +01:00
Tomas Hozza
8b8c7bbbbe Fix FS label of the ESP in Fedora distro definition
The QEMU assembler in Fedora distro definition for UEFI systems used
longer than allowed label for the VFAT filesystem of the EFI System
Partition. The maximum allowed label length is 11 characters.

This worked before with dosfstools, but in 2018, they added a label
validation [1]. This change got into the v4.2 release of dosfstools,
released in Jan 2021. And subsequently since F34, this new version of
dosfstools is present in Fedora repositories.

[1] ca54953476

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-02-03 14:51:07 +01:00
Diaa Sami
7c52db1ae1 worker/api: align & improve error handlers 2022-02-02 11:15:20 +01:00
Tom Gundersen
11e2ae4528 cloudapi/v2: add koji-specific tests
These are based on the existing tests for the koji API, making sure the coverage is the same.
2022-02-01 20:28:40 +00:00
Tom Gundersen
a3f8304ae8 cloudapi/v2: support multi-build composes
This is for now only supported for koji builds.

A lot of code moved around for this, but functionally not much changed. PostCompose() now only parses the input, and queueing of all the jobs have been factored out in separate functions. PostCompose() is mostly agnostic to koji/non-koji requests.
2022-02-01 20:28:40 +00:00
Tom Gundersen
6a9ffb2086 cloudapi/v2: make ComposeStatus handle multi-build composes
This brings parity with the koji API.
2022-02-01 20:28:40 +00:00
Tom Gundersen
c81d0d08ec cloudapi/v2: support logs/manifests endpoints
For now these only work for koji builds.
2022-02-01 20:28:40 +00:00
Tom Gundersen
b32ab36e1d worker/server: typesafe Job and JobStatus
Replace Job() and JobStatus() with typesafe versions, and introduce JobType()
for the rare instances where we don't know the type up front.

Additionally, catch a few more error cases:
 - if OSBuildResult is nil, then we failed to invoke osbuild
 - make sure the same JobResult handling is done for osbuild-koji, as for osbuild
2022-02-01 20:28:40 +00:00
Tom Gundersen
9fba2dcc5d cloudapi/v2: introduce multi build composes
This only extends the API, the backend can still only deal with composes of a single build.

I aimed to keep the API practically backwards compatible, i.e., no current consumer of it should notice the change. I hope I didn't mess that up.

fixup: image statuses
2022-02-01 20:28:40 +00:00
Tom Gundersen
c1dc9d7284 cloudapi/v2: introduce compose status
In addition to individual image status, have an
overall status that captures success or failure
of the compose as a whole.

This is not as fine grained, and only distinguishes
between "pending", "failure" and "success".

This captures other jobs than the image builds, which
is relevant for the koji composes, which consists also
of koji-init and koji-finalize, in addition to the build
jobs.
2022-02-01 20:28:40 +00:00
Tom Gundersen
c892ccfde0 cloudapi/v2: make upload request optional
For now upload requests are required if and only if we are not
using koji. When using the koji integration the produced artifacts
are uploaded to koji only. In the future we may want to support
also uploading to the cloud providers.
2022-02-01 20:28:40 +00:00
Tom Gundersen
92c7fc2534 cloupapi/v2: add koji support
Extend the compose endpoints to have minimal koji support.

This is intended to replace the current koji API so that it
can be consumed through api.openshift.com.
2022-02-01 20:28:40 +00:00
Achilleas Koutsou
2965833001 distro/rhel90: drop IA32 from bootiso.mono 2022-02-01 19:27:47 +01:00
Antonio Murdaca
f697414c03 distro/rhel90: drop IA32 from grub2iso
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-01 19:27:47 +01:00
Antonio Murdaca
db2be5d7c9 distro/rhel90: drop unavailable ia32 packages
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2022-02-01 19:27:47 +01:00
Tom Gundersen
0b24099751 jwt: support multiple key providers
We may need to use several SSO providers, so extend our
configuration to allow that.

Based on PoC from Sanne:

```
package main

import (
	"net/http"
	"log"

	"github.com/openshift-online/ocm-sdk-go/authentication"
	"github.com/openshift-online/ocm-sdk-go/logging"
)

type H struct{}

func (h *H) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	log.Println("HURRAY")
}

func main() {

	logBuilder := logging.NewGoLoggerBuilder()
	logger, err := logBuilder.Build()
	if err != nil {
		panic(err)
	}

	aH, err := authentication.NewHandler().
		KeysURL("https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/certs").
		KeysURL("https://identity.api.openshift.com/auth/realms/rhoas/protocol/openid-connect/certs").
			Logger(logger).Next(&H{}).Build()
	if err != nil {
		panic(err)
	}

	log.Fatal(http.ListenAndServe(":8080", aH))

}
```
2022-01-31 20:40:22 +00:00
Christian Kellner
669d3e0734 distro/rhel86: fix ec2 boot partition for arm64
It should be `1048576` (exactly 512 MiB), like it is for all other
distributions. It somehow got mingled in when the distribution was
forked off from 8.5/9.0 beta (1048676 to 1048576 strongly suggests
a sed command was involved, so we blame that).
2022-01-31 11:46:09 +01:00