Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return compose request details as part of metadata response #4451

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bcl
Copy link
Contributor

@bcl bcl commented Oct 29, 2024

This pull request includes:

  • adequate testing for the new functionality or fixed issue
  • adequate documentation informing people about the change such as
    • submit a PR for the READMEs listed here
    • submit a PR for the osbuild.org website repository if this PR changed any behavior not covered by the automatically updated READMEs

@bcl bcl force-pushed the main-metadata-request branch from ca6d2fb to df51355 Compare November 15, 2024 18:12
@bcl bcl requested a review from schuellerf November 26, 2024 23:28
@bcl bcl force-pushed the main-metadata-request branch from df51355 to fd7d358 Compare November 26, 2024 23:40
schuellerf
schuellerf previously approved these changes Nov 27, 2024
Copy link
Contributor

@schuellerf schuellerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I got it correct, this is only for on-prem as it will be empty in the service, right?
To get it consistent we would need to extend image-builder to also return the request by just getting it from the image-builder DB (json or postgres) in a subsequent PR.
otherwise it LGTM

@schuellerf
Copy link
Contributor

schuellerf commented Nov 27, 2024

Two questions aside:

  • where does the issue (triggering this PR) come from, which problem does it solve?
  • is this ComposeMetadata → request (similar to the ComposeMetadata → packages) big? would it make sense to be able to mask it in the getComposeMetadata request by something like getComposeMetadata → hide_{packages,request}

(it's a bit confusing that there is a request in the response, but I hope my comment is somehow readable)

@bcl
Copy link
Contributor Author

bcl commented Dec 2, 2024

This is part of https://issues.redhat.com/browse/COMPOSER-2131 (which is also related to cockpit-composer using cloudapi instead of weldr).

The request is in the response because I want to reuse the openapi structure instead of reinventing and copying, etc. I don't think size is a consideration, it will be as big as the original request so I don't see any reason to complicate things by trying to hide it.

ETA: And yes, it is on-prem only for now, conditional on the artifact directory being used. Using the db is beyond the scope of this PR and can be added later if needed.

@bcl bcl force-pushed the main-metadata-request branch from fd7d358 to 61fab81 Compare December 17, 2024 16:51
@bcl bcl force-pushed the main-metadata-request branch from 61fab81 to 546fb8b Compare January 11, 2025 00:15
@bcl bcl force-pushed the main-metadata-request branch 2 times, most recently from fe0fe5b to 50fa879 Compare February 5, 2025 16:46
@bcl bcl force-pushed the main-metadata-request branch from 50fa879 to 9aef543 Compare February 13, 2025 20:01
@bcl bcl requested review from thozza and a team as code owners February 13, 2025 20:01
@bcl bcl requested review from achilleas-k and schuellerf and removed request for a team February 13, 2025 20:01
bcl added a commit to bcl/weldr-client that referenced this pull request Feb 18, 2025
Because of how cloud composes are started they may, or may not, have
information about the blueprint used to create them. Handle this by
leaving those fields blank in the output until PR
osbuild/osbuild-composer#4451 is merged.

This also translates the existing filter strings so that cloud composes
can also be filtered -- but there is no difference between waiting and
running so they both return pending cloudapi composes.

Related: RHEL-60123
bcl added a commit to bcl/weldr-client that referenced this pull request Feb 18, 2025
Because of how cloud composes are started they may, or may not, have
information about the blueprint used to create them. Handle this by
leaving those fields blank in the output until PR
osbuild/osbuild-composer#4451 is merged.

Related: RHEL-60123
@schuellerf schuellerf force-pushed the main-metadata-request branch from 9aef543 to a597592 Compare February 25, 2025 14:19
bcl added 5 commits February 25, 2025 08:55
This will allow clients to display more information about a compose,
including the image type created, arch and distro, and blueprint to
customizations used to create it.

Related: RHEL-60120
This will help make it easier to write the original compose request json
to the same directory tree.

Related: RHEL-60120
The original compose request contains useful details that are not
preserved when it is converted to a manifest. Things like the
distribution, arch, image type, blueprint or customizations are useful
when examining builds later.

This saves the original request json using the job id and a new
directory (ComposeRequest) under the artifacts directory. The original
request, if present, is then added to the compose/<id>/metadata response
alongside the package list.

Related: RHEL-60120
@bcl bcl force-pushed the main-metadata-request branch from a597592 to 4faf0e2 Compare February 25, 2025 17:06
Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: the original review was not really relevant, so I deleted it.

@@ -630,6 +644,7 @@ func (h *apiHandlers) getComposeMetadataImpl(ctx echo.Context, id string) error
Id: jobId.String(),
Kind: "ComposeMetadata",
},
Request: request,
Copy link
Member

@thozza thozza Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I don't think that the compose request should be returned as is. It can contain e.g. activation key, which is considered a kind of a secret. I'd suggest to filter some fields out.

EDIT: I consider this acceptable if being used only on-prem for now.

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, I missed the fact that the save / read function returns nil when the Artifacts Dir is not set... 🙄 😇

All fine...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants