[WIP] Use custom cache dir for zypper up/patch commands#151
[WIP] Use custom cache dir for zypper up/patch commands#151parlt91 wants to merge 1 commit intoSUSE:masterfrom
Conversation
vrothberg
left a comment
There was a problem hiding this comment.
In addition to the small nitpick, can you add an integration test for this one?
A (hopefully) generic way would be:
-
Pull an opensuse image, clean the zypper cache and create a dummy file in the zypper's default cache.
-
Run some zypper-docker command that uses the cache on the
containerfrom the step above. -
Then check if the dummy file is present in the created image.
I didn't test it, but I am pretty sure it'll work.
| cmd := formatZypperCommand(fmt.Sprintf("%s ref", cacheDir), fmt.Sprintf("%s -n %v", cacheDir, zypperCmd)) | ||
| cmd = cmdWithFlags(cmd, ctx, boolFlags, toIgnore) | ||
| cmd += " && " + clean | ||
| cmd = makeTemp + " && " + cmd + " && " + rmTemp |
There was a problem hiding this comment.
Please add some comments. It's really hard to read, which is not your fault (given all the function calls), but some explanations would be a big help.
|
An even better way would be to create a hash of zypper's cache directory (see https://stackoverflow.com/questions/545387/linux-compute-a-single-hash-for-a-given-folder-contents). This way, we can be really sure that nothing has changed. |
Previously the default zypper cache directory was used for update/patch commands. This cache dir was emptied afterwards. If a user already had data from previous zypper commands in the cache, the data would be lost after a zypper-docker up/patch. Now a custom directory is used for the zypper-docker commands that will be deleted before the updated image is created. This way the default zypper cache dir will be preserved. Signed-off-by: Pascal Arlt <parlt@suse.com>
|
This PR is currently blocked due to a bug with zypper: openSUSE/zypper#180 |
Previously the default zypper cache directory was used for
update/patch commands. This cache dir was emptied afterwards.
If a user already had data from previous zypper commands in the
cache, the data would be lost after a zypper-docker up/patch.
Now a custom directory is used for the zypper-docker commands
that will be deleted before the updated image is created.
This way the default zypper cache dir will be preserved.
Signed-off-by: Pascal Arlt parlt@suse.com