Skip to content

Conversation

@smarterclayton
Copy link
Contributor

This would take the machine-os-content base image and override it
with our changes in the PR

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 31, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: smarterclayton

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 31, 2019
@smarterclayton
Copy link
Contributor Author

@cgwalters testing this with ci-operator manually, hopefully will be able to confirm I can add that

@smarterclayton
Copy link
Contributor Author

/retest

yumdownloader --destdir=/tmp/rpms origin-node origin-clients && \
for i in $(find /tmp/rpms/ -name origin-*); do rpm2cpio $i | cpio -div; done && \
ostree --repo=/srv/repo commit --parent=$commit --tree=dir=. --orphan --selinux-policy / \
-s "origin-ci-dev overlay RPMs" --branch=origin-ci-dev
Copy link
Member

Choose a reason for hiding this comment

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

This needs to include the previous tree too so that it's a complete OSTree. See similar code in rpm-ostree: https://github.com/projectatomic/rpm-ostree/blob/master/tests/vmcheck/overlay.sh. It's a mouthful, but essentially:

ostree checkout <parent-tree> /tmp/working
<overlay binaries>
ostree commit /tmp/working --branch=origin-ci-dev

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, just ostree commit --tree=ref=<parent-tree> --tree=dir=. should work too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, add --tree-ref

Copy link
Contributor Author

Choose a reason for hiding this comment

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

--tree-ref=$commit?

Copy link
Member

Choose a reason for hiding this comment

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

--tree=ref=$commit --tree=dir=. will basically start off with the same tree as $commit and then overlay . on top of that.

Copy link
Member

Choose a reason for hiding this comment

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

(Another minor thing: --orphan and --branch are contradictory. We should probably error out on that. :) You can drop the --orphan and we can tweak pivot as mentioned to just default to the one branch that exists if there's no com.coreos.ostree-commit)

@cgwalters
Copy link
Member

This looks pausible to me. One minor thing is to add --consume.

Bigger picture I'd like to roll this functionality into rpm-ostree which will fix various things (e.g. the rpm database will be correct). But we don't need to do that right now.

It'd be nice to test this though before landing; but on the other hand today nothing will actually apply the updated oscontainer...once we land that work we can circle back here and e.g. add a test case that verifies that the kubelet's git hash is the same as the PR?

commit=$( find /srv -name *.commit | sed -Ee 's|.*objects/(.+)/(.+)\.commit|\1\2|' | head -1 ) && \
mkdir /tmp/working && cd /tmp/working && \
yumdownloader --destdir=/tmp/rpms origin-node origin-clients && \
for i in $(find /tmp/rpms/ -name origin-*); do rpm2cpio $i | cpio -div; done && \
Copy link
Member

Choose a reason for hiding this comment

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

Minor: I'd add a -iname '*.rpm' there to be extra explicit.

yumdownloader --destdir=/tmp/rpms origin-node origin-clients && \
for i in $(find /tmp/rpms/ -name origin-*); do rpm2cpio $i | cpio -div; done && \
ostree --repo=/srv/repo commit --parent=$commit --tree=ref=$commit --tree=dir=. --selinux-policy / \
-s "origin-ci-dev overlay RPMs" --branch=origin-ci-dev
Copy link
Member

Choose a reason for hiding this comment

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

So, --selinux-policy / here is using the file contexts from the f29 buildroot, but we're running in RHEL. Probably fine if none of the files need special labels, but why not use a CentOS buildroot with CentOS' selinux-policy-targeted?

Copy link
Member

Choose a reason for hiding this comment

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

Well...that makes it a bit harder to find ostree unfortunately 😢

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, yeah. So was looking at ostree ls -RX origin-ci-dev and it's basically all etc_t and bin_t (we're also including manpages right now, but meh... don't need to overoptimize here). Anyway, seems safe enough!

yumdownloader --destdir=/tmp/rpms origin-node origin-clients && \
for i in $(find /tmp/rpms/ -name origin-*); do rpm2cpio $i | cpio -div; done && \
ostree --repo=/srv/repo commit --parent=$commit --tree=ref=$commit --tree=dir=. --selinux-policy / \
-s "origin-ci-dev overlay RPMs" --branch=origin-ci-dev
Copy link
Member

Choose a reason for hiding this comment

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

Ahh OK, so one final gotcha here is that we also need to do the /etc -> /usr/etc translation (yet another reason why we should teach this to rpm-ostree). So basically just:

    for i in $(find /tmp/rpms/ -name origin-*); do rpm2cpio $i | cpio -div; done && \
    mv etc usr/ && \
    ...

This would take the machine-os-content base image and override it
with our changes in the PR
@smarterclayton
Copy link
Contributor Author

Merging so I can test jobs, if there's anything else me know and I'll fix.

@smarterclayton smarterclayton added the lgtm Indicates that a PR is ready to be merged. label Feb 1, 2019
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Looks good to me! We can follow up if we discover anything else.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@smarterclayton
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants