Skip to content
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

[cache] Use Azure SDK to restore cache always if explicitly set to true #1943

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

enescakir
Copy link

With the new cache service v2, "restoreCacheV2" 1 and "saveCacheV2" 2 now explicitly use the Azure SDK for blob operations.

The cacheHttpClient uses the Azure SDK to save the cache if the useAzureSdk option is set to true. 3

However, it may not use the Azure SDK to download the cache even if the useAzureSdk option is set to true. If the signed URL does not end with "blob.core.windows.net," it will not use the Azure SDK to restore the cache. 4

To ensure consistent behavior between saving and restoring the cache, the Azure SDK should be used to restore the cache if the useAzureSdk option is explicitly set to true.

This PR ensures that the Azure SDK is used to restore the cache whenever the useAzureSdk option is set to true.

Footnotes

  1. https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/cache.ts#L224

  2. https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/cache.ts#L472

  3. https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/internal/cacheHttpClient.ts#L335-L343

  4. https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/internal/cacheHttpClient.ts#L153

With the new cache service v2, `restoreCacheV2` [^1] and `saveCacheV2`
[^2] now explicitly use the Azure SDK for blob operations.

The cacheHttpClient uses the Azure SDK to save the cache if the
`useAzureSdk` option is set to true. [^3]

However, it may not use the Azure SDK to download the cache even if the
`useAzureSdk` option is set to true. If the signed URL does not end with
"blob.core.windows.net," it will not use the Azure SDK to restore the
cache. [^4]

To ensure consistent behavior between saving and restoring the cache,
the Azure SDK should be used to restore the cache if the `useAzureSdk`
option is explicitly set to true.

This PR ensures that the Azure SDK is used to restore the cache whenever
the `useAzureSdk` option is set to true.

[^1]: https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/cache.ts#L224
[^2]: https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/cache.ts#L472
[^3]: https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/internal/cacheHttpClient.ts#L335-L343
[^4]: https://github.com/actions/toolkit/blob/1f7c2c79e034fe8a0d28006f52fc5b70f6dbb750/packages/cache/src/internal/cacheHttpClient.ts#L153
@enescakir enescakir requested a review from a team as a code owner January 24, 2025 13:28
@enescakir
Copy link
Author

enescakir commented Jan 24, 2025

Hi @Link- , @joshmgross What do you think about this behavior improvement? I think it helps the cache service v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant