Commit graph

3869 commits

Author SHA1 Message Date
Tomas Hozza
ee285e5e8a Weldr: support GCP upload target
Add support for importing the GCE image into GCP using Weldr API. The
credentials to be used can be specified in the upload settings and will
be then used by the worker to authenticate with GCP.

The GCP target credentials are passed to Weldr API as base64 encoded
content of the GCP credentials JSON file. The reason is that the JSON
file contains many values and its format could change in the future.
This way, the Weldr API does not rely on the credentials file content
format in any way.

Add a new test case for the GCP upload via Weldr and run it in CI.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
249661a948 worker: rework GCP credentials handling
Refactor the handling of GCP credentials in the worker to be equivalent
to what is done for AWS. The main idea is that the code decides which
credentials to use when processing each job. This change will allow
preferring credentials passed via upload `TargetOptions` with the job,
over the credentials configured in worker's configuration or the default
way of authenticating implemented by the Google library.

Move loading of GCP credentials to the internal `gcp` library into
`NewFromFile()` function accepting path to the file with credentials.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
29174bfbef test/api.sh: take advantage of GCP guest tools to SSH to the VM
Modify the Cloud API test case for GCP to use `gcloud` and GCP guest
tools installed in the image to connect to the VM instance over SSH.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
82a0bfc46d internal/cloud/gcp: delete unused internal API
Delete all internal `cloud/gcp` API related to importing virtual images
to GCP using Cloud Build API. This API is no longer needed.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
13844edcdb cloudapi: use ComputeImageInsert() and gce image for GCP
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
8a064cef3e cmd/osbuild-upload-gcp: use ComputeImageInsert()
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
264e554971 cloud/gcp: introduce ComputeImageInsert() method
Introduce a new `ComputeImageInsert()` method for importing images into
GCP. It uses the `compute.Images.Insert()` API [1], which has many
advantages over the currently used way of importing images using the
CloudBuild API. The advantages are mainly that the image is imported as
is and no additional cache files or VMs are created as part of the
import process. Therefore there is no need to do additional cleanup of
cache files after importing the image.

In addition, the import itself is approximately 30% faster for RHEL
images when using the `Insert()` call.

Nevertheless the `Insert()` call accepts only gzip-ed tarball with a RAW
disk, unlike the `Import()` call, which accepts basically any virtual
disk format.

[1] https://cloud.google.com/compute/docs/reference/rest/v1/images/insert

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
e7f6b95032 RHEL-84: add gce-rhui image type
Add the `gce-rhui` image type intended for Google Compute Engine. The image
uses Google's RHUI infrastructure to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
795294d98f RHEL-84: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
2a8e6123aa RHEL-84: extend imageTypeS2 to contain pipelines generator function
Extend RHEL-84 `imageTypeS2` structure to contain pipelines generator
function. Previously, the `imageTypeS2` implementation defaulted to only
a single pipelines generator method for EDGE image types. The ability to
pass a different generator function implementation is important to
enable addition of new image types relying on osbuild Manifest v2.

Rename the original pipeline generator method to `edgePipelines`.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
77b5ef459d RHEL-85: add gce-rhui image type
Add the `gce-rhui` image type intended for Google Compute Engine. The image
uses Google's RHUI infrastructure to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
6ffe63442e RHEL-85: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
0219ad1f43 RHEL-86: add gce-rhui image type
Add the `gce-rhui` image type intended for Google Compute Engine. The image
uses Google's RHUI infrastructure to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
db75c39c4d RHEL-86: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
5d27b7c784 RHEL-90: add gce image type
Add the `gce` image type intended for Google Compute Engine. The image
is BYOS - bring your own subscription and requires registering in order
to access Red Hat content.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
ea3e6f072e test/api.sh: filter repos by image type
Filter the list of repositories passed in compose request based on the
`image_type_tags` object member. This is the same approach used by the
Weldr API. If the `image_type_tags` does not exist, the repo is added to
the list. If the `image_type_tags` exists, the repo is added to the list
only if the image type name is in the tags array.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
46e15794f0 image-info: support analyzing gce image type
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
800d57fda8 Extend ImageConfig and RHEL-86/90 osPipeline
Extend `ImageConfig` and RHEL-86/90 `osPipeline` with the following
configuration options:
 - DNF Automatic configuration
 - YUM / DNF repositories
 - Firewall configuration

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
5187ce999f image-types: Add research document for GCE image type
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
01b94a5787 RHEL-85: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline,
which creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
4ca2e64613 RHEL-86: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
b29d64c496 RHEL-90: introduce tarArchivePipeline()
Introduce `tarArchivePipeline()` function returning a pipeline, which
creates a Tar archive from another pipeline tree referenced by the
pipeline name.

