-
Notifications
You must be signed in to change notification settings - Fork 169
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
cmd-build: Fix wrong image.yaml after buildfetch
#3618
Conversation
Hi @mtalexan. Thanks for your PR. I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
059425f
to
a230095
Compare
buildfetch
image.yaml overwriting config's
buildfetch
image.yaml overwriting config'sbuildfetch
I think we intentionally embed the image.json/image.yaml into the OSTree commit so that it's canonical for the later stages. i.e. the later stages are not intended to pick it up from the config but rather from the OCI Archive/OSTree commit. If you are running TL;DR if you change the image.yaml, you need to |
EDIT: Misunderstood what was being said |
EDIT: Moved into description.
|
a230095
to
7c057ca
Compare
Yeah, sorry that's exactly what I meant by my statement. It's really not a valid case to call I was just pointing out that I did think about that case, and the calls to |
Jenkins is complaining about the python test coverage on Looking at the tests in |
It seems there was some confusion about this specific bug, as posted over in the Issue. The problem is that a The changes here are making sure that for only that case we don't copy the As mentioned, it's reasonable for |
Bump. Not sure how I can do anything about the reduced Python coverage, and I think we're all on the same page about this fixing something that does need fixing. |
@mtalexan i'm still not sure 100% on the problem. mind grabbing me in matrix? you can use chat.fedoraproject.org if you don't already have a setup. |
I did more digging on the implementation and logic behind The proposed solutions from that comment are:
I've already implemented Option 4 here, but I wonder if Option 6 might be better. |
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.
Another approach would be to just stop calling extract_image_json()
from import_ostree_commit()
and let each caller own whether they want to call it themselves or not (and then cosa build
just wouldn't call that). But that's a little error-prone and less DRY.
cosa build
is special in that it's the only command that creates new builds. All the other commands in which the import code is run are buildextend commands and so may need image.json
recreated. So special-casing just cosa build
seems reasonable to me.
Some suggestions but overall LGTM. For the commit message, maybe let's explain it a bit more clearly. E.g.:
cmd-build: always use freshly created
image.json
When importing the previous commit during a
cosa build
, we would clobber theimage.json
file we just derived from the source config. Fix this by tellingimport_ostree_commit()
to skip JSON extraction in this path.
7c057ca
to
d51baf0
Compare
Sorry @jlebon, I was pulled onto other things for the past while. I've updated with your recommendations now, including the commit message fixup. |
The Jenkins error is just that Python unit test coverage dropped below the limit. I don't see anywhere that additional python unit testing can be added without a huge amount of additional work though, the function I touched would be a large undertaking to add unit tests for. |
We haven't invested too much in trying to unit test our Python code. It's mostly glue code stuff that's better tested with integration tests like we do in CI and pipelines. Let's only lower the threshold here for now but in the future we should probably consider just dropping a threshold entirely. Prompted by coreos#3618 which triggered this.
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, agreed it's probably not worth it. Honestly, I'm not sure how much value that threshold actually has here. Anyway, for now I've just lowered the threshold some more.
Thanks for the patch!
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.
LGTM
The build error appears to be the same issue I'm seeing separately on |
Hmm weird. We did have a few successful merges since then. Possibly some bug in a dependency that was recently fixed? Anyway, I restarted CI here since the last run was a few days ago. If it fails again, we'll dig more into it. |
Head branch was pushed to by a user without write access
a328f2c
to
5a8a78a
Compare
Never mind, I found the issue and it was in my code. The extra I've squashed the new fix, the pytest.ini test coverage reduction, and my original changes all into 1 commit. |
When importing the previous commit during `cosa build`, we would clobber `image.json` file we just derived with the one from the imported commit. Fix this by telling `import_ostree_commit()` to skip JSON extraction on this execution path, but leave it as-is for other execution paths. Also drop required pytest coverage to 70% since this causes a drop below the old threshold but nothing touched can really be tested.
5a8a78a
to
b846989
Compare
/ok-to-test |
Add option to cmdlib.import_ostree_commit to conditionally exclude the image.json extraction that overwrites.
Add option to import_ostree_commit wrapper.
Use import_ostree_commit exclusion of image.json option when importing after creating image.json.
/closes #3616
The
buildextend-*
options don't need to add the flag when they call/useimport_ostree_commit_for_build
(or equivalent, some are in Python instead of bash) because they only work if you run them after thebuild
has completed. For thebuildextend-*
then, it works like an enforcement that theimage.json
/yaml
being used is the one from the originalbuild
and not one that's been modified since.An alternative I considered was just making a copy of the
tmp/image.json
before callingimport_ostree_commit_for_build
and then restoring it afterward, but that file is also copied intotmp/override/usr/lib/coreos-assembler/image.json
and also gets overwritten. So it would be trying to sync bypass logic incmd-build
with theextract_json()
function incmdlib.py
.My assumption is that it was not intentional that running a
build
after abuildfetch
would silently ignore your config'simage.yaml
and use the one from the fetched build.But if that's not the case, then we instead need to add the logic for merging the imported
image.json
on top of theimage-default.yaml
when it's imported. Otherwise it's impossible to ever change what's mandatory in theimage.yaml
/json
without breaking the ability to usebuildfetch
.Basically, it's mandatory that the
image.json
being run for a build always have the minimum fields defined in the current tools'image-default.yaml
, regardless of where it came from.