forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 130
Bug 2033751: fix -rt builds and copy extensions into resulting image #1106
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-robot
merged 2 commits into
openshift:master
from
rphillips:copy_extensions
Jan 13, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,18 @@ | ||
| # fedora:29 is an image built within the release scripts: | ||
| # https://github.com/openshift/release/blob/b45a09d248b8cdb8fe3bf5f3cfa0b4fee57d04c8/ci-operator/config/openshift/kubernetes/openshift-kubernetes-release-4.10.yaml#L63-L65 | ||
| FROM fedora:29 AS build | ||
|
|
||
| # the registry is defined here: | ||
| # https://github.com/openshift/release/blob/b45a09d248b8cdb8fe3bf5f3cfa0b4fee57d04c8/ci-operator/config/openshift/kubernetes/openshift-kubernetes-release-4.10.yaml#L68 | ||
|
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. Same comment as above, can be changed. |
||
| COPY --from=registry.svc.ci.openshift.org/openshift/origin-v4.0:machine-os-content /srv/ /srv/ | ||
| RUN set -x && yum install -y ostree rpm-ostree yum-utils selinux-policy-targeted && \ | ||
| curl http://base-4-3-rhel8.ocp.svc > /etc/yum.repos.d/rhel8.repo && \ | ||
| commit=$( find /srv -name *.commit | sed -Ee 's|.*objects/(.+)/(.+)\.commit|\1\2|' | head -1 ) && \ | ||
| mkdir /tmp/working && cd /tmp/working && \ | ||
| rpm-ostree db list --repo /srv/repo $commit > /tmp/packages && \ | ||
| PACKAGES=(openshift-hyperkube) && \ | ||
| yumdownloader -y --disablerepo=* --enablerepo=built --destdir=/tmp/rpms "${PACKAGES[@]}" && \ | ||
| if ! grep -q cri-o /tmp/packages; then yumdownloader -y --disablerepo=* --enablerepo=rhel-8* --destdir=/tmp/rpms cri-o cri-tools; fi && \ | ||
| if ! grep -q machine-config-daemon /tmp/packages; then yumdownloader -y --disablerepo=* --enablerepo=rhel-8* --destdir=/tmp/rpms machine-config-daemon; fi && \ | ||
| ls /tmp/rpms/ && (cd /tmp/rpms/ && ls ${PACKAGES[@]/%/*}) && \ | ||
| for i in $(find /tmp/rpms/ -name *.rpm); do echo "Extracting $i ..."; rpm2cpio $i | cpio -div; done && \ | ||
| if [[ -d etc ]]; then mv etc usr/; fi && \ | ||
| mkdir -p /tmp/tmprootfs/etc && \ | ||
| ostree --repo=/srv/repo checkout -U $commit --subpath /usr/etc/selinux /tmp/tmprootfs/etc/selinux && \ | ||
| ostree --repo=/srv/repo commit --parent=$commit --tree=ref=$commit --tree=dir=. \ | ||
| --selinux-policy /tmp/tmprootfs \ | ||
| -s "origin-ci-dev overlay RPMs" --branch=origin-ci-dev | ||
| COPY --from=registry.svc.ci.openshift.org/openshift/origin-v4.0:machine-os-content /extensions/ /extensions/ | ||
| WORKDIR / | ||
| COPY install.sh . | ||
| RUN ./install.sh | ||
|
|
||
| FROM scratch | ||
| COPY --from=build /srv/ /srv/ | ||
rphillips marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| COPY --from=build /extensions/ /extensions/ | ||
|
|
||
| LABEL io.openshift.build.version-display-names="machine-os=rhcos image for testing openshift kubernetes kubelet only- if you see this outside of PR runs for openshift kubernetes- you found an urgent blocker bug" \ | ||
| io.openshift.build.versions="machine-os=1.2.3-testing-if-you-see-this-outside-of-PR-runs-for-openshift-kubernetes-you-found-an-urgent-blocker-bug" | ||
| LABEL io.openshift.build.version-display-names="machine-os=rhcos image for testing openshift kubernetes kubelet only- if you see this outside of PR runs for openshift kubernetes- you found an urgent blocker bug" | ||
| LABEL io.openshift.build.versions="machine-os=1.2.3-testing-if-you-see-this-outside-of-PR-runs-for-openshift-kubernetes-you-found-an-urgent-blocker-bug" | ||
|
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. Don't change it, the idea was to have the least amount of layers as possible, which results in smaller image. |
||
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -xeou pipefail | ||
|
|
||
| yum install -y ostree rpm-ostree yum-utils selinux-policy-targeted xfsprogs | ||
| curl http://base-4-10-rhel8.ocp.svc > /etc/yum.repos.d/rhel8.repo | ||
|
|
||
| commit=$( find /srv -name *.commit | sed -Ee 's|.*objects/(.+)/(.+)\.commit|\1\2|' | head -1 ) | ||
| mkdir /tmp/working && cd /tmp/working | ||
| rpm-ostree db list --repo /srv/repo $commit > /tmp/packages | ||
|
|
||
| PACKAGES=(openshift-hyperkube) | ||
| yumdownloader -y --disablerepo=* --enablerepo=built --destdir=/tmp/rpms "${PACKAGES[@]}" | ||
| if ! grep -q cri-o /tmp/packages; then | ||
| yumdownloader -y --disablerepo=* --enablerepo=rhel-8* --destdir=/tmp/rpms cri-o cri-tools | ||
| fi | ||
|
|
||
| ls /tmp/rpms/ && (cd /tmp/rpms/ && ls ${PACKAGES[@]/%/*}) | ||
| for i in $(find /tmp/rpms/ -name *.rpm); do | ||
| echo "Extracting $i ..."; rpm2cpio $i | cpio -div | ||
| done | ||
|
|
||
| if [[ -d etc ]]; then | ||
| mv etc usr/ | ||
| fi | ||
|
|
||
| mkdir -p /tmp/tmprootfs/etc | ||
|
|
||
| ostree --repo=/srv/repo checkout \ | ||
| -U $commit \ | ||
| --subpath /usr/etc/selinux \ | ||
| /tmp/tmprootfs/etc/selinux | ||
|
|
||
| ostree --repo=/srv/repo commit \ | ||
| --parent=$commit \ | ||
| --tree=ref=$commit \ | ||
| --tree=dir=. \ | ||
| --selinux-policy /tmp/tmprootfs \ | ||
| -s "origin-ci-dev overlay RPMs" \ | ||
| --branch=origin-ci-dev |
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.
That's wrong, that's only reflecting the mapping, we can change it here and we should change it. I can followup on that, and then we'll update release repo as well.