Replace `tarStage()` with `osbuild.NewTarStage()`

Use the `tarArchivePipeline()` function in respective image type
pipelines.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
9a1cb773f1 osbuild2/tar: introduce NewTarStagePipelineTreeInputs()
Introduce `NewTarStagePipelineTreeInputs()` returning a pointer to new
`TarStageInputs` structure.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
1b618b1015 osbuild2/tar: don't omit explicit false values in options
The `tar` stage options contain three boolean values. All of them
default to `true` in the osbuild stage implementation [1]. However
if these values were explicitly set to `false`, they would be omitted
from the resulting JSON structure. As a result, it was impossible to use
any non-default values.

Use `*bool` instead of `bool`, to ensure that explicitly set `false`
values will end up in the JSON structure passed to osbuild.

[1] 8102f20d23/stages/org.osbuild.tar (L39-L53)

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
bd81506831 image-info: read the firewall default zone
Modify affected image manifests.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Tomas Hozza
cc413d4b2d osbuild2: support setting the default zone in firewall stage
Related to https://github.com/osbuild/osbuild/pull/980

Signed-off-by: Tomas Hozza <thozza@redhat.com>
2022-04-14 19:07:31 +01:00
Chloe Kaubisch
296313f588 cloudapi: specify min_size type
In the filesystem object, use x-go-type to specify
uint64 as the type for the min_size field. Avoids
a type conversion in v2.go.
2022-04-14 10:03:06 +02:00
dependabot[bot]
1c6f024f67 build(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 09:56:44 +02:00
dependabot[bot]
0543afe38b build(deps): bump github.com/Azure/go-autorest/autorest/azure/auth
Bumps [github.com/Azure/go-autorest/autorest/azure/auth](https://github.com/Azure/go-autorest) from 0.5.8 to 0.5.11.
- [Release notes](https://github.com/Azure/go-autorest/releases)
- [Changelog](https://github.com/Azure/go-autorest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Azure/go-autorest/compare/autorest/azure/auth/v0.5.8...autorest/azure/auth/v0.5.11)

---
updated-dependencies:
- dependency-name: github.com/Azure/go-autorest/autorest/azure/auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 09:56:20 +02:00
dependabot[bot]
8ca8dd5616 build(deps): bump github.com/gophercloud/gophercloud
Bumps [github.com/gophercloud/gophercloud](https://github.com/gophercloud/gophercloud) from 0.22.0 to 0.24.0.
- [Release notes](https://github.com/gophercloud/gophercloud/releases)
- [Changelog](https://github.com/gophercloud/gophercloud/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gophercloud/gophercloud/compare/v0.22.0...v0.24.0)

---
updated-dependencies:
- dependency-name: github.com/gophercloud/gophercloud
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 09:55:55 +02:00
Jakub Rusz
f21e5fd1c9 ci: do not download artifacts in finish stages
The jobs in finish stage are only meant to report the overall status of
the pipeline, they do not require to download the hundreds of artifacts
from the previous stages.
2022-04-13 10:34:58 +02:00
Gianluca Zuccarelli
2ad11acc2a cloudapi/test: add compose dependency error tests
Add depsolve job error dependency test cases for
regular composes and koji composes. The error furthest
up the chain should be returned in the details field
of the job error.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
e31fb36d65 cloudapi: add build job dependency checks
If an osbuild or koji-osbuild job has failed, add
a check to see if it is a result of the build jobs
dependencies and return the dependency failure job
error furthest up the chain of errors & add this
error to the details filed of the build job error.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
596464e8a2 cloudapi: fix koji build result
The incorrect result object was being used for
the kojibuild error objects.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
da94f2cbeb worker/server: build job dep errors
Add a helper function to query dependency
failures of osbuild & koji-osbuild jobs.
If a build job has a dependency error the
function will check for the job error of the
manifest job. If that also has a dependency
error the function will query the depsolve
job too for a job error.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
30d75d0e74 worker/clienterrors: depenency error check
Add a helper function to check for dependency
errors for job errors. This simply returns true
if a job error has a dependency error code and
false otherwise.
2022-04-13 10:31:53 +02:00
Gianluca Zuccarelli
b1969ba6a6 worker/clienterrors: omit details if empty
Omit the details field if it is null/empty.
2022-04-13 10:31:53 +02:00
dependabot[bot]
ecc30990c7 build(deps): bump github.com/aws/aws-sdk-go from 1.42.25 to 1.43.38
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.42.25 to 1.43.38.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.42.25...v1.43.38)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-13 09:17:55 +02:00
Jakub Rusz
0aad2fa43f mockbuild: use rpmrepo in mock templates
We're using rpmrepo snapshots as system repositories on the runners, so
let's use them also for mockbuild.
2022-04-12 13:13:50 +02:00
Jakub Rusz
65a777b286 Schutzfile: pin rpmrepo snapshots for fedora 2022-04-12 13:13:50 +02:00
Jakub Rusz
9c3e9ff616 ci: add team ssh keys in before_script
Add the keys in before_script to make also rpbuild runners accessible as
the deploy.sh script is not being ran there.
2022-04-12 13:13:50 +02:00
dependabot[bot]
0688d2180b build(deps): bump github.com/labstack/echo/v4 from 4.6.1 to 4.7.2
Bumps [github.com/labstack/echo/v4](https://github.com/labstack/echo) from 4.6.1 to 4.7.2.
- [Release notes](https://github.com/labstack/echo/releases)
- [Changelog](https://github.com/labstack/echo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/labstack/echo/compare/v4.6.1...v4.7.2)

---
updated-dependencies:
- dependency-name: github.com/labstack/echo/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-12 10:01:15 +02:00
Ygal Blum
b5dcb40b05 Generic S3 test - retry creating the alias in case the service is not yet up 2022-04-12 09:39:21 +02:00
Christian Kellner
e673b12957 rhel85: specify a minimum root file system size
Specify a size for the root filesystem in the partition table,
which basically equates to a minimum size. In reality all image
types specify a larger image size and thus we enlarge the root
file system to more than the specified size for plain layouts.
Does not change any existing manifests.
This also prepares the enablement of auto-LVM conversion, since
in that case we need to have a size for the root file system
specified.
2022-04-11 15:27:15 +02:00
Alexander Todorov
4c97fae0e9 Properly skip Fedora distros
Co-authored-by: Jakub Rusz <55534579+jrusz@users.noreply.github.com>
2022-04-11 15:27:15 +02:00
Alexander Todorov
8556a844e8 Add tests for blueprints without explicit definition for /
- currently disabled on Fedora until PR #2461 lands

Related: RHBZ#2049500
2022-04-11 15:27:15 +02:00
dependabot[bot]
2c2668f493 build(deps): bump github.com/jackc/pgx/v4 from 4.13.0 to 4.15.0
Bumps [github.com/jackc/pgx/v4](https://github.com/jackc/pgx) from 4.13.0 to 4.15.0.
- [Release notes](https://github.com/jackc/pgx/releases)
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v4.13.0...v4.15.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:22:31 +02:00
Ondřej Budai
a3c207945f weldr: update our use of BurntSushi/toml
The old method is deprecated and failing the linter.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2022-04-08 09:45:46 +02:00
dependabot[bot]
32f3d3d66e build(deps): bump github.com/BurntSushi/toml from 0.4.1 to 1.1.0
Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 0.4.1 to 1.1.0.
- [Release notes](https://github.com/BurntSushi/toml/releases)
- [Commits](https://github.com/BurntSushi/toml/compare/v0.4.1...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/BurntSushi/toml
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 09:45:46 +02:00
dependabot[bot]
c6070cdd09 build(deps): bump gopkg.in/ini.v1 from 1.63.0 to 1.66.4
Bumps [gopkg.in/ini.v1](https://github.com/go-ini/ini) from 1.63.0 to 1.66.4.
- [Release notes](https://github.com/go-ini/ini/releases)
- [Commits](https://github.com/go-ini/ini/compare/v1.63.0...v1.66.4)

---
updated-dependencies:
- dependency-name: gopkg.in/ini.v1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 09:44:52 +02:00