Skip to content

Fix Vagrant caching#3880

Merged
kolyshkin merged 2 commits intoopencontainers:mainfrom
kolyshkin:fix-vagrant-cache
Jun 6, 2023
Merged

Fix Vagrant caching#3880
kolyshkin merged 2 commits intoopencontainers:mainfrom
kolyshkin:fix-vagrant-cache

Conversation

@kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented May 23, 2023

As of today, vagrant stopped working, my best guess is due to bad caching. Here's an excerpt from logs (https://cirrus-ci.com/task/6211443486359552?logs=vagrant#L59):

...

vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes... Building native extensions. This could take a while... Installed the plugin 'vagrant-libvirt (0.12.1)'!

...

uname -s ; cat Vagrantfile.$DISTRO
Linux

...

Downloaded 481Mb in 4.096201s.
Cache hit for vagrant-8be35383dc00f23d080ff00b2a724c938d650254861f26b67624c28e3fe5e6ae! ...
Vagrant failed to initialize at a very early stage: The plugins failed to initialize correctly. This may be due to manual modifications made within the Vagrant home directory. ...
Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-libvirt (= 0.12.0)'

...

Note the vargrant-libvirt version difference (0.12.1 installed, 0.12.0 shown in vagrant up error). I think the installed version gets overwritten by an older one from the cache.

To fix, let's only cache ~/.vagrant.d/boxes (to save traffic downloading fedora image).

@kolyshkin kolyshkin marked this pull request as draft May 23, 2023 17:53
@kolyshkin kolyshkin force-pushed the fix-vagrant-cache branch from da48dfa to 99fad81 Compare May 23, 2023 17:58
As of today, vagrant stopped working, my best guess is due to bad
caching. Here's an excerpt from logs:

...
vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Building native extensions. This could take a while...
Installed the plugin 'vagrant-libvirt (0.12.1)'!
...
uname -s ; cat Vagrantfile.$DISTRO
Linux
...

Downloaded 481Mb in 4.096201s.
Cache hit for vagrant-8be35383dc00f23d080ff00b2a724c938d650254861f26b67624c28e3fe5e6ae!
...
Vagrant failed to initialize at a very early stage:
The plugins failed to initialize correctly. This may be due to manual
modifications made within the Vagrant home directory.
...
Error message given during initialization: Unable to resolve dependency:
user requested 'vagrant-libvirt (= 0.12.0)'
...

The problem is, vagrant cache overwrites newer plugin with an older one.

Let's only cache the downloaded image.

Also, change the cache fingerprint script (remove "Linux").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin force-pushed the fix-vagrant-cache branch from 99fad81 to 650efb2 Compare May 23, 2023 18:22
@kolyshkin
Copy link
Contributor Author

Without caching ~/.vagrant.d, it takes 4 minutes for vagrant_up_script.

With caching, it takes 3 minutes.

It still makes sense to cache the image (but not the rest).

@kolyshkin
Copy link
Contributor Author

OK, it makes sense to only cache ~/.vagrant.d/boxes (to save traffic from fedora download sites).

@kolyshkin
Copy link
Contributor Author

Without caching ~/.vagrant.d, it takes 4 minutes for vagrant_up_script.

With caching, it takes 3 minutes.

Times differ a lot. Last measurement -- 3 minutes w/o caching, 2:30 with cache. In any case, it makes sense to save some traffic.

@kolyshkin kolyshkin marked this pull request as ready for review May 23, 2023 19:08
@kolyshkin kolyshkin force-pushed the fix-vagrant-cache branch from 988b058 to a7de200 Compare May 23, 2023 19:16
@kolyshkin kolyshkin added the backport/1.1-todo A PR in main branch which needs to be backported to release-1.1 label May 23, 2023
@eiffel-fl eiffel-fl mentioned this pull request May 25, 2023
5 tasks
... so we can run all four jobs in parallel.

While at it, fix the comment in the file.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin force-pushed the fix-vagrant-cache branch from a7de200 to bb4dbbc Compare June 6, 2023 00:25
@kolyshkin
Copy link
Contributor Author

@thaJeztah PTAL

@kolyshkin kolyshkin enabled auto-merge June 6, 2023 21:12
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin kolyshkin merged commit df57f74 into opencontainers:main Jun 6, 2023
@kolyshkin kolyshkin added backport/1.1-done A PR in main branch which has been backported to release-1.1 and removed backport/1.1-todo A PR in main branch which needs to be backported to release-1.1 labels Jun 8, 2023
@kolyshkin
Copy link
Contributor Author

backported to 1.1 in #3878

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

Labels

area/ci backport/1.1-done A PR in main branch which has been backported to release-1.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants