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

rpm-ostree: use prefetched RPMs, add hermetic option #928

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

chmeliik
Copy link
Contributor

@chmeliik chmeliik commented Apr 9, 2024

See individual commits for more details

STONEBLD-2281

If the prefetch-dependencies task has prefetched RPMs, make the
rpm-ostree build use them. Do this by removing all the original repo
files from the source directory and replacing them with the generated
cachi2.repo.


Also expose the --dev-package-managers flag for the prefetch task (therefore this also relates to STONEBLD-2280)


And add a hermetic option to the rpm-ostree task

@chmeliik chmeliik force-pushed the rpm-ostree-plus-cachi2-rpms branch from 42bd22c to 323fbfc Compare April 9, 2024 08:55
chmeliik added a commit to chmeliik/centos-bootc-tmp that referenced this pull request Apr 9, 2024
chmeliik added a commit to chmeliik/centos-bootc-tmp that referenced this pull request Apr 9, 2024
@chmeliik chmeliik force-pushed the rpm-ostree-plus-cachi2-rpms branch 3 times, most recently from 322c237 to 5d7b80c Compare April 9, 2024 12:54
@chmeliik chmeliik changed the title rpm-ostree: use prefetched RPMs when available rpm-ostree: use prefetched RPMs, add hermetic option Apr 9, 2024
@chmeliik
Copy link
Contributor Author

chmeliik commented Apr 9, 2024

Tested in chmeliik/centos-bootc-tmp#7, chmeliik/centos-bootc-tmp#8 and chmeliik/centos-bootc-tmp#9

Prefetch + hermetic works, hermetic without prefetch fails as expected, non-hermetic without prefetch still works.

Some notes.

@chmeliik
Copy link
Contributor Author

chmeliik commented Apr 9, 2024

Also tested how this works with the source build task (see final pipeline in https://github.com/chmeliik/centos-bootc-tmp/blob/hermetically/.tekton/ostree-build.yaml). There is a bug in the source build task which causes the source container to not include any SRPMs. Will fix.

@chmeliik chmeliik force-pushed the rpm-ostree-plus-cachi2-rpms branch from 5d7b80c to ccb00e3 Compare April 9, 2024 13:30
@chmeliik
Copy link
Contributor Author

chmeliik commented Apr 9, 2024

the total size of the prefetched RPMs and SRPMs is about 5.3 Gi

Also, if I'm not wrong, 2.4 Gi of that are duplicates

$ fdupes -r cachi2-output > dupes.txt
$ cat dupes.txt | xargs du -b | awk '{ s += $1 } END { print s }' | numfmt --to=iec-i 
4.8Gi

Of those, roughly 400Mi are noarch duplicates (these are needed - each noarch RPM has to be in every arch-specific subdirectory, otherwise only one arch will have access to them). The remaining 2 Gi are duplicate SRPMs (these are not needed).

$ grep 'noarch.rpm$' dupes.txt | xargs du -b | awk '{ s += $1 } END { print s }' | numfmt --to=iec-i 
792Mi

$ grep 'src.rpm$' dupes.txt | xargs du -b | awk '{ s += $1 } END { print s }' | numfmt --to=iec-i 
4.0Gi

TLDR, the lockfile generation needs a lot of work.

@chmeliik
Copy link
Contributor Author

chmeliik commented Apr 9, 2024

Also tested how this works with the source build task (see final pipeline in https://github.com/chmeliik/centos-bootc-tmp/blob/hermetically/.tekton/ostree-build.yaml). There is a bug in the source build task which causes the source container to not include any SRPMs. Will fix.

The fix: konflux-ci/build-tasks-dockerfiles#63

@chmeliik
Copy link
Contributor Author

chmeliik commented Apr 9, 2024

/retest

@chmeliik
Copy link
Contributor Author

Just screenshotting the passing CI for future reference 😅

image

@chmeliik chmeliik force-pushed the rpm-ostree-plus-cachi2-rpms branch from ccb00e3 to 375ca7d Compare April 10, 2024 08:43
Copy link
Collaborator

@mmorhun mmorhun left a comment

Choose a reason for hiding this comment

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

LGTM

task/rpm-ostree/0.1/rpm-ostree.yaml Outdated Show resolved Hide resolved
@chmeliik chmeliik force-pushed the rpm-ostree-plus-cachi2-rpms branch from 375ca7d to 62e9b36 Compare April 10, 2024 10:12
@chmeliik
Copy link
Contributor Author

/retest

e2e-tests failed with

error when sending request to Github API: GET https://api.github.com/repos/redhat-appstudio-appdata/test-app-928-Dyf2k-demand-manage: 404 Not Found []

first time seeing that

@chmeliik
Copy link
Contributor Author

/retest

@ralphbean ralphbean enabled auto-merge April 10, 2024 13:36
@chmeliik
Copy link
Contributor Author

Another EC pipeline timeout

[build-service-suite Build templates E2E test] HACBS pipelines when the container image for component with Git source URL https://github.com/redhat-appstudio-qe/source-build-parent-image-with-digest-only is created and pushed to container registry [It] verify-enterprise-contract check should pass [build, build-templates, HACBS, pipeline, sbom, slow, build-templates-e2e]
/github.com/redhat-appstudio/e2e-tests/tests/build/build_templates.go:391

  Timeline >>
  Creating Pipeline "verify-enterprise-contract-run-jvm6j"
  Waiting for pipeline "verify-enterprise-contract-run-jvm6j" to finish
  [FAILED] in [It] - /github.com/redhat-appstudio/e2e-tests/tests/build/build_templates.go:459 @ 04/10/24 13:47:04.455
  << Timeline

  [FAILED] Expected success, but got an error:
      <context.deadlineExceededError>: 
      context deadline exceeded

STONEBLD-2280
STONEBLD-2281

The experimental RPM support that's being added to cachi2 will stay
gated behind the --dev-package-managers flag. Give users a way to enable
dev package managers.

Document the option as discouraged.

Signed-off-by: Adam Cmiel <[email protected]>
STONEBLD-2281

When the prefetch-dependencies task prefetches RPMs, make the
rpm-ostree task use them. Do this by removing all the original repo
files from the source directory and replacing them with the generated
cachi2.repo.

---

Note that the rpm-ostree task determines whether there are prefetched
RPMs by checking the existence of the platform-specific RPMs directory.
This means that if RPMs are prefetched for platform A but not for
platform B, the build for platform B will still work (and download the
RPMs at build time).

One may argue that this is undesirable, as it can lead to a situation
where one platform prefetches RPMs and another one does not. But this is
best addressed by enabling the 'hermetic' option to cut off network
access altogether (to be added in a follow-up commit).

Signed-off-by: Adam Cmiel <[email protected]>
STONEBLD-2281

With HERMETIC=true, the rpm-ostree build will have its network access
disabled.

This is done by setting --network=none for the podman container executed
on the remote VM (which runs the rpm-ostree command). Note that
rpm-ostree has an --offline option, but it doesn't do anything useful
for hermetic builds. Just prints a warning when RPMs have to be
downloaded.

Signed-off-by: Adam Cmiel <[email protected]>
@chmeliik chmeliik force-pushed the rpm-ostree-plus-cachi2-rpms branch from 62e9b36 to eab672a Compare April 10, 2024 13:59
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@chmeliik
Copy link
Contributor Author

PipelineRun source-build-parent-image-with-digest-only-gjxw-9b6hq reason: CouldntGetTask

interesting

/retest

@chmeliik
Copy link
Contributor Author

<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>

While pushing bundles. Thanks Quay.

@mmorhun mmorhun disabled auto-merge April 10, 2024 15:33
@mmorhun mmorhun merged commit d4b49e5 into konflux-ci:main Apr 10, 2024
5 of 6 checks passed
@chmeliik chmeliik deleted the rpm-ostree-plus-cachi2-rpms branch April 10, 2024 15:34
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