Skip to content

Pin the osbuild-composer commit for testing#535

Open
achilleas-k wants to merge 6 commits intoosbuild:mainfrom
achilleas-k:pin-composer
Open

Pin the osbuild-composer commit for testing#535
achilleas-k wants to merge 6 commits intoosbuild:mainfrom
achilleas-k:pin-composer

Conversation

@achilleas-k
Copy link
Copy Markdown
Member

Pin the osbuild-composer commit to use so that it doesn't float and cause unexpected failures.

We will later add a cronjob to update the commit regularly, like we do with osbuild.

@achilleas-k achilleas-k requested review from F-X64 and thozza March 17, 2026 14:55
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Now that osbuild-composer is pinned via Schutzfile, consider removing or repurposing the get_last_passed_commit function if it's no longer used to avoid dead code and confusion about the current source of the commit.
  • It might be safer to handle missing or null .dependencies.composer.commit entries in Schutzfile explicitly (e.g., with a clear error message) so the deploy fails early and predictably when the pin is not defined.
  • For consistency and readability, consider using the same style of jq invocation for both composer and osbuild commits (either both with cat or both directly on the file) and aligning the JSON paths if their structures are intended to be parallel.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that `osbuild-composer` is pinned via `Schutzfile`, consider removing or repurposing the `get_last_passed_commit` function if it's no longer used to avoid dead code and confusion about the current source of the commit.
- It might be safer to handle missing or `null` `.dependencies.composer.commit` entries in `Schutzfile` explicitly (e.g., with a clear error message) so the deploy fails early and predictably when the pin is not defined.
- For consistency and readability, consider using the same style of `jq` invocation for both composer and osbuild commits (either both with `cat` or both directly on the file) and aligning the JSON paths if their structures are intended to be parallel.

## Individual Comments

### Comment 1
<location path="schutzbot/deploy.sh" line_range="192-193" />
<code_context>
-
-setup_repo osbuild-composer "${GIT_COMMIT}" 5
+# Get pinned commit for osbuild-composer to install RPMs
+COMPOSER_GIT_COMMIT=$(jq -r '.["'"${ID}-${VERSION_ID}"'"].dependencies.composer.commit' Schutzfile)
+setup_repo osbuild-composer "${COMPOSER_GIT_COMMIT}" 5

 OSBUILD_GIT_COMMIT=$(cat Schutzfile | jq -r '.["'"${ID}-${VERSION_ID}"'"].dependencies.osbuild.commit')
</code_context>
<issue_to_address>
**issue:** Consider validating the composer commit from Schutzfile before passing it to setup_repo.

`get_last_passed_commit` used to guarantee a valid commit; now we trust the value from `Schutzfile` directly. If the key is missing or the value is `null`/empty, `setup_repo` will receive an invalid commit and fail later in a confusing way. Please add a check for `null`/empty here and fail fast with a clear error message mentioning the missing/invalid composer commit for `${ID}-${VERSION_ID}`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +192 to +193
COMPOSER_GIT_COMMIT=$(jq -r '.["'"${ID}-${VERSION_ID}"'"].dependencies.composer.commit' Schutzfile)
setup_repo osbuild-composer "${COMPOSER_GIT_COMMIT}" 5
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue: Consider validating the composer commit from Schutzfile before passing it to setup_repo.

get_last_passed_commit used to guarantee a valid commit; now we trust the value from Schutzfile directly. If the key is missing or the value is null/empty, setup_repo will receive an invalid commit and fail later in a confusing way. Please add a check for null/empty here and fail fast with a clear error message mentioning the missing/invalid composer commit for ${ID}-${VERSION_ID}.

@achilleas-k
Copy link
Copy Markdown
Member Author

Failures will be fixed by a04ceb6 (on #534).

F-X64
F-X64 previously approved these changes Mar 18, 2026
Copy link
Copy Markdown
Collaborator

@F-X64 F-X64 left a comment

Choose a reason for hiding this comment

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

I'm in favor of fixing the version.
I assume we will have an automatic PR as we do with the schutzfile?

@achilleas-k
Copy link
Copy Markdown
Member Author

I assume we will have an automatic PR as we do with the schutzfile?

Not yet, but I'll set it up.

@achilleas-k
Copy link
Copy Markdown
Member Author

Actually, let me just add the scheduled job in this PR. No need to do it elsewhere.

@achilleas-k
Copy link
Copy Markdown
Member Author

Added script and action.

@achilleas-k achilleas-k requested a review from F-X64 March 23, 2026 10:39
Copy link
Copy Markdown
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.

In general, this looks good, but there are some copy&paste errors.

Pin the osbuild-composer commit to use so that it doesn't float and
cause unexpected failures.
When deploying, read the commit ID from the Schutzfile to set up the
osbuild-composer repository.
Adapted from the osbuild update script in osbuild/images [1].

Unlike the existing function in deploy.sh, it doesn't check for
successful CI runs on the commit.  It simply makes sure it doesn't use a
post-release version bump commit (which don't run CI).

Failed CI runs in osbuild-composer often happen after the RPM build
stage and we only care about RPMs being available.  Skipping a commit
based on the overall GitLab CI run would skip over many valid commits.
Cases where the PR is created pointing to a commit that doesn't have an
RPM for a specific distro we need here can be dealt with manually
(usually by retrying the CI job on the main branch of osbuild-composer).

[1] https://github.com/osbuild/images/blob/8d0c776c4bf8687f413f3fcac2e28625bba2ce18/test/scripts/update-schutzfile-osbuild
Add a workflow that runs every Sunday to update the osbuild-composer
commit ID in the Schutzfile.
@achilleas-k
Copy link
Copy Markdown
Member Author

achilleas-k commented Mar 30, 2026

Thanks for catching those. Fixed and rebased.

Copy link
Copy Markdown
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.

LGTM

@thozza thozza enabled auto-merge (rebase) March 31, 2026 17:24
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.

3 participants