-
Notifications
You must be signed in to change notification settings - Fork 13
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
Layer metadata not getting cached after upgradiing to v2 #316
Comments
I'm not sure that I totally follow the issue that you're having, but previously the LayerContributor was typically where you applied layer caching, so the removal of that may be causing the caching problem you're seeing. Aside from that, I would suggest putting together a small sample that demonstrates the issue. I can take a look at that and try to give you further advise. |
The above mentioned function is what we are using for creating our layer. In options it is - build, cache or launch options. Now as a part of migration we have changed this
Now when we do pack build for the first time layer metadata is getting set through:
and during second run we expect that we should get this cached metadata. This is the corresponding logic:
But we see that metadata on the second execution is coming empty. We tried logging layer after first execution of pack build and before second execution of pack build. After first execution we see the following layer details which shows metadata getting set:
And before second execution we see metadata empty:
|
Hi @dmikusa is there an update on how should i proceed further with this? |
Sorry, had not had a chance to look at this.
If metadata exists for a layer, then this will load it (see https://github.com/buildpacks/libcnb/blob/main/layer.go#L179-L182). Since it's not presently, I can only assume that the file doesn't have any metadata. The lifecycle is responsible for restoring metadata, so you'd have to look at that more closely to see why it might not be restoring it. You have build + cache, so I think that would typically be correct to get layer metadata restored. I'm only seeing part of the puzzle, so I could be missing something. What I would suggest is to do some runs with |
I investigated and found that layer metadata writing step is writing metadata as empty - Line 291 in 986aa1f
With libcnb v1 we were getting this in logs while writing metadata for a layer-
With libcnb v2 we were getting this in logs while writing metadata for a layer-
We see that if we are just printing the layer after call our SetMetadata function we see that metadata is present in the layer -
But at the same time we see that this Writing metadata step mentioned here - link shows metadata is empty. |
This comment - link looks similar to this issue. Could you please provide some additional details mentioned in this comment? |
Would it be possible to create a simple repo that reproduces the problem so that I can run it locally with the Google buildpacks that use v2? |
@jkutner Here is the GoogleCloudPlatform Buildpacks with libcnb v2 changes - |
Ok, summarizing a bit and adding some questions.
Thanks |
So the error was with removing the layercontributor from our codebase, there was a reference issue. So the layer on which libcnb was operating and the one where we were trying to set metadata was pointing to different layer as layercontibutor used to expect &layer and now it accepts layer directly. Its fixed now. |
Fantastic! Thanks for following up. |
I am migrating from libcnb from v1(1.30.4)->v2(2.0.0). Following the migration doc we have removed layerContributor from our codebase.
Now we are trying to do pack build 2 times. Second time we are not passing "--clear-cache" flag and expects layer metadata that would have been cached to get reused when we ran it for the second time. But what we see is when we ran for the first time the metadata did got set in the layer but when we tried to retrieve it in the second run we were getting empty metedata.
We have only made changes corresponding to layercontributor removal and also upgraded buildpacks api version to 0.9.
Tasks
The text was updated successfully, but these errors were encountered: