-
Notifications
You must be signed in to change notification settings - Fork 24
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
Build opm cache locally to enable multi-arch builds #465
Conversation
@release-engineering/exd-guild-hello-operator PTAL |
LGTM, but it would be nice if Joe had a quick look as well. |
iib/workers/tasks/opm_operations.py
Outdated
@@ -406,6 +406,11 @@ def opm_generate_dockerfile( | |||
log.info('Rewriting Dockerfile %s with newly generated by opm.', dockerfile_path) | |||
os.rename(dockerfile_path_opm_default, dockerfile_path) | |||
|
|||
local_cache_path = os.path.join(base_dir, 'cache') | |||
if not os.path.exists(local_cache_path): |
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.
Is there a case where the local_cache_path
would already exist? If it does exist, how do we know if it is synced from the FBC we're about to build the image with?
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.
I'm pretty sure it's safe to just always run /bin/opm serve {fbc_dir} --cache-dir={local_cache_path} --cache-only
, even if the cache dir already exists. It will check cache integrity and only rebuild if hashes don't match.
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.
Done. Changed it to run every time
'RUN ["/bin/opm", "serve", "/configs", "--cache-dir=/tmp/cache", "--cache-only"]', | ||
f'COPY {local_cache_path} /tmp/cache', | ||
) | ||
|
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.
Unrelated question for this replacement. Is there a way to detect if the replacement didn't replace anything? In the future, if the dockerfile generation changes again, it would be nice if the failure message is something like: "failed to replace cache building execution in dockerfile" rather than the eventual/cryptic: "exec /bin/opm: exec format error" error that would happen during the image build.
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.
Added a check to confirm the COPY
line is added to the file and throw a more comprehendible error message if the replacement fails.
7a05dce
to
08e8dc0
Compare
08e8dc0
to
15bc137
Compare
15bc137
to
2758807
Compare
This change is triggered by an OPM upgrade which introduced cache for FBC indexes. More specifically, OPM > 1.26.2 Refers to CLOUDDST-16852
2758807
to
c828a9c
Compare
This change is triggered by an OPM upgrade which introduced cache for FBC indexes. More specifically, OPM > 1.26.2
Refers to CLOUDDST-16852