-
Notifications
You must be signed in to change notification settings - Fork 128
NO-JIRA: Various patches to build extensions container using podman build in production
#1772
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
Merged
openshift-merge-bot
merged 9 commits into
openshift:master
from
jlebon:pr/extensions-meta
Mar 19, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
44e0d9f
ci/prow-entrypoint: stop building okd-c9s variant
jlebon 4df39e7
extensions/Dockerfile: only call get-ocp-repo.sh in OpenShift CI
jlebon 4bba6b7
extensions/Dockerfile: set default value for `VARIANT`
jlebon 4c29e4f
extensions/Dockerfile: support yumrepos secret
jlebon 3d97d30
extensions/Dockerfile: tweak `extensions.json` generation
jlebon 31816ac
extensions/Dockerfile: add extensions.json to last layer
jlebon eb0b37f
scripts/generate-metadata: skip `gpg-pubkey` rpmdb entries
jlebon 4a9510d
ci/prow-entrypoint: drop "build"/"init-and-build-default" verbs
jlebon 12e7354
ci/prow-entrypoint: build extensions in ocp-rhel-9.6 QEMU tests only
jlebon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,10 @@ FROM registry.ci.openshift.org/rhcos-devel/rhel-coreos:latest as os | |
| RUN mkdir /os | ||
| WORKDIR /os | ||
| ADD . . | ||
| ARG COSA | ||
| ARG VARIANT | ||
| RUN if [[ -z "$COSA" ]] ; then ci/get-ocp-repo.sh --ocp-layer packages-openshift.yaml; else ci/get-ocp-repo.sh --create-gpg-keys; fi | ||
| RUN if [[ -n "${VARIANT}" ]]; then MANIFEST="manifest-${VARIANT}.yaml"; EXTENSIONS="extensions-${VARIANT}.yaml"; else MANIFEST="manifest.yaml"; EXTENSIONS="extensions.yaml"; fi && rpm-ostree compose extensions --rootfs=/ --output-dir=/usr/share/rpm-ostree/extensions/ ./"${MANIFEST}" ./"${EXTENSIONS}" | ||
| ARG OPENSHIFT_CI=0 | ||
| ARG VARIANT="" | ||
| RUN if [ "${OPENSHIFT_CI}" != 0 ]; then ci/get-ocp-repo.sh --ocp-layer packages-openshift.yaml; fi | ||
| RUN --mount=type=secret,id=yumrepos,target=/os/secret.repo if [[ -n "${VARIANT}" ]]; then MANIFEST="manifest-${VARIANT}.yaml"; EXTENSIONS="extensions-${VARIANT}.yaml"; else MANIFEST="manifest.yaml"; EXTENSIONS="extensions.yaml"; fi && rpm-ostree compose extensions --rootfs=/ --output-dir=/usr/share/rpm-ostree/extensions/ ./"${MANIFEST}" ./"${EXTENSIONS}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this make the secret always required?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it's a no-op if the secret wasn't provided. |
||
|
|
||
| ## Creates the repo metadata for the extensions. | ||
| ## This uses Fedora as a lowest-common-denominator because it will work on | ||
|
|
@@ -21,16 +21,18 @@ RUN rm -f /etc/yum.repos.d/*.repo \ | |
| RUN dnf install -y createrepo_c | ||
| RUN createrepo_c /usr/share/rpm-ostree/extensions/ | ||
|
|
||
| # Generate extensions.json for meta.json, written to a bind-mounted path during the build. | ||
| # Generate extensions.json for meta.json. | ||
| # Use dnf repoquery to print 'name: version,' for each RPM | ||
| # sed to remove the comma from the last RPM | ||
| RUN sh -c 'echo "{" > /tmp/extensions.json && \ | ||
| dnf repoquery --repofrompath=extensions,/usr/share/rpm-ostree/extensions/ \ | ||
| RUN (echo "{" && \ | ||
| (dnf repoquery --repofrompath=extensions,/usr/share/rpm-ostree/extensions/ \ | ||
| --quiet --disablerepo=* --enablerepo=extensions \ | ||
| --queryformat "\"%{name}\": \"%{evr}.%{arch}\"," | \ | ||
| sed "$ s/,$//" >> /tmp/extensions.json && \ | ||
| echo "}" >> /tmp/extensions.json' | ||
| sed "$ s/,$//") && echo "}") >> /usr/share/rpm-ostree/extensions.json | ||
|
|
||
| ## Final container that has the extensions repo dir | ||
| FROM registry.access.redhat.com/ubi9/ubi:latest | ||
| COPY --from=builder /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/ | ||
| # Make this the last layer, this is similar to the metalayer trick in the node | ||
| # image, but this one is specific to rpm-ostree extensions. | ||
| COPY --from=builder /usr/share/rpm-ostree/extensions.json /usr/share/rpm-ostree/extensions.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, do we still need the
elseblock at all further down ,if we are only building with OPENSHIFT_CI=1 ? i.e when we are building with cosa? If we do, then the conditional below,also needs to accommodate the fact that ID can be
scos.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, can you expand? Which
elseblock exactly?Hmm, not sure I follow. In what scenario will the
IDbescos? Currently that's only in theokd-c9svariant, which pretty much I think we should just nuke at this point.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i think i understand now - i was talking about the block here, but i believe we need it for the tests? Now that the OKD images are layered and we don't need
okd-c9sanymore, should this be changed toc9sas well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that block is still being used in the cosa path to build the base RHCOS images.
I think it'll need to be reworked a bit yeah. Probably the cleanest actually is to just pass
/usr/share/rpm-ostree/treefile.jsonsince we're running from the node image which will inherit that from the base. And for the extensions manifest, probably we could auto-select between e.g.extensions-ocp.yamlandextensions-okd.yamlbased on the node image we're buildingFROM?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense. I can take a look at this and try to do this.